I have a jenkins and project on the beatback. I configured the start of the build by commit in the beatback. If the build was successful, I want to push my changes, received during the work of the build, into the branch, at which commit, this job is started. I do not want to re-run the build, how to solve this problem?
- oneA commit is a local commit of changes. Push is a fixation of changes in the remout. The builds are triggered by changes in remout, i. Changes are already running. Not very clear what else you want to get? - andreycha
- When pushing to branch A, the job is triggered by jenkins. Jenkins, if the job is successful, makes changes, commits them and pulls into branch A. after which the job starts again. It would be desirable, that after pushing jenkins Joba did not triglerized - Ivan Gladush
- "if the job is successful, makes changes, commits them and pushes them into branch A" - do you use gated check-in? - andreycha
- No, what is it and how to use it? - Ivan Gladush
- If not, then you don’t need this part: “if the job is successful, it makes changes, commits them and pushes them to branch A.” When the build starts, the changes are already in branch A and you don’t need to push anything into it again. - andreycha
|
2 answers
Enter a label indicating that this task does not require running CI, for example [skip ci] . When Jenkins makes a commit, let it add this label to the text of the commit message.
When starting the pipeline, first check the presence of the label in the message of the last commit of the current branch. There is an extension Jenkins CI Skip , but it has not been updated for a long time.
If it does not work, you can do the same check manually. First, determine the presence of a label in the commit message and export the variable to the environment.
if [[ $(git show -s --format=%B) == *"skip ci"* ]]; then export SKIPCI=1 fi Then add a condition: if there is no label, perform the rest of the pipeline.
|
