Skip to content

Commit eeab182

Browse files
committed
update action
1 parent fbfbe6f commit eeab182

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

.github/workflows/trigger_jenkins.yaml

+18-21
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,22 @@ jobs:
2323
fi
2424
echo "JOB_NAME=${FOLDER_NAME}/job/next" >> $GITHUB_ENV
2525
26-
- name: Trigger Jenkins Job
27-
env:
28-
JENKINS_USER: ${{ secrets.JENKINS_USERNAME }}
29-
JENKINS_API_TOKEN: ${{ secrets.JENKINS_TOKEN }}
30-
JENKINS_URL: "https://jenkins.scylladb.com"
31-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
32-
run: |
33-
echo "Triggering Jenkins Job: $JOB_NAME"
34-
if ! curl -X POST "$JENKINS_URL/job/$JOB_NAME/buildWithParameters" --fail --user "$JENKINS_USER:$JENKINS_API_TOKEN" -i -v; then
35-
echo "Error: Jenkins job trigger failed"
36-
37-
# Send Slack message
38-
curl -X POST -H 'Content-type: application/json' \
39-
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
40-
--data '{
41-
"channel": "#releng-team",
42-
"text": "🚨 @here '$JOB_NAME' failed to be triggered, please check https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more details"
43-
}' \
44-
https://slack.com/api/chat.postMessage
26+
- name: Start Jenkins Job
27+
uses: scylladb-actions/[email protected]
28+
with:
29+
job_name: ${{ env.JOB_NAME }}
30+
base_url: https://jenkins.scylladb.com
31+
user: ${{ secrets.JENKINS_USERNAME }}
32+
password: ${{ secrets.JENKINS_TOKEN }}
4533

46-
exit 1
47-
fi
34+
- name: Notify Slack on Failure
35+
if: failure()
36+
run: |
37+
echo "Action failed, sending Slack alert..."
38+
curl -X POST -H 'Content-type: application/json' \
39+
-H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" \
40+
--data '{
41+
"channel": "#releng-team",
42+
"text": "🚨 @here '${{ env.JOB_NAME }}' failed to be triggered, please check https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more details."
43+
}' \
44+
https://slack.com/api/chat.postMessage

0 commit comments

Comments
 (0)