modularize workflow

This commit is contained in:
zack 2024-10-19 22:58:49 -04:00
parent b0c8f2f969
commit 9855142340
No known key found for this signature in database
GPG key ID: 5F873416BCF59F35
3 changed files with 201 additions and 183 deletions

40
.github/actions/trigger-hydra-build.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: 'Trigger Hydra Build'
description: 'Triggers a build on a Hydra CI server'
inputs:
hydra_instance:
description: 'URL of the Hydra instance'
required: true
hydra_project:
description: 'Name of the Hydra project'
required: true
hydra_jobset:
description: 'Name of the Hydra jobset'
required: true
hydra_username:
description: 'Username for Hydra authentication'
required: true
hydra_password:
description: 'Password for Hydra authentication'
required: true
runs:
using: "composite"
steps:
- name: Trigger Hydra build
shell: bash
run: |
AUTH_HEADER="Authorization: Basic $(echo -n '${{ inputs.hydra_username }}:${{ inputs.hydra_password }}' | base64)"
response=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "$AUTH_HEADER" \
-H "Origin: ${{ inputs.hydra_instance }}" \
-d '{"jobsets": ["${{ inputs.hydra_project }}:${{ inputs.hydra_jobset }}"]}' \
"${{ inputs.hydra_instance }}/api/push")
if [[ $response == *"\"submitted\":true"* ]]; then
echo "Hydra build triggered successfully"
else
echo "Failed to trigger Hydra build"
echo "Response: $response"
exit 1
fi