Configure jenkins job for Git checkin

I have tried using the maven plugin for deployment. I have successfully configured jenkins to pull an api proxy checked in to git and deploy to edge.

I am trying to setup jenkins job to run whenever there is a git push. I have a single repository location for all api proxies. In this case what can I give as the ROOT POM configuration in the jenkins job.

Do we need to configure a jenkins job for every API proxy?

@Diego any pointers on this?

Solved Solved
1 6 1,605
1 ACCEPTED SOLUTION

Not applicable

Good point Nagashree. You're deepening your knowledge into how to structure your code in Git either leveraging multiple branches or repos per API. So here are some recommendations to define your branching strategy and job definitions in Jenkins:

1) Release each API as an independent shippable component/microservice. In order to achieve this, you'll need to either have each in a separate repo (API-centric with multiple repos) or have a separate master/develop/toggle or feature branches per API. The former is approach is recommended, since there's lower risk of colliding with branches from other APIs. Also, it specializes your teams per API and given the low cost of Git repos.

148-branching-strategy.png

2) Define jobs in Jenkins: Once you defile your version control strategy, define jobs per API per environment. The ultimate goal is to have a job per API, instead of one job for all them. It'll again will run regression tests for each API as well as any consumer-driven contracts independently from other APIs.

3) Define events that trigger Jenkins jobs: Each job can configured to be triggered by either commit (merge or pull request) checkins or on a schedule basis.For example, the checkbox below will trigger the job every 15 minutes, if there was no new code checked in, the job will not be executed, so it won't redeploy the API. Only, when it finds new code, it will kick off the job from end to end, so apigee maven deploy plugin will be executed and the API verified, deployed and tested.

149-jenkins-triggers.png

View solution in original post

6 REPLIES 6

Not applicable

You usually watch a git repo not a specific path - any change in repo will trigger the jenkins Job. Are you watching a specific path?

@sriki77 @Diego Zuluaga I am trying to follow the APIcentric branching approach as mentioned above. How do we share the root pom files in this scenario across repos, esp shared-pom.xml?

Not applicable

Good point Nagashree. You're deepening your knowledge into how to structure your code in Git either leveraging multiple branches or repos per API. So here are some recommendations to define your branching strategy and job definitions in Jenkins:

1) Release each API as an independent shippable component/microservice. In order to achieve this, you'll need to either have each in a separate repo (API-centric with multiple repos) or have a separate master/develop/toggle or feature branches per API. The former is approach is recommended, since there's lower risk of colliding with branches from other APIs. Also, it specializes your teams per API and given the low cost of Git repos.

148-branching-strategy.png

2) Define jobs in Jenkins: Once you defile your version control strategy, define jobs per API per environment. The ultimate goal is to have a job per API, instead of one job for all them. It'll again will run regression tests for each API as well as any consumer-driven contracts independently from other APIs.

3) Define events that trigger Jenkins jobs: Each job can configured to be triggered by either commit (merge or pull request) checkins or on a schedule basis.For example, the checkbox below will trigger the job every 15 minutes, if there was no new code checked in, the job will not be executed, so it won't redeploy the API. Only, when it finds new code, it will kick off the job from end to end, so apigee maven deploy plugin will be executed and the API verified, deployed and tested.

149-jenkins-triggers.png

Not applicable

Hi Nagashree, I need a help as you already implemented , can you please share the steps or any link to pull the proxy from Edge to github through Jenkin.

@snehansu Are you asking if you can pull the API proxy from edge to github?

I dont think that's something I have tried.

What I have tried is - pull the API proxy code bundle checked in to git and then deploy it to edge using the apigee maven deployment plugin through jenkins.

I follwed this to setup the jenkins job - http://www.thegeekstuff.com/2016/10/jenkins-git-setup/

There is a readme document bundled with the Apigee Maven Deploy plugin. I followed the instructions in it and configured the jenkins job with the apigee maven deploy command.

Thanks Nagashree. I am trying how to automate to download the proxy from Edge and push to git. Let me know if you have any thought on this.