571e275da4a52b272c82040260a7305c402f42b1
[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             # No force (-f). We always verify upstream jobs so if there are no logs
69             # something else went wrong and we need to break immediately and investigate
70             gsutil -m rm -r $BIFROST_GS_URL
71
72     triggers:
73         - '{project}-gerrit-trigger-cleanup':
74             branch: '{branch}'
75
76     publishers:
77         - email:
78             recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com zhang.jun3g@zte.com.cn
79 #--------------------------------
80 # trigger macros
81 #--------------------------------
82 - trigger:
83     name: 'openstack-gerrit-trigger-cleanup'
84     triggers:
85         - gerrit:
86             server-name: 'review.openstack.org'
87             escape-quotes: true
88             trigger-on:
89                 # We only run this when the change is merged or
90                 # abandoned since we don't need the logs anymore
91                 - patchset-uploaded-event: 'false'
92                 - change-merged-event: 'true'
93                 - change-abandoned-event: 'true'
94                 - change-restored-event: 'false'
95                 - draft-published-event: 'false'
96             # This is an OPNFV maintenance job. We don't want to provide
97             # feedback on Gerrit
98             silent: true
99             silent-start: true
100             projects:
101               - project-compare-type: 'PLAIN'
102                 project-pattern: 'openstack/bifrost'
103                 branches:
104                   - branch-compare-type: 'ANT'
105                     branch-pattern: '**/{branch}'
106                 disable-strict-forbidden-file-verification: 'true'
107                 forbidden-file-paths:
108                   - compare-type: ANT
109                     pattern: 'doc/**'
110                   - compare-type: ANT
111                     pattern: 'releasenotes/**'
112                 disable-strict-forbidden-file-verification: 'true'
113             readable-message: true
114 - trigger:
115     name: 'opnfv-gerrit-trigger-cleanup'
116     triggers:
117         - gerrit:
118             server-name: 'gerrit.opnfv.org'
119             trigger-on:
120                 # We only run this when the change is merged or
121                 # abandoned since we don't need the logs anymore
122                 - patchset-uploaded-event: 'false'
123                 - change-merged-event: 'true'
124                 - change-abandoned-event: 'true'
125                 - change-restored-event: 'false'
126                 - draft-published-event: 'false'
127             # This is an OPNFV maintenance job. We don't want to provide
128             # feedback on Gerrit
129             silent: true
130             silent-start: true
131             projects:
132               - project-compare-type: 'ANT'
133                 project-pattern: 'releng'
134                 branches:
135                   - branch-compare-type: 'ANT'
136                     branch-pattern: '**/{branch}'
137                 file-paths:
138                   - compare-type: ANT
139                     pattern: 'prototypes/bifrost/**'
140             readable-message: true