Skip to content

Commit ad2eba1

Browse files
Fabian Wilesalexeagle
authored andcommitted
feat(examples): upgrade rules_docker to 0.14.1
Also drop the patches we needed for older versions
1 parent 7f9bd40 commit ad2eba1

9 files changed

Lines changed: 30 additions & 54 deletions

File tree

.circleci/bazel.rc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ build --local_cpu_resources=8
1919
# Our integration tests rely on accessing public registries which can fail
2020
# Let's give all failing tests a second try to mostly paper over flakiness
2121
test --flaky_test_attempts=2
22+
23+
# Expose the SSH_AUTH_SOCK variable to integration tests that need to run git_repository repository rules
24+
# This is needed by the CircleCI git-over-ssh environment
25+
test --test_env=SSH_AUTH_SOCK

examples/BUILD.bazel

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,15 @@ example_integration_test(
153153
"@rayman1104",
154154
"@siberex",
155155
],
156-
# Breaks on Windows with `rules_docker requires a python interpreter installed. Please set
157-
# BAZEL_PYTHON, or put it on your path.`
158-
tags = ["fix-windows"],
156+
# Fails on transitive dep of rules_docker
157+
# error running 'git init C:/users/b/_bazel_b/3oe2yqkh/external/rules_cc' while working with @rules_cc:
158+
# java.io.IOException: ERROR: src/main/native/windows/process.cc(199): CreateProcessW("git" init C:/users/b/_bazel_b/3oe2yqkh/external/rules_cc): The system cannot find the file specified
159+
#
160+
# NB: even after working around that by fetching rules_cc with an http_archive we get a follow-on failure
161+
# ERROR: Analysis of target '//src:docker' failed; build aborted: no such package '@nodejs_image_base//image': Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(199): CreateProcessW("C:\users\b\_bazel_b\vanuqgg3\external\go_puller_linux\file\downloaded" -directory C:/users/b/_bazel_b/vanuqgg3/external/nodejs_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/google-appengine/debian9@sha256:c05b781371f75d1bd7a199bc83de177173cc80c98dbfb6c1ef7075757addece4): %1 is not a valid Win32 application.
162+
# (error: 193) (C:/users/b/_bazel_b/vanuqgg3/external/go_puller_linux/file/downloaded -directory
163+
# C:/users/b/_bazel_b/vanuqgg3/external/nodejs_image_base/image -os linux -os-version -os-features -architecture amd64 -variant -features -name gcr.io/google-appengine/debian9@sha256:c05b781371f75d1bd7a199bc83de177173cc80c98dbfb6c1ef7075757addece4)
164+
tags = ["no-bazelci-windows"],
159165
)
160166

161167
example_integration_test(

examples/angular/WORKSPACE

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ workspace(
1111
)
1212

1313
# These rules are built-into Bazel but we need to load them first to download more rules
14-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
1514
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1615

1716
# Fetch rules_nodejs so we can install our npm dependencies
@@ -99,10 +98,9 @@ http_archive(
9998

10099
http_archive(
101100
name = "io_bazel_rules_docker",
102-
patches = ["//:rules_docker.patch"],
103-
sha256 = "7d453450e1eb70e238eea6b31f4115607ec1200e91afea01c25f9804f37e39c8",
104-
strip_prefix = "rules_docker-0.10.0",
105-
urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.10.0.tar.gz"],
101+
sha256 = "dc97fccceacd4c6be14e800b2a00693d5e8d07f69ee187babfd04a80a9f8e250",
102+
strip_prefix = "rules_docker-0.14.1",
103+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.14.1/rules_docker-v0.14.1.tar.gz"],
106104
)
107105

108106
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
@@ -117,17 +115,21 @@ nodejs_image_repos()
117115
# Kubernetes setup, for deployment to Google Cloud #
118116
####################################################
119117

120-
git_repository(
118+
http_archive(
121119
name = "io_bazel_rules_k8s",
122-
commit = "36ae5b534cc51ab0815c9bc723760469a9f7175c",
123-
remote = "https://github.com/bazelbuild/rules_k8s.git",
124-
shallow_since = "1545317854 -0500",
120+
sha256 = "cc75cf0d86312e1327d226e980efd3599704e01099b58b3c2fc4efe5e321fcd9",
121+
strip_prefix = "rules_k8s-0.3.1",
122+
urls = ["https://github.com/bazelbuild/rules_k8s/releases/download/v0.3.1/rules_k8s-v0.3.1.tar.gz"],
125123
)
126124

127125
load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_defaults", "k8s_repositories")
128126

129127
k8s_repositories()
130128

129+
load("@io_bazel_rules_k8s//k8s:k8s_go_deps.bzl", k8s_go_deps = "deps")
130+
131+
k8s_go_deps()
132+
131133
k8s_defaults(
132134
# This creates a rule called "k8s_deploy" that we can call later
133135
name = "k8s_deploy",

examples/angular/rules_docker.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/angular/src/BUILD.bazel

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,10 @@ history_server(
223223

224224
nodejs_image(
225225
name = "nodejs_image",
226-
data = [":prodapp"],
227-
entry_point = "@npm//:node_modules/history-server/modules/cli.js",
228-
node_modules = "@npm//:node_modules",
226+
binary = ":prodserver",
229227
# Actions created by this rule are I/O-bound,
230228
# so there is no benefit to running them remotely
231229
tags = ["local"],
232-
templated_args = ["src/prodapp"],
233230
)
234231

235232
container_image(
@@ -238,7 +235,6 @@ container_image(
238235
# Actions created by this rule are I/O-bound,
239236
# so there is no benefit to running them remotely
240237
tags = ["local"],
241-
workdir = "/app/src/nodejs_image.binary.runfiles/examples_angular",
242238
)
243239

244240
ts_library(

examples/nestjs/WORKSPACE

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ install_bazel_dependencies()
3939

4040
http_archive(
4141
name = "io_bazel_rules_docker",
42-
patches = ["//:rules_docker.patch"],
43-
sha256 = "7d453450e1eb70e238eea6b31f4115607ec1200e91afea01c25f9804f37e39c8",
44-
strip_prefix = "rules_docker-0.10.0",
45-
urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.10.0.tar.gz"],
42+
sha256 = "dc97fccceacd4c6be14e800b2a00693d5e8d07f69ee187babfd04a80a9f8e250",
43+
strip_prefix = "rules_docker-0.14.1",
44+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.14.1/rules_docker-v0.14.1.tar.gz"],
4645
)
4746

4847
load(

examples/nestjs/rules_docker.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/nestjs/src/BUILD.bazel

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,5 @@ jasmine_node_test(
7373
# bazel build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //src:docker
7474
nodejs_image(
7575
name = "docker",
76-
data = [
77-
":app",
78-
],
79-
entry_point = ":main.ts",
80-
# TODO: switch to fine grained deps -- see bazelbuild/rules_docker#1000
81-
# and add test for docker image
82-
node_modules = "@npm//:node_modules",
76+
binary = ":server",
8377
)

internal/bazel_integration_test/test_runner.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ for (const bazelCommand of config.bazelCommands) {
368368
delete env[key];
369369
}
370370
env['PWD'] = workspaceRoot;
371+
env['HOME'] = require('os').homedir();
371372
log_verbose(JSON.stringify(env, null, 2));
372373
log(`running 'bazel ${bazelArgs.join(' ')}' in ${workspaceRoot}`);
373374
spawnedProcess = spawnSync(bazelBinary, bazelArgs, {env, cwd: workspaceRoot, stdio: 'inherit'});

0 commit comments

Comments
 (0)