From 8561633b1bf6e20a03c7c1c6206e4197ff8e82e2 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 30 May 2022 18:23:30 +0200 Subject: [PATCH] gitlab-ci-cd/drupal#28 Make it work in pipelines too --- bin/merge | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/merge b/bin/merge index 2ce2958..fa07528 100755 --- a/bin/merge +++ b/bin/merge @@ -5,9 +5,7 @@ function gitlab() { METHOD=$2 REQUEST=$3 shift 3 - echo " sending request ..." output="$(curl --write-out "\nHTTP-Code:%{http_code}" -X "$METHOD" -s -H "Private-Token: ${GITLAB_PRIVATE_TOKEN}" "${GITLAB_URL}"/api/v4/"$REQUEST" "$@")" - echo " done" result="$(echo "$output" | grep "{")" code="$(echo "$output" | grep -m 1 "HTTP-Code:" | cut -d: -f2)" if [[ $code -eq $EXPECTED ]]; then @@ -52,6 +50,10 @@ elif [[ "$SOURCEBRANCH" == "develop" ]]; then else TARGETBRANCH=develop fi +if [[ -n ${CI_SERVER_URL} ]]; then + GITLAB_URL=$CI_SERVER_URL + GITLAB_PRIVATE_TOKEN=$CI_JOB_TOKEN +fi if [[ "x${GITLAB_URL}" == "x" ]]; then echo "Missing GITLAB_URL environment variable, should be set to e.g. https://gitlab.lakedrops.com" exit 2 -- GitLab