From b78f637b5717f556ea818774b13dea91f95cce67 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 08:28:06 +0100 Subject: [PATCH 01/17] Try codebase sync --- .github/workflows/codebase.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/codebase.yml diff --git a/.github/workflows/codebase.yml b/.github/workflows/codebase.yml new file mode 100644 index 00000000..b69e2814 --- /dev/null +++ b/.github/workflows/codebase.yml @@ -0,0 +1,22 @@ +name: codebase-sync + +on: + - push + - delete + +jobs: + sync: + runs-on: ubuntu-latest + name: Git Repo Sync + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wangchucheng/git-repo-sync@v0.1.0 + with: + # Such as https://github.com/wangchucheng/git-repo-sync.git + target-url: https://codebase.helmholtz.cloud/m-team/oidc/mytoken/server.git + # Such as wangchucheng + target-username: gabriel.zachmann + # You can store token in your project's 'Setting > Secrets' and reference the name here. Such as ${{ secrets.ACCESS_TOKEN }} + target-token: $CODEBASE_TOKEN From c90f4161e0a09f9be1d21452fcd15fc3f407348b Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 08:31:27 +0100 Subject: [PATCH 02/17] Update codebase.yml --- .github/workflows/codebase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codebase.yml b/.github/workflows/codebase.yml index b69e2814..9728bbd6 100644 --- a/.github/workflows/codebase.yml +++ b/.github/workflows/codebase.yml @@ -19,4 +19,4 @@ jobs: # Such as wangchucheng target-username: gabriel.zachmann # You can store token in your project's 'Setting > Secrets' and reference the name here. Such as ${{ secrets.ACCESS_TOKEN }} - target-token: $CODEBASE_TOKEN + target-token: ${{ secrets.CODEBASE_TOKEN }} From f12f7ef102e39d51a0ae3e93ee6f6422e8e00e4d Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:05:10 +0100 Subject: [PATCH 03/17] Try publishing ci status update back to GH --- .gitlab-ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e61d46d..cc09c0e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,3 +91,31 @@ deploy-dev: script: - ssh mytoken-dev.vm.fedcloud.eu +.report-status: + variables: + STATUS_PROJECT: oidc-mytoken/server + STATUS_NAME: Codebase CI + + script: + # For complete details on the GitHub API please see: + # https://developer.github.com/v3/repos/statuses + - curl -X POST -H @${GH_CURL_HEADERS} https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} + +pending: + stage: .pre + extends: + - .report-status + + +success: + stage: .post + extends: + - .report-status + + +failed: + stage: .post + extends: + - .report-status + rules: + - when: on_failure From 470419081e0bea8172f906d73e9ba7dbdf021fed Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:11:11 +0100 Subject: [PATCH 04/17] debug ci --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc09c0e6..440c3508 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,6 +99,7 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses + - echo curl -X POST https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} - curl -X POST -H @${GH_CURL_HEADERS} https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} pending: From 50e6ba61adaafd95b2474d507939f96b30739d30 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:22:51 +0100 Subject: [PATCH 05/17] (hopefully) fix ci --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 440c3508..72ad82fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,12 +94,11 @@ deploy-dev: .report-status: variables: STATUS_PROJECT: oidc-mytoken/server - STATUS_NAME: Codebase CI + STATUS_NAME: CodebaseCI script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - - echo curl -X POST https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} - curl -X POST -H @${GH_CURL_HEADERS} https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} pending: From 0d86b03364bcc3cf11a115e95397d3a63c21b0f6 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:35:42 +0100 Subject: [PATCH 06/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72ad82fa..78e3eb45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,12 +94,18 @@ deploy-dev: .report-status: variables: STATUS_PROJECT: oidc-mytoken/server - STATUS_NAME: CodebaseCI + STATUS_NAME: Codebase CI script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - - curl -X POST -H @${GH_CURL_HEADERS} https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA}?state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL} + - curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H @${GH_CURL_HEADER} \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} \ + -d "state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL}" pending: stage: .pre From 5d3a843c4ea0b2d9fba8fb7e2539c693081e08d4 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:41:54 +0100 Subject: [PATCH 07/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78e3eb45..3ff5abbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,13 +99,13 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - - curl -L \ + - 'curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H @${GH_CURL_HEADER} \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} \ - -d "state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL}" + -d "state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL}"' pending: stage: .pre From 5310e48be17ed7901c2bd2f7df6ca1f693429f77 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:43:06 +0100 Subject: [PATCH 08/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ff5abbc..d23dcb60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,12 +99,12 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - - 'curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H @${GH_CURL_HEADER} \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} \ + - 'curl -L + -X POST + -H "Accept: application/vnd.github+json" + -H @${GH_CURL_HEADER} + -H "X-GitHub-Api-Version: 2022-11-28" + https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} -d "state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL}"' pending: From c98de0c368810793200f094d60c9c2b00632c138 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:46:20 +0100 Subject: [PATCH 09/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d23dcb60..2051344e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,7 +105,7 @@ deploy-dev: -H @${GH_CURL_HEADER} -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} - -d "state=${CI_JOB_NAME}\&context=${STATUS_NAME}\&target_url=${CI_PIPELINE_URL}"' + -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' pending: stage: .pre From 3271222d743a6b9214e828dbfdc4382e410ace39 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:48:16 +0100 Subject: [PATCH 10/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2051344e..41f3df0d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,6 +99,13 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses + - 'echo curl -L + -X POST + -H "Accept: application/vnd.github+json" + -H @${GH_CURL_HEADER} + -H "X-GitHub-Api-Version: 2022-11-28" + https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} + -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' - 'curl -L -X POST -H "Accept: application/vnd.github+json" From 53eb3407ce2ef64e2f8316c046a44c344829bed7 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:49:56 +0100 Subject: [PATCH 11/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41f3df0d..d594ca6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -102,14 +102,13 @@ deploy-dev: - 'echo curl -L -X POST -H "Accept: application/vnd.github+json" - -H @${GH_CURL_HEADER} -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' - 'curl -L -X POST -H "Accept: application/vnd.github+json" - -H @${GH_CURL_HEADER} + -H "${GH_CURL_HEADER}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' From f7724f1106ff4f03caafc6baa0c76a27142b6097 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 10:50:45 +0100 Subject: [PATCH 12/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d594ca6e..fc36a5ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -111,7 +111,7 @@ deploy-dev: -H "${GH_CURL_HEADER}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} - -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' + -d "{\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\"}"' pending: stage: .pre From 05b46b0f78a541af1290ed36b6c8331c502edc1d Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 11:00:13 +0100 Subject: [PATCH 13/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc36a5ca..97d3a254 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,12 +99,13 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses + - echo ${MYTOKEN_GROUP_TEST} - 'echo curl -L -X POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} - -d "\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\""' + -d "{\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\"}"' - 'curl -L -X POST -H "Accept: application/vnd.github+json" From a1030239cbbe89c0bad86c6b0404ed0569e34f85 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 15 Dec 2023 11:29:21 +0100 Subject: [PATCH 14/17] Update .gitlab-ci.yml --- .gitlab-ci.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97d3a254..3a6050e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,17 +99,10 @@ deploy-dev: script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - - echo ${MYTOKEN_GROUP_TEST} - - 'echo curl -L - -X POST - -H "Accept: application/vnd.github+json" - -H "X-GitHub-Api-Version: 2022-11-28" - https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} - -d "{\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\"}"' - 'curl -L -X POST -H "Accept: application/vnd.github+json" - -H "${GH_CURL_HEADER}" + -H "Authorization: Bearer ${GH_STATUS_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} -d "{\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\"}"' From aaa2ec345e4821bda3baf356bcae0d6e2a09c337 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 22 Dec 2023 09:01:46 +0100 Subject: [PATCH 15/17] use ci-vodoo include for github status sync --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a6050e6..c78c3202 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +include: + - 'https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/-/raw/github-status/ci-include/github-status-sync.yml' + +variables: + STATUS_PROJECT: oidc-mytoken/server + image: golang:1.19 stages: - build From 1894ebb19f8b95f32b6cb6127f88aa46607696ff Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 5 Jan 2024 14:57:02 +0100 Subject: [PATCH 16/17] Update .gitlab-ci.yml to merged include script --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c78c3202..08cb9744 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ include: - - 'https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/-/raw/github-status/ci-include/github-status-sync.yml' + - 'https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/-/raw/master/ci-include/github-status-sync.yml' variables: - STATUS_PROJECT: oidc-mytoken/server + UPSTREAM_PROJECT: oidc-mytoken/server image: golang:1.19 stages: From e541517e50da9d84978b62d2637be92a9fd47254 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Fri, 5 Jan 2024 14:58:36 +0100 Subject: [PATCH 17/17] remove status reporting from .gitlab-ci.yml since it is included --- .gitlab-ci.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08cb9744..65aa7cf9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,38 +96,3 @@ deploy-dev: - cp $DEPLOYMENT_SSH_KEY /root/.ssh/id_ed25519 && chmod 0600 /root/.ssh/id_ed25519 script: - ssh mytoken-dev.vm.fedcloud.eu - -.report-status: - variables: - STATUS_PROJECT: oidc-mytoken/server - STATUS_NAME: Codebase CI - - script: - # For complete details on the GitHub API please see: - # https://developer.github.com/v3/repos/statuses - - 'curl -L - -X POST - -H "Accept: application/vnd.github+json" - -H "Authorization: Bearer ${GH_STATUS_TOKEN}" - -H "X-GitHub-Api-Version: 2022-11-28" - https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} - -d "{\"state\": \"${CI_JOB_NAME}\",\"context\": \"${STATUS_NAME}\", \"target_url\": \"${CI_PIPELINE_URL}\"}"' - -pending: - stage: .pre - extends: - - .report-status - - -success: - stage: .post - extends: - - .report-status - - -failed: - stage: .post - extends: - - .report-status - rules: - - when: on_failure