Skip to content
Snippets Groups Projects
Jenkinsfile.admin 1.16 KiB
Newer Older
  • Learn to ignore specific revisions
  • pipeline {
      agent {
        node {
          label 'ozgcloud-jenkins-build-agent'
        }
      }
    
      environment {
            BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/alfa/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
            RELEASE_REGEX = /\d+.\d+.\d+/
            SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
            FAILED_STAGE = ""
            SH_SUCCESS_STATUS_CODE = 0
        }
    
        options {
            timeout(time: 1, unit: 'HOURS')
            disableConcurrentBuilds()
            buildDiscarder(logRotator(numToKeepStr: '5'))
        }
    
        // TODO check version
        stage('build') {
          steps {
            script {
              FAILED_STAGE=env.STAGE_NAME
    
              dir('alfa-client') {
                sh 'echo "registry=https://nexus.ozg-sh.de/repository/npm-proxy" >> ~/.npmrc'
                sh 'echo "//nexus.ozg-sh.de/:_auth=amVua2luczprTSFnNVUhMVQzNDZxWQ==" >> ~/.npmrc'
    
    						sh 'npm cache verify'
                sh 'npm install'
    
                if (isReleaseBranch()) {
                  sh 'npm run ci-prodBuild-admin'
                } else {
                  sh 'npm run ci-build-admin'
                }
              }
            }
          }
        }
    }
    
    Boolean isReleaseBranch() {
        return env.BRANCH_NAME == 'release'
    }