Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat(devops): Add action to execute deployment pipleline.aiccra-dev #2629

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/jenkins-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Trigger Jenkins Job

on:
push:
branches:
- '**' # This will trigger the workflow on any branch that receives a push
workflow_dispatch: # This allows the workflow to be manually triggered if needed

jobs:
trigger-job:
runs-on: ubuntu-latest

steps:
# Step 1: Get the branch name and build the URL for Jenkins
- name: Get branch name and build Jenkins URL
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/} # Remove 'refs/heads/' from GITHUB_REF
BRANCH_NAME=${BRANCH_NAME#aiccra-} # Remove 'aiccra-' from BRANCH_NAME
JENKINS_URL="https://automation.prms.cgiar.org/job/marlo-${BRANCH_NAME}/build"
echo "Jenkins job URL for the branch $BRANCH_NAME is: $JENKINS_URL"
echo "JENKINS_URL=${JENKINS_URL}" >> $GITHUB_ENV

# Step 2: Execute the curl command to trigger the job in Jenkins with the dynamically built URL
- name: Trigger Jenkins Job
run: |
curl -X POST ${{ env.JENKINS_URL }} --user ${{ secrets.JENKINS_USERNAME }}:${{ secrets.JENKINS_API_TOKEN }}
env:
JENKINS_URL: ${{ env.JENKINS_URL }}
JENKINS_USERNAME: ${{ secrets.JENKINS_USERNAME }}
JENKINS_API_TOKEN: ${{ secrets.JENKINS_API_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ marlo-web/src/main/java/org/cgiar/ccafs/marlo/validation/WelcomeEmail.java
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
.history/*

#Deploymet files
!.github/workflows/jenkins-trigger.yml
Loading