blob: deee9370b6323d26981116da9c53f457ee89d7f2 [file] [log] [blame]
Zack Williamsce60d712018-05-27 15:27:57 -07001/* imagebuilder pipeline */
2pipeline {
3
4 /* no label, executor is determined by JJB */
5 agent {
6 label "${params.executorNode}"
7 }
8 stages {
9
10 stage('repo') {
11 steps {
12 checkout(changelog: false, \
13 poll: false,
14 scm: [$class: 'RepoScm', \
15 manifestRepositoryUrl: "${params.manifestUrl}", \
16 manifestBranch: "${params.manifestBranch}", \
17 currentBranch: true, \
18 destinationDir: 'cord', \
19 forceSync: true,
20 resetFirst: true, \
21 quiet: true, \
22 jobs: 4, \
23 showAllChanges: true] \
24 )
25 }
26 }
27
28 stage('imagebuilder'){
29 steps {
Zack Williams675a7552018-05-29 16:14:09 -070030 sh """
Zack Williamsce60d712018-05-27 15:27:57 -070031 #!/usr/bin/env bash
32
Zack Williams675a7552018-05-29 16:14:09 -070033 mkdir "$WORKSPACE/ib_logs"
Zack Williamsce60d712018-05-27 15:27:57 -070034 ib_args=""
35
Zack Williams675a7552018-05-29 16:14:09 -070036 if [ "${params.force}" = "true" ]; then
Zack Williamsce60d712018-05-27 15:27:57 -070037 ib_args+="--force "
38 fi
39
Zack Williams675a7552018-05-29 16:14:09 -070040 if [ "${params.build}" = "true" ]; then
Zack Williamsce60d712018-05-27 15:27:57 -070041 ib_args+="--build "
42 fi
43
44 pushd cord/automation-tools/developer
45 ./imagebuilder.py -vv \${ib_args} -c docker_images.yml \
46 -a "$WORKSPACE/ib_actions.yml" \
47 -l "$WORKSPACE/ib_logs" \
48 -g "$WORKSPACE/ib_graph.dot"
49 popd
Zack Williams675a7552018-05-29 16:14:09 -070050 """
Zack Williamsce60d712018-05-27 15:27:57 -070051 }
52 }
53
54 stage('push'){
55 steps {
56 script {
57 def ib_actions = readYaml( file:"$WORKSPACE/ib_actions.yml" )
58
59 withDockerRegistry([credentialsId: 'docker-artifact-push-credentials']) {
60 for(image in ib_actions.ib_built){
61 for(tag in image.tags){
62 push_tag = image.base + ":" + tag
63 echo "Pushing image: " + push_tag
64 docker.image(push_tag).push()
65 }
66 }
67 }
68 }
69 }
70 }
71 }
72
73 post {
74 always {
75 archiveArtifacts artifacts: 'ib_actions.yml, ib_graph.dot, ib_logs/*', fingerprint: true
76 deleteDir()
77 }
78 }
79}