-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
94 lines (91 loc) · 2.98 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
86
87
88
89
90
91
92
93
pipeline {
agent { label 'ubuntu' }
environment {
CONTAINER = 'gomap'
IMAGE = 'GOMAP-Base'
VERSION = 'v1.1.3'
FILESHARE_SAS = credentials('fileshareSAS')
BLOBSHARE_SAS = credentials('blobstorageSAS')
}
stages {
stage('Setup Test Env') {
when {
anyOf{
anyOf {
changeset 'Singularity'
changeset 'Jenkinsfile'
}
expression {
currentBuild.buildCauses.toString().contains('UserIdCause')
}
}
anyOf {
branch 'master'
}
}
steps {
echo 'Downloading the Data'
sh '''
sudo rm -rf tmp
mkdir -p data/ &&
azcopy sync "https://gokoolstorage.blob.core.windows.net/gomap/GOMAP-1.3/pipelineData-${VERSION}/${BLOBSHARE_SAS}" data/ --recursive=true &&
chmod -R a+rwx data/
'''
}
}
stage('Build') {
when {
anyOf{
anyOf {
changeset 'Singularity'
changeset 'Jenkinsfile'
}
expression {
currentBuild.buildCauses.toString().contains('UserIdCause')
}
}
anyOf {
branch 'master'
}
}
steps {
sh '''
if [ -d tmp ]
then
sudo rm -r tmp
fi
mkdir tmp && \
sudo singularity build --force --disable-cache --tmpdir $PWD/tmp ${IMAGE}.sif Singularity
'''
}
}
stage('Copy Tmp Image') {
when {
anyOf{
anyOf {
changeset 'Singularity'
changeset 'Jenkinsfile'
}
expression {
currentBuild.buildCauses.toString().contains('UserIdCause')
}
}
anyOf {
branch 'master'
}
anyOf {
expression {
sh(returnStdout: true, script: '[ -f "/${CONTAINER}/${IMAGE}/${VERSION}/${IMAGE}.sif" ] && echo "true" || echo "false"').trim() == 'false'
}
}
}
steps {
echo 'Image Successfully tested'
sh '''
azcopy cp ${IMAGE}.sif "https://gokoolstorage.blob.core.windows.net/${CONTAINER}/${IMAGE}/${VERSION}/${BLOBSHARE_SAS}"
'''
echo 'Base Image Successfully uploaded'
}
}
}
}