Skip to content

Commit 1d74ed0

Browse files
committed
Trigger release check on sps
1 parent d5ae2c0 commit 1d74ed0

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

sps-build-scripts/trigger-release-checks.sh

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,28 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
#Not making any changes to this script as it will be covered as part of release check changes - sdp
17+
set -e
1818

19-
if [ -n "${TRAVIS}" ]; then
20-
GREEN="\033[32m"
21-
RED="\033[31m"
19+
if [[ -n "$PIPELINE_RUN_ID" ]]; then
20+
if [[ -z "$GOPATH" ]]; then
21+
echo "GOPATH not set to clone release checks."
22+
exit 1
23+
fi
2224

23-
END="\033[0m"
25+
EVENT_SOURCE="$(get_env APP_REPO_NAME)"
2426

25-
RIGHTARROW="\xE2\x96\xB6"
26-
GREENRIGHTARROW=${GREEN}${RIGHTARROW}${END}
27+
if [[ -z "$EVENT_SOURCE" ]]; then
28+
echo "EVENT_SOURCE is not set. Release checks cannot be triggered. Exiting...."
29+
exit 1
30+
fi
2731

28-
TICK="\xE2\x9C\x94"
29-
CROSS="\xE2\x9C\x97"
30-
GREENTICK=${GREEN}${TICK}${END}
31-
REDCROSS=${RED}${CROSS}${END}
32+
echo "Triggering release checks for event source: $EVENT_SOURCE"
3233

33-
printf "${GREENRIGHTARROW} Attempting to trigger new release-checks build\n"
34+
REPO="$GOPATH/src/github.ibm.com/mq-cloudpak/release-checks"
35+
mkdir -p "$REPO"
3436

35-
repo_name=$(echo "${TRAVIS_REPO_SLUG}" | cut -d'/' -f2-)
37+
echo "Cloning release-checks repo..."
38+
git clone [email protected]:mq-cloudpak/release-checks.git "$REPO" && cd "$REPO"
3639

37-
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}\" ]}}}}"
38-
39-
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)"
40-
if [ "$request_response" != "202" ]; then
41-
printf "${REDCROSS} ${RED}Could not create new request${END}\n"
42-
exit 1
43-
else
44-
printf "${GREENTICK} Successfully created new request\n"
45-
fi
40+
go run scripts/sps_tekton.go "$EVENT_SOURCE"
4641
fi

0 commit comments

Comments
 (0)