From f63b70eee0f9949c5846354ade8212b1c7e9e04a Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Thu, 8 Feb 2018 17:01:33 +0100 Subject: [PATCH] Issue #94 Make sure the right HTTP status of the update command is reported - Update Dockerfile to build from master (relevant for osio) --- scripts/webhook-migration/Dockerfile | 4 ++-- scripts/webhook-migration/updateWebhooks.sh | 7 +++---- scripts/webhook-migration/webhook-migration.job.yaml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/webhook-migration/Dockerfile b/scripts/webhook-migration/Dockerfile index 5092d88..28dee9a 100644 --- a/scripts/webhook-migration/Dockerfile +++ b/scripts/webhook-migration/Dockerfile @@ -43,8 +43,8 @@ ENV ORG=github.com/fabric8-services ENV REPO=$ORG/fabric8-jenkins-proxy ENV BUILD_DIR=$GOPATH/src/$REPO RUN mkdir -p $GOPATH/src/$ORG -RUN git clone https://github.com/hferentschik/fabric8-jenkins-proxy $BUILD_DIR -RUN cd $BUILD_DIR && git checkout issue-94 && git rev-parse --short HEAD && make osio +RUN git clone https://$REPO $BUILD_DIR +RUN cd $BUILD_DIR && git rev-parse --short HEAD && make osio COPY updateWebhooks.sh /usr/local/bin/updateWebhooks.sh diff --git a/scripts/webhook-migration/updateWebhooks.sh b/scripts/webhook-migration/updateWebhooks.sh index 25a36db..4707c9b 100755 --- a/scripts/webhook-migration/updateWebhooks.sh +++ b/scripts/webhook-migration/updateWebhooks.sh @@ -150,10 +150,9 @@ updateGitHubWebhooks() { --data '{"config": {"url": "'${JENKINS_PROXY_URL}'github-webhook/"}}' https://api.github.com/repos/${REPOS[$i]}/hooks/${id} echo " " else - response=$(curl -sgSL -H "Authorization: token ${GITHUB_TOKENS[$i]}" -X PATCH \ - --data '{"config": {"url": "'${JENKINS_PROXY_URL}'github-webhook/"}}' \ - https://api.github.com/repos/${REPOS[$i]}/hooks/${id} | \ - jq -r '.last_response.message') + response=$(curl -sgSL -H "Authorization: token ${GITHUB_TOKENS[$i]}" -o /dev/null -w "%{http_code}" \ + -X PATCH --data '{"config": {"url": "'${JENKINS_PROXY_URL}'github-webhook/"}}' \ + https://api.github.com/repos/${REPOS[$i]}/hooks/${id}) echo "${url} updated. Status: $response" fi else diff --git a/scripts/webhook-migration/webhook-migration.job.yaml b/scripts/webhook-migration/webhook-migration.job.yaml index 64bccf7..191c18e 100644 --- a/scripts/webhook-migration/webhook-migration.job.yaml +++ b/scripts/webhook-migration/webhook-migration.job.yaml @@ -71,7 +71,7 @@ parameters: - name: IMAGE value: hferentschik/webhook-migration - name: IMAGE_TAG - value: 1.0.0 + value: 1.0.2 - name: TARGET_ENV value: "stage" - name: DRY_RUN