Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if there is no change in GIT_COMMIT when using Jenkins

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What to do if there is no change in GIT_COMMIT when using Jenkins? I believe many inexperienced people are at a loss about this. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

When using Jenkins, skip building if there is no change in GIT_COMMIT

Use plug-ins: conditional-buildstep

A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition (e.g. BuildParameter).

Wiki: https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin

As shown in the following figure, the build will only be executed if the environment variable GIT_PREVIOUS_SUCCESSFUL_COMMIT does not exist, or if GIT_COMMIT and GIT_PREVIOUS_SUCCESSFUL_COMMIT are different.

The script in the figure above is as follows:

#! / bin/bashif [! $GIT_PREVIOUS_SUCCESSFUL_COMMIT]; then echo "GIT_PREVIOUS_SUCCESSFUL_COMMIT is not exists." Exit 0else echo "GIT_COMMIT= [$GIT_COMMIT], GIT_PREVIOUS_SUCCESSFUL_COMMIT= [$GIT_PREVIOUS_SUCCESSFUL_COMMIT]" if [$GIT_PREVIOUS_SUCCESSFUL_COMMIT= = $GIT_COMMIT]; then echo "GIT_COMMIT is equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT,skip build." Exit-1 else echo "GIT_COMMIT is not equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT" exit 0 fifi

After reading the above, have you mastered the method of what to do if there is no change in GIT_COMMIT when using Jenkins? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report