-
Notifications
You must be signed in to change notification settings - Fork 4
/
jenkins_pipeline.yml
38 lines (38 loc) · 1.45 KB
/
jenkins_pipeline.yml
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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh "mkdir $BUILD_TAG"
git 'https://github.com/clemenko/dc20_labels.git'
sh 'cd demo_flask; docker build -t clemenko/flask_demo:pre_prod --build-arg BUILD_DATE=\$(date +%D) --build-arg BUILD_VERSION=0.1 --build-arg COMPOSE="\$(cat flask_compose.yml|base64)" --build-arg K8SYML="\$(cat flask_k8s.yml|base64)" --build-arg [email protected] --build-arg JENKINS_URL=$JENKINS_URL --build-arg BUILD_NUMBER=$BUILD_NUMBER --build-arg GIT_COMMIT=$(git log -n 1 --pretty=format:"%h") . '
sh "echo 'clemenko/flask_demo:pre_prod' >> $BUILD_TAG/rox_images_to_scan"
}
}
stage('Push to Dev') {
steps {
sh "echo $HUB_PASSWORD | docker login -u clemenko --password-stdin"
sh "docker push clemenko/flask_demo:pre_prod "
}
}
stage('Stackrox Plugin Scan') {
steps {
step ([
$class: 'StackroxBuilder',
portalAddress: "$ROX_URL",
apiToken: "$ROX_API_TOKEN",
enableTLSVerification: false,
caCertPEM: '',
failOnCriticalPluginError: true,
failOnPolicyEvalFailure: true
])
}
}
stage('Push to Prod') {
steps {
sh "docker tag clemenko/flask_demo:pre_prod clemenko/flask_demo:prod"
sh "docker push clemenko/flask_demo:prod"
}
}
}
}