Merge "add Pods page in webportal"
[releng.git] / jjb / xci / bifrost-cleanup-job.yml
1 - project:
2     name: 'openstack-bifrost-cleanup'
3 #--------------------------------
4 # branches
5 #--------------------------------
6     stream:
7         - master:
8             branch: '{stream}'
9
10 #--------------------------------
11 # projects
12 #--------------------------------
13     project:
14         - 'openstack':
15             project-repo: 'https://git.openstack.org/openstack/bifrost'
16             clone-location: '/opt/bifrost'
17         - 'opnfv':
18             project-repo: 'https://gerrit.opnfv.org/gerrit/releng'
19             clone-location: '/opt/releng'
20
21 #--------------------------------
22 # jobs
23 #--------------------------------
24     jobs:
25         - '{project}-bifrost-cleanup-{stream}'
26
27 - job-template:
28     name: '{project}-bifrost-cleanup-{stream}'
29
30     concurrent: false
31
32     node: bifrost-verify-virtual
33
34     # Make sure no verify job is running on any of the slaves since that would
35     # produce build logs after we wipe the destination directory.
36     properties:
37         - build-blocker:
38             blocking-jobs:
39                 - '{project}-bifrost-verify-*'
40
41     parameters:
42         - string:
43             name: PROJECT
44             default: '{project}'
45
46     builders:
47         - shell: |
48             #!/bin/bash
49
50             set -eu
51
52             # DO NOT change this unless you know what you are doing.
53             BIFROST_GS_URL="gs://artifacts.opnfv.org/cross-community-ci/openstack/bifrost/$GERRIT_NAME/$GERRIT_CHANGE_NUMBER/"
54
55             # This should never happen... even 'recheck' uses the last jobs'
56             # gerrit information. Better exit with error so we can investigate
57             [[ ! -n $GERRIT_NAME ]] || [[ ! -n $GERRIT_CHANGE_NUMBER ]] && exit 1
58
59             echo "Removing build artifacts for $GERRIT_NAME/$GERRIT_CHANGE_NUMBER"
60
61             if ! [[ "$BIFROST_GS_URL" =~ "/cross-community-ci/openstack/bifrost/" ]]; then
62                 echo "Oops! BIFROST_GS_URL=$BIFROST_GS_URL does not seem like a valid"
63                 echo "bifrost location on the Google storage server. Please double-check"
64                 echo "that it's set properly or fix this line if necessary."
65                 echo "gsutil will not be executed until this is fixed!"
66                 exit 1
67             fi
68             try_to_rm=1
69             while [[ $try_to_rm -lt 6 ]]; do
70                 gsutil -m rm -r $BIFROST_GS_URL && _exitcode=$? && break
71                 _exitcode=$?
72                 echo "gsutil rm failed! Trying again... (attempt #$try_to_rm)"
73                 let try_to_rm += 1
74                 # Give it some time...
75                 sleep 10
76             done
77             exit $_exitcode
78
79     triggers:
80         - '{project}-gerrit-trigger-cleanup':
81             branch: '{branch}'
82
83     publishers:
84         - email:
85             recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com zhang.jun3g@zte.com.cn
86         - email-jenkins-admins-on-failure
87 #--------------------------------
88 # trigger macros
89 #--------------------------------
90 - trigger:
91     name: 'openstack-gerrit-trigger-cleanup'
92     triggers:
93         - gerrit:
94             server-name: 'review.openstack.org'
95             escape-quotes: true
96             trigger-on:
97                 # We only run this when the change is merged or
98                 # abandoned since we don't need the logs anymore
99                 - change-merged-event
100                 - change-abandoned-event
101             # This is an OPNFV maintenance job. We don't want to provide
102             # feedback on Gerrit
103             silent: true
104             silent-start: true
105             projects:
106               - project-compare-type: 'PLAIN'
107                 project-pattern: 'openstack/bifrost'
108                 branches:
109                   - branch-compare-type: 'ANT'
110                     branch-pattern: '**/{branch}'
111                 disable-strict-forbidden-file-verification: 'true'
112                 forbidden-file-paths:
113                   - compare-type: ANT
114                     pattern: 'doc/**'
115                   - compare-type: ANT
116                     pattern: 'releasenotes/**'
117                 disable-strict-forbidden-file-verification: 'true'
118             readable-message: true
119 - trigger:
120     name: 'opnfv-gerrit-trigger-cleanup'
121     triggers:
122         - gerrit:
123             server-name: 'gerrit.opnfv.org'
124             trigger-on:
125                 # We only run this when the change is merged or
126                 # abandoned since we don't need the logs anymore
127                 - change-merged-event
128                 - change-abandoned-event
129             # This is an OPNFV maintenance job. We don't want to provide
130             # feedback on Gerrit
131             silent: true
132             silent-start: true
133             projects:
134               - project-compare-type: 'ANT'
135                 project-pattern: 'releng'
136                 branches:
137                   - branch-compare-type: 'ANT'
138                     branch-pattern: '**/{branch}'
139                 file-paths:
140                   - compare-type: ANT
141                     pattern: 'prototypes/bifrost/**'
142             readable-message: true