Skip to content

Commit 743fa4c

Browse files
fix(CI): properly report status to codecov (#99)
1 parent c71a2e5 commit 743fa4c

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
FROM quay.io/deis/go-dev:0.17.0
22
# This Dockerfile is used to bundle the source and all dependencies into an image for testing.
33

4+
ADD https://codecov.io/bash /usr/local/bin/codecov
5+
RUN chmod +x /usr/local/bin/codecov
6+
47
COPY glide.yaml /go/src/github.com/deis/controller-sdk-go/
58
COPY glide.lock /go/src/github.com/deis/controller-sdk-go/
69

Jenkinsfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ parallel(
7878
withCredentials([[$class: 'StringBinding',
7979
credentialsId: '2da033eb-2e34-4efd-b090-ad892f348065',
8080
variable: 'CODECOV_TOKEN']]) {
81-
sh "docker run -e CODECOV_TOKEN=\${CODECOV_TOKEN} --rm ${test_image} sh -c 'test-cover.sh && curl -s https://codecov.io/bash | bash'"
81+
def codecov = "codecov -Z -C ${git_commit} "
82+
if (git_branch == "remotes/origin/master") {
83+
codecov += "-B master"
84+
} else {
85+
def branch_name = env.BRANCH_NAME
86+
def branch_index = branch_name.indexOf('-')
87+
def pr = branch_name.substring(branch_index+1, branch_name.length())
88+
codecov += "-P ${pr}"
89+
}
90+
sh "docker run -e CODECOV_TOKEN=\${CODECOV_TOKEN} --rm ${test_image} sh -c 'test-cover.sh && ${codecov}'"
8291
}
8392
}
8493
}

0 commit comments

Comments
 (0)