blob: b86bc22308d960861d76d972159b34f1bca7dfea [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 {
30 sh '''
31 #!/usr/bin/env bash
32
33 mkdir "$WORKSPACE/image_logs"
34 ib_args=""
35
36 if [[ ${params.force} == 'true' ]]; then
37 ib_args+="--force "
38 fi
39
40 if [[ ${params.build} == 'true' ]]; then
41 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
50 '''
51 }
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}