Skip to content

Commit 1ae7128

Browse files
committed
Trigger release checks after successful build
1 parent 237f8d8 commit 1ae7128

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ go_import_path: "github.com/ibm-messaging/mq-container"
3636
# - downloads
3737

3838
jobs:
39+
allow_failures:
40+
- script: bash -e travis-build-scripts/trigger-release-checks.sh
3941
include:
4042
- stage: basic-build
4143
if: branch != v9.3.0.x AND tag IS blank
@@ -97,6 +99,10 @@ jobs:
9799
env:
98100
- PUSH_MANIFEST_ONLY=true
99101
script: bash -e travis-build-scripts/run.sh
102+
- stage: trigger-release-checks
103+
if: branch = v9.3.0.x AND type != pull_request OR tag =~ ^release-candidate*
104+
name: "Trigger release-checks build"
105+
script: bash -e travis-build-scripts/trigger-release-checks.sh
100106

101107
before_install:
102108
- make install-build-deps
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# © Copyright IBM Corporation 2019, 2020
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
GREEN="\033[32m"
18+
RED="\033[31m"
19+
20+
END="\033[0m"
21+
22+
RIGHTARROW="\xE2\x96\xB6"
23+
GREENRIGHTARROW=${GREEN}${RIGHTARROW}${END}
24+
25+
TICK="\xE2\x9C\x94"
26+
CROSS="\xE2\x9C\x97"
27+
GREENTICK=${GREEN}${TICK}${END}
28+
REDCROSS=${RED}${CROSS}${END}
29+
30+
printf "${GREENRIGHTARROW} Attempting to trigger new release-checks build\n"
31+
32+
repo_name=$(echo "${TRAVIS_REPO_SLUG}" | cut -d'/' -f2-)
33+
34+
request_body="{ \"request\": { \"message\": \"Trigger release checks build from ${repo_name}:${TRAVIS_BRANCH}\", \"branch\": \"main\", \"merge_mode\": \"deep_merge_append\", \"config\": { \"env\": { \"global\": [ \"EVENT_SOURCE=${repo_name}\" ]}}}}"
35+
36+
request_response="$(curl -X POST -H "Content-Type: application/json" -H "Travis-API-Version: 3" -H "Authorization: token ${TRAVIS_TOKEN}" -d "${request_body}" https://v3.travis.ibm.com/api/repo/mq-cloudpak%2Frelease-checks/requests -o /dev/null -w "%{http_code}" -s)"
37+
if [ "$request_response" != "202" ]; then
38+
printf "${REDCROSS} ${RED}Could not create new request${END}\n"
39+
exit 1
40+
else
41+
printf "${GREENTICK} Successfully created new request\n"
42+
fi

0 commit comments

Comments
 (0)