Skip to content

Commit fbfbe6f

Browse files
committed
Trigger next gating using github action
This action will help preventing next-trigger for running every 15 minutes looking for changes. We'll trigger next gating directly on push for next* branches. Fixes: #636
1 parent 78a72cd commit fbfbe6f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Trigger next gating
2+
3+
on:
4+
push:
5+
branches:
6+
- next**
7+
8+
jobs:
9+
trigger-jenkins:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Determine Jenkins Job Name
13+
run: |
14+
if [[ "${{ github.ref_name }}" == "next" ]]; then
15+
FOLDER_NAME="scylla-master"
16+
else
17+
VERSION=$(echo "${{ github.ref_name }}" | awk -F'-' '{print $2}')
18+
if [[ "$VERSION" =~ ^202[0-4]\.[0-9]+$ ]]; then
19+
FOLDER_NAME="enterprise-$VERSION"
20+
elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
21+
FOLDER_NAME="scylla-$VERSION"
22+
fi
23+
fi
24+
echo "JOB_NAME=${FOLDER_NAME}/job/next" >> $GITHUB_ENV
25+
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
45+
46+
exit 1
47+
fi

0 commit comments

Comments
 (0)