PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 27, 2022

[FIXED] How to trigger a jenkins pipeline from multiple repository

 September 27, 2022     continuous-deployment, continuous-integration, git, jenkins, jenkins-pipeline     No comments   

Issue

I am relatively new to jenkins and I am working on a big project that pulls from multiple repo to build. I wrote a declarative pipeline with shell commands that I use that pulls from the required repos and build the project and everything are working but I want to connect this pipeline to all these repos so every time that there is a new commit or merge request, that triggers jenkins and starts this pipeline and then based on the build result I tag the git. I know how to do this for one repo but I don't know how to do it for multiple repo.


Solution

Because of our network infrastructure I couldn't use webhook to trigger jenkins but the solution that I am using now is I created a runner for each repo and I wrote a curl command to trigger jenkins with so each time that there is a new commit to each of those repos the runner starts a new job, executes that curl command and triggers my jenkins job.

This is the curl command that I am using in case someone needed it:

curl -i -X POST --user [JENKINS_USERNAME]:[JENKINS_PASSWORD] 'http://[JENKINS_IP]:[JENKINS_PORT]/job/[JENKINS_JOB_NAME]/build?token=[TOKEN_GENERATED_INSIDE_JENKINS]&cause=[ADDITIONAL_INFORMATION_THAT_YOU_WANT_TO_PRINT]'


Answered By - AVarf
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing