.github: trigger Jenkins job using github action

This action will help preventing next-trigger for running every 15 minutes.

This action will run on push for a specific branch (next, next-enterprise, 2024.x, x.x)

Fixes: scylladb#23088

update action

Closes scylladb/scylladb#23141
This commit is contained in:
Luis Freitas
2025-03-04 10:07:07 +00:00
committed by Botond Dénes
parent 28906c9261
commit 84b30d11ec

46
.github/workflows/trigger_jenkins.yaml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Trigger next gating
on:
push:
branches:
- next**
jobs:
trigger-jenkins:
runs-on: ubuntu-latest
steps:
- name: Determine Jenkins Job Name
run: |
if [[ "${{ github.ref_name }}" == "next" ]]; then
FOLDER_NAME="scylla-master"
elif [[ "${{ github.ref_name }}" == "next-enterprise" ]]; then
FOLDER_NAME="scylla-enterprise"
else
VERSION=$(echo "${{ github.ref_name }}" | awk -F'-' '{print $2}')
if [[ "$VERSION" =~ ^202[0-4]\.[0-9]+$ ]]; then
FOLDER_NAME="enterprise-$VERSION"
elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
FOLDER_NAME="scylla-$VERSION"
fi
fi
echo "JOB_NAME=${FOLDER_NAME}/job/next" >> $GITHUB_ENV
- name: Start Jenkins Job
uses: scylladb-actions/jenkins-client@v0.1.0
with:
job_name: ${{ env.JOB_NAME }}
base_url: https://jenkins.scylladb.com
user: ${{ secrets.JENKINS_USERNAME }}
password: ${{ secrets.JENKINS_TOKEN }}
- name: Notify Slack on Failure
if: failure()
run: |
echo "Action failed, sending Slack alert..."
curl -X POST -H 'Content-type: application/json' \
-H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" \
--data '{
"channel": "#releng-team",
"text": "🚨 @here '${{ env.JOB_NAME }}' failed to be triggered, please check https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more details."
}' \
https://slack.com/api/chat.postMessage