豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 86168ee

Browse files
committed
fix(circleci-orb): support non-existent bazelrc paths
1 parent 21646c0 commit 86168ee

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 2.1
55
orbs:
66
buildalert: oss-tools/buildalert@0.1.0
77
win: circleci/windows@2.2.0
8-
devinfra: angular/dev-infra@1.0.6
8+
devinfra: angular/dev-infra@1.0.7
99

1010
# **Note**: When updating the beginning of the cache key, also update the cache key to match
1111
# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching.
@@ -79,9 +79,9 @@ commands:
7979
setup_bazel_config:
8080
description: 'Setting up Bazel configuration for CI'
8181
steps:
82-
- run: echo "import %workspace%/.circleci/linux-bazel.rc" >> ./.bazelrc
82+
- run: echo "import %workspace%/.circleci/linux-bazel.rc" >> ./.bazelrc.user
8383
- devinfra/setup-bazel-remote-exec:
84-
bazelrc: .circleci/linux-bazel.rc
84+
bazelrc: ./.bazelrc.user
8585

8686
prepare_and_store_test_results:
8787
description: 'Prepare and upload test results'

circleci-orb/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
22

33
ORB_NAME = "angular/dev-infra"
44

5-
ORB_VERSION = "1.0.6"
5+
ORB_VERSION = "1.0.7"
66

77
nodejs_binary(
88
name = "pack_orb_script",

circleci-orb/scripts/setup-bazel-remote-exec/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,20 @@ async function main(bazelRcPath: string | undefined) {
2828
await fs.promises.writeFile(destPath, dec, 'utf8');
2929

3030
if (bazelRcPath) {
31-
let content = await fs.promises.readFile(bazelRcPath, 'utf8');
31+
let content = await readFileGracefully(bazelRcPath);
3232
content += '\nbuild --config=remote';
3333
await fs.promises.writeFile(bazelRcPath, content, 'utf8');
3434
}
3535
}
3636

37+
async function readFileGracefully(filePath: string): Promise<string> {
38+
try {
39+
return await fs.promises.readFile(filePath, 'utf8');
40+
} catch {
41+
return '';
42+
}
43+
}
44+
3745
main(process.env.BAZELRC_PATH).catch((e) => {
3846
console.error(e);
3947
process.exitCode = 1;

0 commit comments

Comments
 (0)