close

Filter

loading table of contents...

Frontend Developer Manual / Version 2010

Table Of Contents

5.20.3 Code Examples

Code examples for a continuous theme import with Jenkins.

Theme Import Job Definition with Job DSL
new Job('import-themes') {
 concurrentBuild(false)
 jdk('Java 8')
 scm {
   git {
     branch('master')
     remote {
       github('account/repo')
       credentials('github-ci-creds')
     }
     extensions {
       cleanAfterCheckout()
       relativeTargetDirectory('blueprint')
     }
   }
 }
 parameters {
   booleanParam('PUBLISH', false, 'publish themes')
 }
 steps {
   maven {
     goals('clean install -pl :frontend,:theme-importer-application -am')
     rootPom('blueprint/pom.xml')
     mavenOpts('-Xmx1024m')
     localRepository(LocalRepositoryLocation.LOCAL_TO_WORKSPACE)
     properties(skipTests: true)
     mavenInstallation('Maven 3.6.0')
     providedSettings('coremedia-mvn-settings')
   }

   shell('''
     LOGIN_ARGS="-u admin -p admin -Dcap.client.server.ior.url=<IOR_URL>"
     cd ${THEME_IMPORTER_DIR}
     for THEME_ZIP in ${THEMES_DIR}/*.zip; do
       THEME=${$(basename ${THEME_ZIP})%%-*}
       ./bin/cm import-themes ${LOGIN_ARGS} ${THEME_ZIP}
       if [ "${PUBLISH}" = "true" ]; then
        ./bin/cm approve ${LOGIN_ARGS} -t /Themes/${THEME}
        ./bin/cm bulkpublish ${LOGIN_ARGS} -a -b -c /Themes/${THEME}
       fi
     done
   ''')
 }
}
  

Example 5.9. Job DSL description of theme import


Theme Import Job Definition with Jenkinsfile
pipeline {
 options {
  disableConcurrentBuilds()
 }
 agent any
 tools {
  maven 'Maven 3.6.0'
  jdk 'Java 8'
 }
 parameters {
   booleanParam( name: 'PUBLISH',
                 defaultValue: false,
                 description: 'publish themes')
 }
 stages {
  stage('checkout workspace') {
   steps {
    checkout(
     [$class : 'GitSCM',
     branches : [['master']],
     userRemoteConfigs : [[credentialsId: 'git-ci-creds',
                           url: 'account/repo']]])
     extensions : [[$class: 'RelativeTargetDirectory',
                  relativeTargetDir: 'blueprint'],
                  [$class: 'CleanBeforeCheckout']]
    }
   }

  stage('build themes') {
   steps {
    configFileProvider([configFile(
    fileId: 'coremedia-mvn-settings',
    variable: 'MVN_SETTINGS')]) {
     sh '''
      cd blueprint
      MVN_ARGS="-Dmaven.repo.local=.repository -s ${MVN_SETTINGS}"
      mvn clean install ${MAVEN_ARGS} -pl :frontend
     '''
    }
   }
  }

  stage('import themes) {
   steps {
    configFileProvider(
    [configFile(fileId: 'coremedia-mvn-settings',
    variable: 'MVN_SETTINGS')]) {
     sh '''
      LOGIN_ARGS="-u admin -p admin -Dcap.client.server.ior.url=<IOR_URL>"
      MVN_ARGS="-Dmaven.repo.local=.repository -s ${MVN_SETTINGS}"
      cd blueprint
      mvn install ${MAVEN_ARGS} -pl :theme-importer-application
      cd ${THEME_IMPORTER_DIR}
      for THEME_ZIP in ${THEMES_DIR}/*.zip; do
        THEME=${$(basename ${THEME_ZIP})%%-*}
        ./bin/cm import-themes ${LOGIN_ARGS} ${THEME_ZIP}
        if [ "${PUBLISH}" = "true" ]; then
          ./bin/cm approve ${LOGIN_ARGS} -t /Themes/${THEME}
          ./bin/cm bulkpublish ${LOGIN_ARGS} -a -b -c /Themes/${THEME}
        fi
      done
     '''
    }
   }
  }
 }
}

Example 5.10. Jenkinsfile description of theme import


Search Results

Table Of Contents