Skip to content
Snippets Groups Projects
Commit b9792bc5 authored by jurgenhaas's avatar jurgenhaas
Browse files

gitlab-ci-cd/drupal#28 Make it work in pipelines too

parent 2fe9aa73
No related branches found
No related tags found
1 merge request!10Merging develop into main
......@@ -5,6 +5,9 @@ function gitlab() {
METHOD=$2
REQUEST=$3
shift 3
if [[ "${DEBUG}" == "yes" ]]; then
echo curl --write-out "\nHTTP-Code:%{http_code}" -X "$METHOD" -s -H "Private-Token: ${GITLAB_PRIVATE_TOKEN}" "${GITLAB_URL}"/api/v4/"$REQUEST" "$@"
fi
output="$(curl --write-out "\nHTTP-Code:%{http_code}" -X "$METHOD" -s -H "Private-Token: ${GITLAB_PRIVATE_TOKEN}" "${GITLAB_URL}"/api/v4/"$REQUEST" "$@")"
result="$(echo "$output" | grep "{")"
code="$(echo "$output" | grep -m 1 "HTTP-Code:" | cut -d: -f2)"
......@@ -50,11 +53,8 @@ elif [[ "$SOURCEBRANCH" == "develop" ]]; then
else
TARGETBRANCH=develop
fi
if [[ -n ${CI_SERVER_URL} ]]; then
GITLAB_URL=$CI_SERVER_URL
fi
if [[ -n ${GITLAB_ACCESS_TOKEN} ]]; then
GITLAB_PRIVATE_TOKEN=$GITLAB_ACCESS_TOKEN
if [[ -n ${CI_SERVER_HOST} ]]; then
GITLAB_URL=https://$CI_SERVER_HOST
fi
if [[ "x${GITLAB_URL}" == "x" ]]; then
echo "Missing GITLAB_URL environment variable, should be set to e.g. https://gitlab.lakedrops.com"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment