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