From ba6b4e368071ff4093bcf1231d1ee9a628865267 Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 27 Sep 2024 15:21:10 +0200 Subject: [PATCH 1/3] Add CacheO2Package action Triggers the build in Jenkins without going through our old kerberos setup --- .github/workflows/cacheo2package.yml | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/cacheo2package.yml diff --git a/.github/workflows/cacheo2package.yml b/.github/workflows/cacheo2package.yml new file mode 100644 index 00000000..cab38bef --- /dev/null +++ b/.github/workflows/cacheo2package.yml @@ -0,0 +1,57 @@ +--- +# Laungh the CacheO2Package job in Jenkins. Useful for caching the build +# results for CI, so there are minimal delays when merging critical packages +name: Cache O2 Package + +'on': + workflow_call: + inputs: + package_name: + type: string + required: true + description: Name of the package to cache + default: 'O2' + alidist_slug: + type: string + required: true + description: Alidist version to use for the package (group/repo[@branch]) + default: 'alisw/alidist@master' + alibuild_slug: + type: string + required: true + description: Alibuild version to use for the package. If empty, the latest version from pypi is used. + default: 'alisw/alibuild@master' + +permissions: {} + +jobs: + cache-o2-package: + runs-on: ubuntu-latest + + env: + ALIDIST_SLUG: ${{ inputs.alidist_slug }} + ALIBUILD_SLUG: ${{ inputs.alibuild_slug }} + PACKAGE_NAME: ${{ inputs.package_name }} + JENKINS_URL: ${{ secrets.JENKINS_URL }} + SSO_AUTH_URL: ${{ secrets.SSO_AUTH_URL }} + CLIENT_ID: ${{ secrets.SSO_JENKINS_API_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.SSO_JENKINS_API_CLIENT_SECRET }} + TARGET_APP: ${{ secrets.SSO_JENKINS_API_TARGET_APP }} + JOB_NAME: 'CacheO2Package' + + steps: + - name: Launch the CacheO2Package job in Jenkins + run: | + # Login against SSO + TOKEN="$(curl --location -X POST $SSO_AUTH_URL \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --data-urlencode 'grant_type=client_credentials' \ + --data-urlencode "client_id=$CLIENT_ID" \ + --data-urlencode "client_secret=$CLIENT_SECRET" \ + --data-urlencode "audience=$TARGET_APP" | jq -r '.access_token')" + + # Trigger the Jenkins job + curl "$JENKINS_URL/job/$JOB_NAME/buildWithParameters" \ + -H "Authorization: Bearer $TOKEN" \ + --data "PACKAGE_NAME=$PACKAGE_NAME" \ + --data "ALIDIST_SLUG=$ALIDIST_SLUG" From a88acc38083cae8d365f66f64e543b223cee96de Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 27 Sep 2024 16:51:05 +0200 Subject: [PATCH 2/3] Fix --- .github/workflows/cacheo2package.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cacheo2package.yml b/.github/workflows/cacheo2package.yml index cab38bef..79c9453a 100644 --- a/.github/workflows/cacheo2package.yml +++ b/.github/workflows/cacheo2package.yml @@ -8,19 +8,15 @@ name: Cache O2 Package inputs: package_name: type: string - required: true description: Name of the package to cache default: 'O2' alidist_slug: type: string - required: true description: Alidist version to use for the package (group/repo[@branch]) default: 'alisw/alidist@master' alibuild_slug: type: string - required: true description: Alibuild version to use for the package. If empty, the latest version from pypi is used. - default: 'alisw/alibuild@master' permissions: {} From b07f2aa4b76fd09a91b0271f263f50a17e991cd1 Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 27 Sep 2024 16:53:14 +0200 Subject: [PATCH 3/3] Actionlint --- .github/workflows/cacheo2package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cacheo2package.yml b/.github/workflows/cacheo2package.yml index 79c9453a..c82fca1f 100644 --- a/.github/workflows/cacheo2package.yml +++ b/.github/workflows/cacheo2package.yml @@ -39,7 +39,7 @@ jobs: - name: Launch the CacheO2Package job in Jenkins run: | # Login against SSO - TOKEN="$(curl --location -X POST $SSO_AUTH_URL \ + TOKEN="$(curl --location -X POST "$SSO_AUTH_URL" \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode "client_id=$CLIENT_ID" \