Merge pull request #65996 from shyamjvs/add-workspace-to-kubemark-bazel

Automatic merge from submit-queue (batch tested with PRs 65993, 65986, 65351, 65996, 65985). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Create WORKSPACE file before running bazel in kubemark

As the canary run after https://github.com/kubernetes/test-infra/pull/8616 failed with:

```
I0709 19:06:05.281] Extracting Bazel installation...
I0709 19:06:13.369] ERROR: The 'run' command is only supported from within a workspace.
W0709 19:06:13.469] Attempt 1 failed to bazel run //cluster/images/kubemark:push. Retrying.
```

Ref https://github.com/kubernetes/test-infra/issues/8348

/cc @krzyzacy 

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-07-09 20:39:14 -07:00 committed by GitHub
commit cd32999f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -194,6 +194,7 @@ function create-and-upload-hollow-node-image {
KUBEMARK_IMAGE_REGISTRY="${KUBEMARK_IMAGE_REGISTRY:-${CONTAINER_REGISTRY}/${PROJECT}}"
if [[ "${KUBEMARK_BAZEL_BUILD:-}" =~ ^[yY]$ ]]; then
# Build+push the image through bazel.
touch WORKSPACE # Needed for bazel.
build_cmd=("bazel" "run" "//cluster/images/kubemark:push" "--define" "REGISTRY=${KUBEMARK_IMAGE_REGISTRY}" "--define" "IMAGE_TAG=${KUBEMARK_IMAGE_TAG}")
run-cmd-with-retries "${build_cmd[@]}"
else