40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
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
|