Skip to content

Commit 804137e

Browse files
committed
update action
1 parent af0cd59 commit 804137e

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/trigger_jenkins.yaml

+24-19
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
run: |
1414
if [[ "${{ github.ref_name }}" == "next" ]]; then
1515
FOLDER_NAME="scylla-master"
16+
elif [[ "${{ github.ref_name }}" == "next-enterprise" ]]; then
17+
FOLDER_NAME="scylla-enterprise"
1618
else
1719
VERSION=$(echo "${{ github.ref_name }}" | awk -F'-' '{print $2}')
1820
if [[ "$VERSION" =~ ^202[0-4]\.[0-9]+$ ]]; then
@@ -21,24 +23,27 @@ jobs:
2123
FOLDER_NAME="scylla-$VERSION"
2224
fi
2325
fi
24-
echo "JOB_NAME=${FOLDER_NAME}/job/next" >> $GITHUB_ENV
26+
echo "JOB_NAME=${FOLDER_NAME}/job/next-machine-image" >> $GITHUB_ENV
2527
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 }}
33-
34-
- name: Notify Slack on Failure
35-
if: failure()
28+
- name: Trigger Jenkins Job
29+
env:
30+
JENKINS_USER: ${{ secrets.JENKINS_USERNAME }}
31+
JENKINS_API_TOKEN: ${{ secrets.JENKINS_TOKEN }}
32+
JENKINS_URL: "https://jenkins.scylladb.com"
33+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
3634
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
35+
echo "Triggering Jenkins Job: $JOB_NAME"
36+
if ! curl -X POST "$JENKINS_URL/job/$JOB_NAME/buildWithParameters" --fail --user "$JENKINS_USER:$JENKINS_API_TOKEN" -i -v; then
37+
echo "Error: Jenkins job trigger failed"
38+
39+
# Send Slack message
40+
curl -X POST -H 'Content-type: application/json' \
41+
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
42+
--data '{
43+
"channel": "#releng-team",
44+
"text": "🚨 @here '$JOB_NAME' failed to be triggered, please check https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more details"
45+
}' \
46+
https://slack.com/api/chat.postMessage
47+
48+
exit 1
49+
fi

0 commit comments

Comments
 (0)