This repository has been archived by the owner on May 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (82 loc) · 2.82 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!groovy
def JOB_ID = ''
pipeline {
agent any
environment {
AGAVE_GET_DATA = 1
AGAVE_JOB_TIMEOUT = 1800
AGAVE_JOB_GET_DIR = "job_output"
AGAVE_DATA_URI = "agave://data-sd2e-community/sample/fcs-etl-application/test_data"
CONTAINER_REPO = "fcs-etl"
CONTAINER_TAG = "test"
AGAVE_CACHE_DIR = "${HOME}/credentials_cache/${JOB_BASE_NAME}"
AGAVE_JSON_PARSER = "jq"
AGAVE_TENANTID = "sd2e"
AGAVE_APISERVER = "https://api.sd2e.org"
AGAVE_USERNAME = "sd2etest"
AGAVE_PASSWORD = credentials('sd2etest-tacc-password')
REGISTRY_USERNAME = "sd2etest"
REGISTRY_PASSWORD = credentials('sd2etest-dockerhub-password')
REGISTRY_ORG = credentials('sd2etest-dockerhub-org')
PATH = "${HOME}/bin:${HOME}/sd2e-cloud-cli/bin:${env.PATH}"
}
stages {
stage('Create Oauth client') {
steps {
sh "make-session-client ${JOB_BASE_NAME} ${JOB_BASE_NAME}-${BUILD_ID}"
}
}
stage('Clean up previous test data') {
when {
environment name: 'AGAVE_GET_DATA', value: '1'
}
steps {
echo "Removing test_data"
sh "rm -rf test_data || true "
}
}
stage('(Copy in test data)') {
when { not {
expression { fileExists('test_data') }
}
}
steps {
sh "files-get -r -S data-sd2e-community /sample/fcs-etl-application/test_data > files-get.log 2>&1"
sh "ls -alth test_data"
}
}
stage('Build app container') {
steps {
sh "apps-build-container -O ${REGISTRY_USERNAME} --image ${CONTAINER_REPO} --tag ${CONTAINER_TAG}"
}
}
stage('Run functional test(s)') {
steps {
sh "tests/run_functional_test.sh ${REGISTRY_USERNAME}/${CONTAINER_REPO}:${CONTAINER_TAG} test_data"
}
}
stage('Deploy to TACC.cloud') {
steps {
sh "apps-deploy -T -O ${REGISTRY_USERNAME} --image ${CONTAINER_REPO} --tag ${CONTAINER_TAG} fcs-etl-0.3.4"
sh "cat deploy-*"
}
}
stage('Run a test job') {
steps {
// Run job
sh "run-test-job deploy-${AGAVE_USERNAME}-job.json ${AGAVE_JOB_TIMEOUT}"
// Get outputs
sh "get-test-job-outputs deploy-${AGAVE_USERNAME}-job.json.jobid"
// Evaluate results
}
}
}
post {
always {
sh "delete-session-client ${JOB_BASE_NAME} ${JOB_BASE_NAME}-${BUILD_ID}"
}
success {
deleteDir()
}
}
}