|
14 | 14 | # See the License for the specific language governing permissions and |
15 | 15 | # limitations under the License. |
16 | 16 |
|
17 | | -#Not making any changes to this script as it will be covered as part of release check changes - sdp |
| 17 | +set -e |
18 | 18 |
|
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 |
22 | 24 |
|
23 | | - END="\033[0m" |
| 25 | + EVENT_SOURCE="$(get_env APP_REPO_NAME)" |
24 | 26 |
|
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 |
27 | 31 |
|
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" |
32 | 33 |
|
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" |
34 | 36 |
|
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" |
36 | 39 |
|
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" |
46 | 41 | fi |
0 commit comments