Skip to content

Commit

Permalink
use go mod edit --replace
Browse files Browse the repository at this point in the history
  • Loading branch information
gkirok committed Apr 4, 2019
1 parent 8426280 commit 5d4a6d7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,30 @@ def build_prometheus(V3IO_TSDB_VERSION, internal_status="stable") {

stage('prepare sources') {
container('jnlp') {
if (!fileExists("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}")) {
sh("cd ${BUILD_FOLDER}; git clone https://${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git src/github.com/${git_project}/${git_project}")
if (!fileExists("${BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}")) {
sh("cd ${BUILD_FOLDER}; git clone https://${GIT_TOKEN}@github.com/${git_project_user}/${git_project}.git src/github.com/${git_project_upstream_user}/${git_project}")
}
if ("${internal_status}" == "unstable") {
dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") {
dir("${BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
sh("git stash")
sh("git checkout development")
}
} else {
dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") {
dir("${BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
sh("git stash")
sh("git checkout master")
}
}
}
container('golang') {
dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") {
dir("${BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
echo "test gomod"
if("${git_project_user}" != "${git_project_upstream_user}") {
echo "started"
sh("GO111MODULE=on go mod edit -replace github.com/${git_project_upstream_user}/v3io-tsdb=github.com/${git_project_user}/v3io-tsdb@${V3IO_TSDB_VERSION}")
echo "ended"
}
echo "no test"
sh """
GO111MODULE=on go get github.com/${git_project_user}/v3io-tsdb@${V3IO_TSDB_VERSION}
GO111MODULE=on go mod vendor
Expand All @@ -190,7 +197,7 @@ def build_prometheus(V3IO_TSDB_VERSION, internal_status="stable") {

stage('git push') {
container('jnlp') {
dir("${BUILD_FOLDER}/src/github.com/${git_project}/${git_project}") {
dir("${BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
sh """
git config --global user.email '${GIT_USERNAME}@iguazio.com'
git config --global user.name '${GIT_USERNAME}'
Expand Down

0 comments on commit 5d4a6d7

Please sign in to comment.