Skip to content

Commit 47def28

Browse files
committed
feat(Makefile): add git branch and sha information to the uploaded blob
1 parent 6c1332d commit 47def28

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Jenkinsfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
def workpath_linux = "/src/github.com/deis/workflow-cli"
22
def windows = 'windows'
33
def linux = 'linux'
4+
def git_commit = ''
5+
def git_branch = ''
46

57
def getBasePath = { String filepath ->
68
def filename = filepath.lastIndexOf(File.separator)
@@ -35,9 +37,14 @@ def upload_artifacts = { boolean cache ->
3537
sh "mkdir -p ${getBasePath(gcs_key)}"
3638
sh "cat \"\${GCSKEY}\" > ${gcs_key}"
3739
gcs_cmd 'gcloud auth activate-service-account -q --key-file /.config/key.json'
38-
headers = ""
40+
41+
headers = "-h 'x-goog-meta-git-branch:${git_branch}' "
42+
headers += "-h 'x-goog-meta-git-sha:${git_commit}' "
43+
headers += "-h 'x-goog-meta-ci-job:${env.JOB_NAME}' "
44+
headers += "-h 'x-goog-meta-ci-number:${env.BUILD_NUMBER}' "
45+
headers += "-h 'x-goog-meta-ci-url:${env.BUILD_URL}'"
3946
if(!cache) {
40-
headers += '-h "Cache-Control:no-cache"'
47+
headers += ' -h "Cache-Control:no-cache"'
4148
}
4249
gcs_cmd "gsutil -mq ${headers} cp -a public-read -r /upload/* ${gcs_bucket}"
4350
gcs_cmd gcs_cleanup_cmd
@@ -111,9 +118,6 @@ node(linux) {
111118
}
112119
}
113120

114-
def git_commit = ''
115-
def git_branch = ''
116-
117121
stage 'Git Info'
118122
node(linux) {
119123

0 commit comments

Comments
 (0)