-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from lsst-ts/tickets/DM-44299
Use LSST-TS Jenkins shared libraries.
- Loading branch information
Showing
2 changed files
with
21 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,152 +1,13 @@ | ||
#!/usr/bin/env groovy | ||
|
||
pipeline { | ||
|
||
agent { | ||
// Use the docker to assign the Python version. | ||
// Use the label to assign the node to run the test. | ||
// It is recommended by SQUARE team do not add the label to let the | ||
// system decide. | ||
docker { | ||
image 'lsstts/develop-env:develop' | ||
args "--entrypoint=''" | ||
alwaysPull true | ||
// Specify the nodes that have the git-lfs tool installed. | ||
// If run on nodes without git-lfs the tests will fail. | ||
label 'Node3_4CPU || CSC_Conda_Node' | ||
} | ||
} | ||
|
||
options { | ||
disableConcurrentBuilds() | ||
skipDefaultCheckout() | ||
} | ||
|
||
triggers { | ||
cron(env.BRANCH_NAME == 'develop' ? '0 4 * * *' : '') | ||
} | ||
|
||
environment { | ||
// Position of LSST stack directory | ||
LSST_STACK = "/opt/lsst/software/stack" | ||
// Pipeline Sims Version | ||
STACK_VERSION = "current" | ||
// XML report path | ||
XML_REPORT = "jenkinsReport/report.xml" | ||
// Module name used in the pytest coverage analysis | ||
MODULE_NAME = "lsst.ts.wep" | ||
// Authority to publish the document online | ||
user_ci = credentials('lsst-io') | ||
LTD_USERNAME = "${user_ci_USR}" | ||
LTD_PASSWORD = "${user_ci_PSW}" | ||
DOCUMENT_NAME = "ts-wep" | ||
} | ||
|
||
stages { | ||
|
||
stage('Cloning Repos') { | ||
steps { | ||
dir(env.WORKSPACE + '/ts_wep') { | ||
script { | ||
if (env.BRANCH_NAME == 'develop' || env.BRANCH_NAME == 'main') { | ||
SCM_BRANCH = env.BRANCH_NAME | ||
} | ||
else { | ||
SCM_BRANCH = env.CHANGE_BRANCH | ||
} | ||
} | ||
checkout scm | ||
} | ||
} | ||
} | ||
|
||
stage ('Building the Dependencies') { | ||
steps { | ||
// When using the docker container, we need to change | ||
// the HOME path to WORKSPACE to have the authority | ||
// to install the packages. | ||
withEnv(["HOME=${env.WORKSPACE}"]) { | ||
sh """ | ||
source ${env.LSST_STACK}/loadLSST.bash | ||
cd ts_wep/ | ||
git lfs install || echo git lfs install FAILED | ||
git lfs fetch --all || echo git lfs fetch FAILED | ||
git lfs checkout || echo git lfs checkout FAILED | ||
setup -k -r . | ||
scons lib python shebang | ||
""" | ||
} | ||
} | ||
} | ||
|
||
stage('Unit Tests and Coverage Analysis') { | ||
steps { | ||
// Pytest needs to export the junit report. | ||
withEnv(["HOME=${env.WORKSPACE}"]) { | ||
sh """ | ||
source ${env.LSST_STACK}/loadLSST.bash | ||
cd ts_wep/ | ||
setup -k -r . | ||
pytest --cov-report html --cov=${env.MODULE_NAME} --junitxml=${env.WORKSPACE}/${env.XML_REPORT} | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
// The path of xml needed by JUnit is relative to | ||
// the workspace. | ||
junit "${env.XML_REPORT}" | ||
|
||
// Publish the HTML report | ||
publishHTML (target: [ | ||
allowMissing: false, | ||
alwaysLinkToLastBuild: false, | ||
keepAll: true, | ||
reportDir: 'ts_wep/htmlcov', | ||
reportFiles: 'index.html', | ||
reportName: "Coverage Report" | ||
]) | ||
|
||
script{ | ||
withEnv(["HOME=${env.WORKSPACE}"]) { | ||
def RESULT = sh returnStatus: true, script: """ | ||
source ${env.LSST_STACK}/loadLSST.bash | ||
pip install sphinxcontrib-plantuml | ||
cd ts_wep | ||
setup -k -r . | ||
package-docs build | ||
pip install ltd-conveyor | ||
ltd upload --product ${env.DOCUMENT_NAME} --git-ref ${env.BRANCH_NAME} --dir doc/_build/html | ||
""" | ||
|
||
if ( RESULT != 0 ) { | ||
unstable("Failed to push documentation.") | ||
} | ||
} | ||
} | ||
} | ||
regression { | ||
script { | ||
slackSend(color: "danger", message: "${JOB_NAME} has suffered a regression ${BUILD_URL}", channel: "#aos-builds") | ||
} | ||
|
||
} | ||
fixed { | ||
script { | ||
slackSend(color: "good", message: "${JOB_NAME} has been fixed ${BUILD_URL}", channel: "#aos-builds") | ||
} | ||
} | ||
cleanup { | ||
// clean up the workspace | ||
deleteDir() | ||
} | ||
} | ||
} | ||
@Library('JenkinsShared')_ | ||
DevelopPipeline( | ||
name: "ts_wep", | ||
module_name: "lsst.ts.wep", | ||
idl_names: [], | ||
build_all_idl: false, | ||
extra_packages: [], | ||
kickoff_jobs: [], | ||
slack_build_channel: "aos-builds", | ||
has_doc_site: true, | ||
require_git_lfs: true, | ||
require_scons: true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters