@samitouri / QOS-React-2 / commits / 7a5b8227c7

Allow aritfacts download even if CI is broken (#24666)

* Allow aritfacts download even if CI is broken Adds an option to the download script to disable the CI check and continue downloading the artifacts even if CI is broken. I often rely on this to debug broken build artifacts. I was thinking the sizebot should also use this when downloading the base artifacts from main, since for the purposes of size tracking, it really doesn't matter whether the base commit is broken. * Sizebot should work even if base rev is broken Sizebot works by downloading the build artifacts for the base revision and comparing the fize sizes, but the download script will fail if the base revision has a failing CI job. This happens more often than it should because of flaky cron jobs, but even when it does, we shouldn't let it affect the sizebot — for the purposes of tracking sizes, it doesn't really matter whether the base revision is broken.

Andrew Clark committed Jun 2, 2022 at 21:55 UTC 7a5b8227c7d67aefe62f015cf0e961e28075d897
3 files changed +13 -6
.circleci/config.yml
+3 -3
@@ -134,7 +134,7 @@ jobs:
134 command: |
135 git fetch origin main
136 cd ./scripts/release && yarn && cd ../../
137 - scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main)
137 + scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI
138 mv ./build ./base-build
139 - run:
140 # TODO: The `download-experimental-build` script copies the npm
@@ -570,7 +570,7 @@ workflows:
570 - "16.0"
571 - "16.5" # schedule package
572 - "16.8" # hooks
573 - - "17.0"
573 + - "17.0"
574 - "18.0"
575 - run_devtools_e2e_tests_for_versions:
576 requires:
@@ -581,7 +581,7 @@ workflows:
581 - "16.0"
582 - "16.5" # schedule package
583 - "16.8" # hooks
584 - - "17.0"
584 + - "17.0"
585 - "18.0"
586
587 # Used to publish a prerelease manually via the command line
scripts/release/shared-commands/get-build-id-for-commit.js
+2 -2
@@ -15,7 +15,7 @@ function scrapeBuildIDFromStatus(status) {
15 return /\/facebook\/react\/([0-9]+)/.exec(status.target_url)[1];
16 }
17
18 -async function getBuildIdForCommit(sha) {
18 +async function getBuildIdForCommit(sha, allowBrokenCI = false) {
19 const retryLimit = Date.now() + RETRY_TIMEOUT;
20 retry: while (true) {
21 const statusesResponse = await fetch(
@@ -34,7 +34,7 @@ async function getBuildIdForCommit(sha) {
34 }
35
36 const {statuses, state} = await statusesResponse.json();
37 - if (state === 'failure') {
37 + if (!allowBrokenCI && state === 'failure') {
38 throw new Error(`Base commit is broken: ${sha}`);
39 }
40 for (let i = 0; i < statuses.length; i++) {
scripts/release/shared-commands/parse-params.js
+8 -1
@@ -34,6 +34,13 @@ const paramDefinitions = [
34 type: String,
35 description: 'Release channel (stable, experimental, or latest)',
36 },
37 + {
38 + name: 'allowBrokenCI',
39 + type: Boolean,
40 + description:
41 + 'Continue even if CI is failing. Useful if you need to debug a broken build.',
42 + defaultValue: false,
43 + },
44 ];
45
46 module.exports = async () => {
@@ -61,7 +68,7 @@ module.exports = async () => {
68 try {
69 if (params.build === null) {
70 params.build = await logPromise(
64 - getBuildIdForCommit(params.commit),
71 + getBuildIdForCommit(params.commit, params.allowBrokenCI),
72 theme`Getting build ID for commit "${params.commit}"`
73 );
74 }