建立一個tag標籤git
例如經過Idea建立一個taggithub
git->Repository->tagmaven
將tag推送到遠程倉庫ui
2.參數化構建spa
2.1 Click "Add Parameter"rest
2.2 Click "Git Parameter"ip
2.3 Enter "tag" to "Name"ci
2.4 Enter 「*/master」 to 「Branch」get
2.5 Enter "xxx" to Tag Filter(填寫本身的tag過濾規則)jenkins
2.5 Find the section named 「Source Code Management」
2.6 Enter 「${tag}」 to 「Branch Specifier」
If use git-parameter-plugin-4.0 could't get list of tag,You must upgrade to 4.1-SNAPSHORT. You could check the could from https://github.com/jenkinsci/git-parameter-plugin.git
the build step:
git clone https://github.com/jenkinsci/git-parameter-plugin.git
cd git-parameter-plugin
mvn clean package -DskipTests=true
copy git-parameter.hpi from git-parameter-plugin\target to jenkins/WEB-INF/plugins
restart jenkins
3.jenkins構建上下游項目構建管理
對於maven多模塊項目,若是選擇構建觸發選擇Build whenever a SNAPSHOT dependency is built,構建頂級模塊時會觸發下級項目構建,若是沒有須要去掉前面的鉤子便可