Skip to content

Commit

Permalink
Add build-any-ib GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
singiamtel committed Oct 11, 2024
1 parent 99f2288 commit 3c53646
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-any-ib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# Launch the build-any-ib job in Jenkins
name: Build any IB

'on':
workflow_dispatch:
inputs:
package_name:
type: string
description: Name of the package to build
default: 'O2'
alidist_slug:
type: string
description: Alidist version to use for the package (group/repo[@branch])
default: 'alisw/alidist@master'
architecture:

Check failure on line 16 in .github/workflows/build-any-ib.yml

View workflow job for this annotation

GitHub Actions / actionlint

input type of "architecture" is "choice" but "options" is not set ``` architecture: ^~~~~~~~~~~~~ ```

Check failure on line 16 in .github/workflows/build-any-ib.yml

View workflow job for this annotation

GitHub Actions / actionlint

input type of "architecture" is "choice" but "options" is not set ``` architecture: ^~~~~~~~~~~~~ ```
type: choice
description: Architecture to build the package for
default: 'latest'
options:

Check failure on line 20 in .github/workflows/build-any-ib.yml

View workflow job for this annotation

GitHub Actions / actionlint

"options" section must be sequence node but got scalar node with "!!null" tag ``` options: ^ ```

Check failure on line 20 in .github/workflows/build-any-ib.yml

View workflow job for this annotation

GitHub Actions / actionlint

"options" section must be sequence node but got scalar node with "!!null" tag ``` options: ^ ```

permissions: {}

jobs:
build-any-ib:
runs-on: ubuntu-latest

env:
# --- Jenkins and SSO params ---
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: 'build-any-ib'

# --- build-any-ib build params ---
# ALIBUILD_SLUG: ${{ inputs.alibuild_slug }}
ALIDIST_SLUG: ${{ inputs.alidist_slug }}
ARCHITECTURE: ${{ inputs.architecture }}
PACKAGE_NAME: ${{ inputs.package_name }}
# OVERRIDE_TAGS: ${{ inputs.override_tags }}
# OVERRIDE_VERSIONS: ${{ inputs.override_versions }}
# DEFAULTS: "o2"
# PUBLISH_BUILDS: "true"
# USE_REMOTE_STORE: "true"

steps:
- name: Launch the build-any-ib 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" \
--data "ARCHITECTURE=$ARCHITECTURE"

0 comments on commit 3c53646

Please sign in to comment.