Skip to content

Commit

Permalink
Fix git and build references for coveralls
Browse files Browse the repository at this point in the history
Use `PULL_BASE_REF` for referencing the base branch for coverage.
Use `PULL_PULL_SHA` to override the git sha, as the one fetched from
the presubmit is different due to branch rebasing. Use `PROW_JOB_ID`
to reference the prow job this build result originates from.

See prow env var docs: https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md#job-environment-variables

Signed-off-by: Daniel Hiller <dhiller@redhat.com>
  • Loading branch information
dhiller committed May 19, 2021
1 parent ea96e7a commit b74c931
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ coverage:
hack/dockerized "./hack/coverage.sh ${WHAT}"

goveralls:
SYNC_OUT=false hack/dockerized "COVERALLS_TOKEN_FILE=${COVERALLS_TOKEN_FILE} COVERALLS_TOKEN=${COVERALLS_TOKEN} CI_NAME=prow CI_BRANCH=${PULL_REFS} CI_PR_NUMBER=${PULL_NUMBER} ./hack/bazel-goveralls.sh"
SYNC_OUT=false hack/dockerized "COVERALLS_TOKEN_FILE=${COVERALLS_TOKEN_FILE} COVERALLS_TOKEN=${COVERALLS_TOKEN} CI_NAME=prow CI_BRANCH=${PULL_BASE_REF} CI_PR_NUMBER=${PULL_NUMBER} GIT_ID=${PULL_PULL_SHA} PROW_JOB_ID=${PROW_JOB_ID} ./hack/bazel-goveralls.sh"

go-test: go-build
SYNC_OUT=false hack/dockerized "./hack/build-go.sh test ${WHAT}"
Expand Down
2 changes: 1 addition & 1 deletion hack/goveralls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -eo pipefail

bazel run //vendor/github.com/wadey/gocovmerge:gocovmerge -- $(cat | sed "s# # ${BUILD_WORKING_DIRECTORY}/#g" | sed "s#^#${BUILD_WORKING_DIRECTORY}/#") >coverprofile.dat
goveralls -service=${CI_NAME} -coverprofile=coverprofile.dat -ignore=$(find -regextype posix-egrep -regex ".*generated_mock.*\.go|.*swagger_generated\.go|.*openapi_generated\.go" -printf "%P\n" | paste -d, -s)
goveralls -service=${CI_NAME} -jobid=${PROW_JOB_ID} -coverprofile=coverprofile.dat -ignore=$(find -regextype posix-egrep -regex ".*generated_mock.*\.go|.*swagger_generated\.go|.*openapi_generated\.go" -printf "%P\n" | paste -d, -s)

0 comments on commit b74c931

Please sign in to comment.