Skip to content

Commit

Permalink
Add LocalBranch to extentions in checkout step. (sonic-net#99)
Browse files Browse the repository at this point in the history
SONiC build system inserts a branch name into image version string.
However, jenkins checkouts from the branch, so HEAD is in detached
state, in this case, "git rev-parse --abrrev-ref HEAD" returns HEAD.
This diff adds "LocalBranch" to extenstions, so jenkins will checkout
and create a local branch named as remote branch, this should fix the
issue with image version string.
  • Loading branch information
stepanblyschak authored Apr 14, 2020
1 parent 5775114 commit 8d7591a
Show file tree
Hide file tree
Showing 30 changed files with 97 additions and 39 deletions.
4 changes: 3 additions & 1 deletion jenkins/barefoot/buildimage-bf-201904/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/barefoot/buildimage-bf-201911/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
8 changes: 5 additions & 3 deletions jenkins/broadcom/buildimage-brcm-201904/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ pipeline {
stages {
stage('Prepare') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/broadcom/buildimage-brcm-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/broadcom/buildimage-brcm-buster/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/lguohan/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/generic/buildimage-baseimage/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-201811-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-201811/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-201911-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-201911/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-all-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/innovium/buildimage-invm-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-201811-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-201811/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
8 changes: 5 additions & 3 deletions jenkins/mellanox/buildimage-mlnx-201904/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ pipeline {
stage('Prepare') {
steps {

checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-201911-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-201911/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 2 additions & 2 deletions jenkins/mellanox/buildimage-mlnx-all-pr/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pipeline {
stage('Prepare') {
steps {
step([$class: 'WsCleanup'])
checkout([$class: 'GitSCM',
branches: [[name: '${sha1}']],
checkout([$class: 'GitSCM',
branches: [[name: '${sha1}']],
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-all-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-bmtor-rpc/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/mellanox/buildimage-mlnx-bmtor/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
8 changes: 5 additions & 3 deletions jenkins/nephos/buildimage-nps-201811/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ pipeline {
stages {
stage('Prepare') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201811']],
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201811']],
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/nephos/buildimage-nps-201911/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/nephos/buildimage-nps-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/vs/buildimage-vs-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
8 changes: 5 additions & 3 deletions jenkins/vs/buildimage-vs-image-201904/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ pipeline {
stages {
stage('Prepare') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/201904']],
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/vs/buildimage-vs-image-201911/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/vs/buildimage-vs-image-buster/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/lguohan/sonic-buildimage']]])
}
}
Expand Down
4 changes: 3 additions & 1 deletion jenkins/vs/buildimage-vs-image/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pipeline {
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: "**"]],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
}
}
Expand Down

0 comments on commit 8d7591a

Please sign in to comment.