Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CacheO2Package action #1409

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/cacheo2package.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be caching the dependencies, not the package itself. Did you change to use the new --only-deps feature?

default: 'O2'

Check failure on line 13 in .github/workflows/cacheo2package.yml

View workflow job for this annotation

GitHub Actions / actionlint

input "package_name" of workflow_call event has the default value "O2", but it is also required. if an input is marked as required, its default value will never be used ``` default: 'O2' ^~~~ ```
alidist_slug:
type: string
required: true
description: Alidist version to use for the package (group/repo[@branch])
default: 'alisw/alidist@master'

Check failure on line 18 in .github/workflows/cacheo2package.yml

View workflow job for this annotation

GitHub Actions / actionlint

input "alidist_slug" of workflow_call event has the default value "alisw/alidist@master", but it is also required. if an input is marked as required, its default value will never be used ``` 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'

Check failure on line 23 in .github/workflows/cacheo2package.yml

View workflow job for this annotation

GitHub Actions / actionlint

input "alibuild_slug" of workflow_call event has the default value "alisw/alibuild@master", but it is also required. if an input is marked as required, its default value will never be 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: |

Check failure on line 44 in .github/workflows/cacheo2package.yml

View workflow job for this annotation

GitHub Actions / actionlint

shellcheck reported issue in this script: SC2086:info:2:34: Double quote to prevent globbing and word splitting ``` 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"
Loading