In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "what is the method of Jenkins plug-in to obtain git branch". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The Jenkins environment used in the company's internal test environment is 1.65. now many versions have been updated, but they have not been upgraded because they have been used normally; in fact, as long as the function, security and stability can be upgraded very rarely; however, in order to keep up with the pace of open source, a new version has been tested on the virtual machine; it is found that several previous plug-ins have been removed in the new version. This time, only record the plug-in issues obtained by the frequently used branch of git code.
Jenkins can be built through parameterization, which greatly facilitates development and deployment. Various parameters are passed in to facilitate subsequent calls, and shell scripts or Python are used to deal with them.
1. The old version of Jenkins can use the Dynamic Choice Parameter plug-in
How to use it:
Jenkins--- > dev-h6-server--- > configuration-> Parametric construction process-> Select the Dynamic Choice Parameter plug-in:
Name: git_branch
Choices Script:
Def gettags = ("git ls-remote-h http://10.0.10.25/h6-server.git").execute()"
Gettags.text.readLines () .collect {it.split () [1] .replaceAll ('refs/heads/',')} .unique ()
Source code management-- > Git--- > Branches to build
Change * / master to: $git_branch [is the name value defined above]
So you can get the git code branch.
I'm in the old Jenkins [Jenkins ver. 1.653] has the following hint; [not tested yet]
Git Parameter Plug-In 0.8.0
Assign git tag or revision number as parameter in Parametrized builds
Warning: This plugin requires dependent plugins be upgraded and at least one of these dependent plugins claims to use a different settings format than the installed version. Jobs using that plugin may need to be reconfigured, and/or you may not be able to cleanly revert to the prior version without manually restoring old settings. Consult the plugin release notes for details.
2. The new version of the Dynamic Choice Parameter plug-in can no longer be found officially, and it is officially stated that there are security vulnerabilities.
So use the Git Parameter Plug-In build parameter to get the branch plug-in
How to use it:
Jenkins--- > dev-h6-server--- > configuration-> Parametric construction process-> Select the Git Parameter Plug-In plug-in:
Name: git_branch
Description: describe what can be written
Parameter Type: select Branch
Branch Filter:. *
Tag Filter: *
Sort Mode: NONE
Default Value: master backbone is used when master # is not selected by default
Selected Value: DEFAULT # defaults to master
Everything else not written down is left blank.
Source code management-- > Git--- > Branches to build
Change * / master to: $git_branch [is the name value defined above]
So you can get the git code branch.
In fact, the methods of the two plug-ins are similar, but the list obtained is a little different. The Dynamic Choice Parameter plug-in plus the slices on the script retains only the branch name, while Git Parameter Plug-In displays the origin/.
A simple way to get rid of that E passage:
Cd jenkins/plugins/git-parameter/WEB-INF/lib/
Go to the plug-in directory and create a temporary directory:
Mkdir test
Cp git-parameter.jar test/
Cd test/
Jar xf git-parameter.jar
Vim. / net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition/index.properties
Delete the second line, save it, and repackage it:
Jar cvf git-parameter.jar. *
/ bin/cp git-parameter.jar.. /
Replace the original file, it is recommended to back it up before modification; after repackaging, the size has changed from 64K to 1.2m, which is a bit of an exaggeration.
When you restart the Jenkins service, you will find that that section has been removed.
This is the end of the content of "how does the Jenkins plug-in get the git branch?" Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.