Skip to content

Commit e29e1a5

Browse files
fix(tests): change UID of files so jenkins can clean them up (#53)
1 parent 5745c39 commit e29e1a5

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

Jenkinsfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
def workpath_linux_root = "/src/github.com/deis"
22

3+
def make = { String target ->
4+
try {
5+
sh "make ${target} fileperms"
6+
} catch(error) {
7+
sh 'make fileperms'
8+
false
9+
}
10+
}
11+
312
def gopath_linux = {
413
def gopath = pwd() + "/gopath"
514
env.GOPATH = gopath
@@ -37,9 +46,9 @@ node('linux') {
3746
stage 'Checkout Linux'
3847
checkout scm
3948
stage 'Install Linux'
40-
sh 'make bootstrap'
49+
make 'bootstrap'
4150
stage 'Test Linux'
42-
sh 'make test'
51+
make 'test'
4352
}
4453
}
4554

@@ -102,7 +111,7 @@ node('linux') {
102111
withCredentials([[$class: 'FileBinding', credentialsId: 'e80fd033-dd76-4d96-be79-6c272726fb82', variable: 'GCSKEY']]) {
103112
sh "mkdir -p ${getBasePath(filepath)}"
104113
sh "cat \"\${GCSKEY}\" > ${filepath}"
105-
sh "make upload-gcs"
114+
make 'upload-gcs'
106115
}
107116
}
108117

@@ -115,7 +124,7 @@ node('linux') {
115124
echo "Skipping build of 386 binaries to shorten CI for Pull Requests"
116125
env.BUILD_ARCH = "amd64"
117126
}
118-
sh 'make bootstrap'
127+
make 'bootstrap'
119128

120129
stage "Update local glide.yaml with controller-sdk-go repo '${go_repo}' and version '${git_commit}'"
121130

@@ -126,7 +135,7 @@ node('linux') {
126135
def glideYaml = readFile('glide.yaml')
127136
echo "Updated glide.yaml:\n${glideYaml}"
128137

129-
sh 'make glideup'
138+
make 'glideup'
130139
sh "VERSION=${git_commit.take(7)} make build-revision"
131140

132141
stage "Deploy ${repo}"

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
1515
GOFMT = gofmtresult=$$(gofmt -e -l -s ${GO_FILES} ${GO_PACKAGES}); if [[ -n $$gofmtresult ]]; then echo "gofmt errors found in the following files: $${gofmtresult}"; false; fi;
1616
GOTEST = go test --cover --race -v
1717

18+
# UID and GID of local user
19+
UID := $(shell id -u)
20+
GID := $(shell id -g)
21+
22+
1823
bootstrap:
1924
${DEV_ENV_CMD} glide install
2025

@@ -37,3 +42,7 @@ test-style:
3742

3843
test-unit:
3944
${DEV_ENV_PREFIX_CGO_ENABLED} ${DEV_ENV_IMAGE} sh -c '${GOTEST} $$(glide nv)'
45+
46+
# Set local user as owner for files
47+
fileperms:
48+
${DEV_ENV_PREFIX_CGO_ENABLED} ${DEV_ENV_IMAGE} chown -R ${UID}:${GID} .

0 commit comments

Comments
 (0)