Your IP : 3.139.239.25


Current Path : /opt/cpanel/ea-ruby27/src/passenger-release-6.0.23/dev/ci/tests/debian/
Upload File :
Current File : //opt/cpanel/ea-ruby27/src/passenger-release-6.0.23/dev/ci/tests/debian/Jenkinsfile

def getDefaultDistros() {
    def distroInfo = readFile("packaging/debian/internal/lib/distro_info.sh")
    def matcher = distroInfo =~ /DEFAULT_DISTROS="(.+?)"/
    if (matcher.find()) {
        matcher.group(1).split().sort()
    } else {
        error("Unable to parse packaging/debian/internal/lib/distro_info.sh")
    }
}

def testDebianPackages(distro, arch, params) {
  if ((!distro in params) || params[distro]) {
    node("linux && ${arch}") {
      def env = [
        "CACHE_DIR=${env.JENKINS_HOME}/cache/${env.JOB_NAME}/${distro}-${arch}",
        "DISTRIBUTION=${distro}",
        "ARCHITECTURE=${arch}"
      ]
      withEnv(env) {
        checkout scm
        sh './dev/ci/tests/debian/run'
      }
    }
  } else {
    echo 'Test skipped.'
  }
}

pipeline {
  agent { node { label 'master-pipeline' } }

  options {
    buildDiscarder(logRotator(numToKeepStr: '10'))
    timeout(time: 90, unit: 'MINUTES')
    disableConcurrentBuilds()
    timestamps()
  }

  parameters {
    booleanParam(name: 'focal',  defaultValue: true, description: 'Test Ubuntu 20.04 packages')
    booleanParam(name: 'jammy',  defaultValue: true, description: 'Test Ubuntu 22.04 packages')
    booleanParam(name: 'noble',  defaultValue: true, description: 'Test Ubuntu 24.04 packages')

    booleanParam(name: 'bullseye',defaultValue: true, description: 'Test Debian 11 packages')
    booleanParam(name: 'bookworm',defaultValue: true, description: 'Test Debian 12 packages')
  }

  stages {
    stage('Initialize') {
      steps {
        script {
          if (env.JOB_NAME.indexOf('Enterprise') != -1) {
            env.ENTERPRISE = '1'
          } else {
            env.ENTERPRISE = '0'
          }

          // For debugging purposes
          sh 'env | sort'
        }
      }
    }



    stage('Test') {
      steps {
        script {
          def defaultDistros = getDefaultDistros()
          def i
          def parallelSteps = [:]
          def archs = ['amd64', 'arm64']
          // We use a plain loop over .each because of this bug:
          // https://issues.jenkins-ci.org/browse/JENKINS-27421
          for (j = 0; j < archs.size(); j++) {
            def arch = archs[j]
            for (i = 0; i < defaultDistros.size(); i++) {
              def distro = defaultDistros[i]
              parallelSteps["${distro} ${arch}"] = {
                testDebianPackages(distro, arch, params)
              }
            }
          }

          parallel(parallelSteps)
        }
      }
    }
  }
}

?>