how to get submodules to trigger a Jenkins build

前端 未结 2 1795
鱼传尺愫
鱼传尺愫 2021-01-01 04:42

I have a submodule A that is not a standalone application. It requires the main application for it to work. I would like to create a CI build for A so that whenever a commit

2条回答
  •  情话喂你
    2021-01-01 05:23

    This can be done in two steps:

    1. Enable a build trigger url on the Jenkins job you want to build. This is done under "Trigger builds remotely" tab. The url will be in the form: JENKINS_URL/job/MY_JOB_NAME/build?token=TOKEN_NAME.

    2. Setup a git post-receive hook in submodule A that calls the above url. An easy way to do so is simply to use curl: curl JENKINS_URL/job/MY_JOB_NAME/build?token=TOKEN_NAME.

    A push to submodule A will then trigger the main project Jenkins's job by calling the url. Configure the Jenkins job to update its code before build or any other specifics you need.

    This answer provides a lot of details on how to setup the git hook.

提交回复
热议问题