aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deliver.groovy253
1 files changed, 128 insertions, 125 deletions
diff --git a/deliver.groovy b/deliver.groovy
index 9270872..1a1ab97 100644
--- a/deliver.groovy
+++ b/deliver.groovy
@@ -93,6 +93,12 @@ def gen_specfiles(label, run_tests) {
def env_name = sh(script: "ls hstdp*", returnStdout: true).trim()[0..-5]
println("env_name: ${env_name}")
for (pkg in pkg_list.tokenize()) {
+ jenkinsfile = "${WORKDIR}/${pkg_name}/JenkinsfileRT"
+ if (!(fileExists(jenkinsfile))) {
+ continue
+ } else {
+ println("Found JenkinsfileRT not found for ${pkg_name}, installing and running tests.")
+ } //end if(!(fileExists(jenkinsfile)))
println("Extracting metadata for ${pkg}...")
pkg_name = pkg.tokenize('=')[0]
println("pkg_name: ${pkg_name}")
@@ -116,142 +122,139 @@ def gen_specfiles(label, run_tests) {
//if (pkg_name == "hstcal") {
// jenkinsfile = "./JenkinsfileRT"
//} else {
- jenkinsfile = "${WORKDIR}/${pkg_name}/JenkinsfileRT"
+ ////jenkinsfile = "${WORKDIR}/${pkg_name}/JenkinsfileRT"
//}
// Only run tests if JenkinsfileRT exists for project.
- if (fileExists(jenkinsfile)) {
-
- // Post-process each -dev project's JenkinsfileRT to allow
- // importing of only the configuration values without running
- // the processing machinery called within which would complicate
- // matters here.
- // Disable scm_checkout call in project's JenkinsfileRT.
- // NOTE: 'if' statement must be on same line as scm_checkout call.
- // TODO: Generalize to make this more robust against layout
- // changes in file.
- sh "sed -i 's/^\\s*if/\\/\\/if/' ${jenkinsfile}"
- // Disable utils.run line in projects's JenkinsfileRT.
- sh "sed -i 's/^\\s*utils.run/\\/\\/utils.run/' ${jenkinsfile}"
-
- println("About lo load local modified JenkinsfileRT")
- sh "ls -al"
- // Add declarations from file to this namespace. Provides 'bc'.
- // TODO: Iterate through namespace to locate buildConfig
- // objects without a standard name?
- // NOTE: 'evaluate' runs the methods it encounters.
- // Edit to disable to prevent undesired side effects.
- jf = evaluate readFile(jenkinsfile)
-
- def conda_prefix = "${conda_root}/envs/${env_name}".trim()
-
- def path_found = false
- for (var in bc.env_vars) {
- println("--> ${var}")
- if (var[0..3] == 'PATH') {
- path_found = true
- pathvar_idx = bc.env_vars.indexOf(var)
- bc.env_vars.remove(pathvar_idx)
- println(" --- ADJUSTING PATH FOR CONDA ENV ----")
- var = "PATH=${conda_prefix}/bin:${WORKDIR}/miniconda/bin:${var[5..-1]}"
- println(var)
- bc.env_vars.add(var)
- }
- }
- if (!path_found) {
- println("--- Adding PATH prefix for conda environment and conda exe.")
- bc.env_vars.add("PATH=${conda_prefix}/bin:${WORKDIR}/miniconda/bin:\$PATH")
- }
- bc.env_vars.add("ENVIRONMENT=VARIABLE-${pkg}")
-
- def bconfig = utils.expandEnvVars(bc) // expand vars into .runtime
-
- def env_vars = bconfig.runtime
- // 'Activate' conda env and operate within it.
- env_vars.add(0, "CONDA_SHLVL=1")
- env_vars.add(0, "CONDA_PROMPT_MODIFIER=${env_name}")
- env_vars.add(0, "CONDA_EXE=${conda_exe}")
- env_vars.add(0, "CONDA_PREFIX=${conda_prefix}")
- env_vars.add(0, "CONDA_PYTHON_EXE=${conda_prefix}/bin/python")
- env_vars.add(0, "CONDA_DEFAULT_ENV=${env_name}")
-
- println('FINAL ENV VARS')
- for (var in env_vars) {
+ //if (fileExists(jenkinsfile)) {
+
+ // Post-process each -dev project's JenkinsfileRT to allow
+ // importing of only the configuration values without running
+ // the processing machinery called within which would complicate
+ // matters here.
+ // Disable scm_checkout call in project's JenkinsfileRT.
+ // NOTE: 'if' statement must be on same line as scm_checkout call.
+ // TODO: Generalize to make this more robust against layout
+ // changes in file.
+ sh "sed -i 's/^\\s*if/\\/\\/if/' ${jenkinsfile}"
+ // Disable utils.run line in projects's JenkinsfileRT.
+ sh "sed -i 's/^\\s*utils.run/\\/\\/utils.run/' ${jenkinsfile}"
+
+ println("About lo load local modified JenkinsfileRT")
+ sh "ls -al"
+ // Add declarations from file to this namespace. Provides 'bc'.
+ // TODO: Iterate through namespace to locate buildConfig
+ // objects without a standard name?
+ // NOTE: 'evaluate' runs the methods it encounters.
+ // Edit to disable to prevent undesired side effects.
+ jf = evaluate readFile(jenkinsfile)
+
+ def conda_prefix = "${conda_root}/envs/${env_name}".trim()
+
+ def path_found = false
+ for (var in bc.env_vars) {
+ println("--> ${var}")
+ if (var[0..3] == 'PATH') {
+ path_found = true
+ pathvar_idx = bc.env_vars.indexOf(var)
+ bc.env_vars.remove(pathvar_idx)
+ println(" --- ADJUSTING PATH FOR CONDA ENV ----")
+ var = "PATH=${conda_prefix}/bin:${WORKDIR}/miniconda/bin:${var[5..-1]}"
println(var)
+ bc.env_vars.add(var)
}
+ }
+ if (!path_found) {
+ println("--- Adding PATH prefix for conda environment and conda exe.")
+ bc.env_vars.add("PATH=${conda_prefix}/bin:${WORKDIR}/miniconda/bin:\$PATH")
+ }
+ bc.env_vars.add("ENVIRONMENT=VARIABLE-${pkg}")
+
+ def bconfig = utils.expandEnvVars(bc) // expand vars into .runtime
+
+ def env_vars = bconfig.runtime
+ // 'Activate' conda env and operate within it.
+ env_vars.add(0, "CONDA_SHLVL=1")
+ env_vars.add(0, "CONDA_PROMPT_MODIFIER=${env_name}")
+ env_vars.add(0, "CONDA_EXE=${conda_exe}")
+ env_vars.add(0, "CONDA_PREFIX=${conda_prefix}")
+ env_vars.add(0, "CONDA_PYTHON_EXE=${conda_prefix}/bin/python")
+ env_vars.add(0, "CONDA_DEFAULT_ENV=${env_name}")
+
+ println('FINAL ENV VARS')
+ for (var in env_vars) {
+ println(var)
+ }
- // Run testing commands
- withEnv(env_vars) {
- println("============= withEnv ==========")
- sh "env | sort"
- // Obtain pip for build/install use
- sh "conda install pip"
- dir(pkg_name) {
- sh "ls -l"
- def conda_pkgs = ""
- for (cpkg in bc.conda_packages) {
- conda_pkgs = "${conda_pkgs} ${cpkg} "
- }
- sh "conda install ${conda_pkgs} pytest -c http://ssb.stsci.edu/astroconda -c defaults -q -y"
-
- // If setup.py exists in project, run `python setup.py build` to prepare
- // local source tree for testing. This is required for projects with C
- // extensions.
- if (fileExists("setup.py")) {
- sh(script: "pip install --no-deps -e .")
- }
- println("Test commands(s):")
- // TODO: Remove after 2019.2 delivery.
- if (pkg_name == 'calcos') {
- sh(script: "conda install ci-watson")
+ // Run testing commands
+ withEnv(env_vars) {
+ println("============= withEnv ==========")
+ sh "env | sort"
+ // Obtain pip for build/install use
+ sh "conda install pip"
+ dir(pkg_name) {
+ sh "ls -l"
+ def conda_pkgs = ""
+ for (cpkg in bc.conda_packages) {
+ conda_pkgs = "${conda_pkgs} ${cpkg} "
+ }
+ sh "conda install ${conda_pkgs} pytest -c http://ssb.stsci.edu/astroconda -c defaults -q -y"
+
+ // If setup.py exists in project, run `python setup.py build` to prepare
+ // local source tree for testing. This is required for projects with C
+ // extensions.
+ if (fileExists("setup.py")) {
+ sh(script: "pip install --no-deps -e .")
+ }
+ println("Test commands(s):")
+ // TODO: Remove after 2019.2 delivery.
+ if (pkg_name == 'calcos') {
+ sh(script: "conda install ci-watson")
+ }
+ println(bc.test_cmds)
+ for (tcmd in bc.test_cmds) {
+ sh(script: "${tcmd} || true")
+ }
+ // Uninstall packages pulled in for this test run, leaving
+ // any that were already present.
+ def remove_pkgs = ""
+ for (rpkg in conda_pkgs.split()) {
+ if ('=' in rpkg) {
+ rpkg = rpkg.split('=')[0].trim()
}
- println(bc.test_cmds)
- for (tcmd in bc.test_cmds) {
- sh(script: "${tcmd} || true")
- }
- // Uninstall packages pulled in for this test run, leaving
- // any that were already present.
- def remove_pkgs = ""
- for (rpkg in conda_pkgs.split()) {
- if ('=' in rpkg) {
- rpkg = rpkg.split('=')[0].trim()
- }
- if (!(rpkg in metapkg_names)) {
- remove_pkgs = "${remove_pkgs} ${rpkg}"
- }
-
+ if (!(rpkg in metapkg_names)) {
+ remove_pkgs = "${remove_pkgs} ${rpkg}"
}
- //sh "conda remove ${conda_pkgs} --force -y"
- sh "conda remove ${remove_pkgs} --force -y"
-
- // Read in test reports for display.
- // TODO: Use shared lib for this functionality.
- // Process the results file to include the build config name as a prefix
- // on each test name so that it is obvious from where each test result
- // comes.
- report_exists = sh(script: "test -e *.xml", returnStatus: true)
- if (report_exists == 0) {
- repfile = sh(script:"find *.xml", returnStdout: true).trim()
- command = "cp ${repfile} ${repfile}.modified"
- sh(script:command)
- sh(script:"sed -i 's/ name=\"/ name=\"[${pkg_name}:${bc.name}] /g' *.xml.modified")
- step([$class: 'XUnitBuilder',
- thresholds: [
- [$class: 'SkippedThreshold', unstableThreshold: "${bc.skippedUnstableThresh}"],
- [$class: 'SkippedThreshold', failureThreshold: "${bc.skippedFailureThresh}"],
- [$class: 'FailedThreshold', unstableThreshold: "${bc.failedUnstableThresh}"],
- [$class: 'FailedThreshold', failureThreshold: "${bc.failedFailureThresh}"]],
- tools: [[$class: 'JUnitType', pattern: '*.xml.modified']]])
- } else {
- println("No .xml files found in directory ${pkg_name}. Test report ingestion skipped.")
- }
- }
+ }
+
+ //sh "conda remove ${conda_pkgs} --force -y"
+ sh "conda remove ${remove_pkgs} --force -y"
+
+ // Read in test reports for display.
+ // TODO: Use shared lib for this functionality.
+ // Process the results file to include the build config name as a prefix
+ // on each test name so that it is obvious from where each test result
+ // comes.
+ report_exists = sh(script: "test -e *.xml", returnStatus: true)
+ if (report_exists == 0) {
+ repfile = sh(script:"find *.xml", returnStdout: true).trim()
+ command = "cp ${repfile} ${repfile}.modified"
+ sh(script:command)
+ sh(script:"sed -i 's/ name=\"/ name=\"[${pkg_name}:${bc.name}] /g' *.xml.modified")
+ step([$class: 'XUnitBuilder',
+ thresholds: [
+ [$class: 'SkippedThreshold', unstableThreshold: "${bc.skippedUnstableThresh}"],
+ [$class: 'SkippedThreshold', failureThreshold: "${bc.skippedFailureThresh}"],
+ [$class: 'FailedThreshold', unstableThreshold: "${bc.failedUnstableThresh}"],
+ [$class: 'FailedThreshold', failureThreshold: "${bc.failedFailureThresh}"]],
+ tools: [[$class: 'JUnitType', pattern: '*.xml.modified']]])
+ } else {
+ println("No .xml files found in directory ${pkg_name}. Test report ingestion skipped.")
+ }
}
- } else {
- println("JenkinsfileRT not found for ${pkg_name}, skipping test run.")
- } //end if(fileExists(jenkinsfile))
+ }
} // endfor pkg
}