Skip to content

Commit 421346a

Browse files
authored
update (#9)
* update
1 parent 1428d21 commit 421346a

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

Jenkinsfile

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
label = "${UUID.randomUUID().toString()}"
22
git_project = "v3ctl"
33
git_project_user = "v3io"
4+
git_project_upstream_user = "v3io"
5+
git_deploy_user = "iguazio-prod-git-user"
46
git_deploy_user_token = "iguazio-prod-git-user-token"
57
git_deploy_user_private_key = "iguazio-prod-git-user-private-key"
68

7-
podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker-golang") {
9+
podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker-golang1.14.2") {
810
node("${git_project}-${label}") {
911
pipelinex = library(identifier: 'pipelinex@development', retriever: modernSCM(
1012
[$class : 'GitSCMSource',
@@ -14,38 +16,46 @@ podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker-golang")
1416
withCredentials([
1517
string(credentialsId: git_deploy_user_token, variable: 'GIT_TOKEN')
1618
]) {
17-
github.init_project(git_project, git_project_user, GIT_TOKEN) {
18-
def RELEASE_ID
19-
stage('prepare sources') {
19+
github.release(git_deploy_user, git_project, git_project_user, git_project_upstream_user, true, GIT_TOKEN) {
20+
stage("get release") {
2021
container('jnlp') {
2122
RELEASE_ID = github.get_release_id(git_project, git_project_user, "${github.TAG_VERSION}", GIT_TOKEN)
23+
}
24+
}
2225

26+
stage('get dependencies') {
27+
container('golang') {
2328
dir("${github.BUILD_FOLDER}/src/github.com/v3io/${git_project}") {
24-
git(changelog: false, credentialsId: git_deploy_user_private_key, poll: false, url: "git@github.com:${git_project_user}/${git_project}.git")
25-
common.shellc("git checkout ${github.TAG_VERSION}")
29+
common.shellc("make get-dependencies")
2630
}
2731
}
2832
}
2933

3034
parallel(
3135
'build linux binaries': {
32-
container('docker-cmd') {
33-
dir("${github.BUILD_FOLDER}/src/github.com/v3io/${git_project}") {
34-
common.shellc("V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=linux make v3ctl")
36+
container('golang') {
37+
stage('build linux binaries') {
38+
dir("${github.BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
39+
common.shellc("V3CTL_SRC_PATH=\$(pwd) V3CTL_BIN_PATH=\$(pwd) V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=linux make v3ctl-bin")
40+
}
3541
}
3642
}
3743
},
3844
'build darwin binaries': {
39-
container('docker-cmd') {
40-
dir("${github.BUILD_FOLDER}/src/github.com/v3io/${git_project}") {
41-
common.shellc("V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=darwin make v3ctl")
45+
container('golang') {
46+
stage('build darwin binaries') {
47+
dir("${github.BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
48+
common.shellc("V3CTL_SRC_PATH=\$(pwd) V3CTL_BIN_PATH=\$(pwd) V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=darwin make v3ctl-bin")
49+
}
4250
}
4351
}
4452
},
4553
'build windows binaries': {
46-
container('docker-cmd') {
47-
dir("${github.BUILD_FOLDER}/src/github.com/v3io/${git_project}") {
48-
common.shellc("V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=windows make v3ctl")
54+
container('golang') {
55+
stage('build windows binaries') {
56+
dir("${github.BUILD_FOLDER}/src/github.com/${git_project_upstream_user}/${git_project}") {
57+
common.shellc("V3CTL_SRC_PATH=\$(pwd) V3CTL_BIN_PATH=\$(pwd) V3CTL_TAG=${github.TAG_VERSION} GOARCH=amd64 GOOS=windows make v3ctl-bin")
58+
}
4959
}
5060
}
5161
}
@@ -54,26 +64,34 @@ podTemplate(label: "${git_project}-${label}", inheritFrom: "jnlp-docker-golang")
5464
parallel(
5565
'upload linux binaries': {
5666
container('jnlp') {
57-
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-linux-amd64", RELEASE_ID, GIT_TOKEN)
67+
stage('upload linux binaries') {
68+
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-linux-amd64", RELEASE_ID, GIT_TOKEN)
69+
}
5870
}
5971
},
6072
'upload linux binaries artifactory': {
6173
container('jnlp') {
62-
withCredentials([
63-
string(credentialsId: pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[2], variable: 'PACKAGES_ARTIFACTORY_PASSWORD')
64-
]) {
65-
common.upload_file_to_artifactory(pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[0], pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[1], PACKAGES_ARTIFACTORY_PASSWORD, "iguazio-devops/k8s", "v3ctl-${github.TAG_VERSION}-linux-amd64")
74+
stage('upload linux binaries artifactory') {
75+
withCredentials([
76+
string(credentialsId: pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[2], variable: 'PACKAGES_ARTIFACTORY_PASSWORD')
77+
]) {
78+
common.upload_file_to_artifactory(pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[0], pipelinex.PackagesRepo.ARTIFACTORY_IGUAZIO[1], PACKAGES_ARTIFACTORY_PASSWORD, "iguazio-devops/k8s", "v3ctl-${github.TAG_VERSION}-linux-amd64")
79+
}
6680
}
6781
}
6882
},
6983
'upload darwin binaries': {
7084
container('jnlp') {
71-
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-darwin-amd64", RELEASE_ID, GIT_TOKEN)
85+
stage('upload darwin binaries') {
86+
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-darwin-amd64", RELEASE_ID, GIT_TOKEN)
87+
}
7288
}
7389
},
7490
'upload windows binaries': {
7591
container('jnlp') {
76-
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-windows-amd64", RELEASE_ID, GIT_TOKEN)
92+
stage('upload windows binaries') {
93+
github.upload_asset(git_project, git_project_user, "v3ctl-${github.TAG_VERSION}-windows-amd64", RELEASE_ID, GIT_TOKEN)
94+
}
7795
}
7896
}
7997
)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ GOOS ?= linux
22
GOARCH ?= amd64
33
V3CTL_GIT_COMMIT = $(shell git rev-parse HEAD)
44
V3CTL_TAG ?= latest
5-
V3CTL_SRC_PATH = /v3ctl
6-
V3CTL_BIN_PATH = /v3ctl
5+
V3CTL_SRC_PATH ?= /v3ctl
6+
V3CTL_BIN_PATH ?= /v3ctl
77

88
GO_LINK_FLAGS_INJECT_VERSION := -s -w \
99
-X github.com/v3io/version-go.gitCommit=$(V3CTL_GIT_COMMIT) \

0 commit comments

Comments
 (0)