Skip to content

Commit d3b1760

Browse files
committed
Remove dependency on build artifacts mirror
This reverts commit #24106. There was a regression in CircleCI's artifacts API recently where you could no longer access artifacts without an authorization token. This broke our size reporting CI job because we can't use an authorization token on external PRs without potentially leaking it. As a temporary workaround, I changed the size reporting job to use a public mirror of our build artifacts. The CircleCI API has since been fixed to no longer require authorization, so we can revert the workaround.
1 parent 357a613 commit d3b1760

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

.circleci/config.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,22 @@ jobs:
127127
environment: *environment
128128
steps:
129129
- checkout
130+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
131+
- *restore_node_modules
130132
- run:
131133
name: Download artifacts for base revision
132-
# TODO: We can't use the normal download-build script here because it
133-
# depends on the CircleCI artifacts API, which was recently changed to
134-
# require authorization. And we can't pass an authorization token
135-
# without possibly leaking it to the public, since we run sizebot on
136-
# PRs from external contributors. As a temporary workaround, this job
137-
# will pull the artifacts from a public mirror that I set up. But we
138-
# should find some other solution so we don't have to maintain
139-
# the mirror.
140134
command: |
141-
curl -L --retry 60 --retry-delay 10 --retry-max-time 600 https://react-builds.vercel.app/api/commits/$(git merge-base HEAD origin/main)/artifacts/build.tgz | tar -xz
142-
mv ./build ./base-build
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)
138+
mv ./build ./base-build
139+
- run:
140+
# TODO: The `download-experimental-build` script copies the npm
141+
# packages into the `node_modules` directory. This is a historical
142+
# quirk of how the release script works. Let's pretend they
143+
# don't exist.
144+
name: Delete extraneous files
145+
command: rm -rf ./base-build/node_modules
143146

144147
- persist_to_workspace:
145148
root: .

scripts/release/shared-commands/download-build-artifacts.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ const {getArtifactsList, logPromise} = require('../utils');
99
const theme = require('../theme');
1010

1111
const run = async ({build, cwd, releaseChannel}) => {
12-
const CIRCLE_TOKEN = process.env.CIRCLE_CI_API_TOKEN;
13-
if (!CIRCLE_TOKEN) {
14-
console.error(
15-
theme.error('Missing required environment variable: CIRCLE_CI_API_TOKEN')
16-
);
17-
process.exit(1);
18-
}
19-
2012
const artifacts = await getArtifactsList(build);
2113
const buildArtifacts = artifacts.find(entry =>
2214
entry.path.endsWith('build.tgz')
@@ -32,7 +24,7 @@ const run = async ({build, cwd, releaseChannel}) => {
3224
// Download and extract artifact
3325
await exec(`rm -rf ./build`, {cwd});
3426
await exec(
35-
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} -H "Circle-Token: ${CIRCLE_TOKEN}" | tar -xvz`,
27+
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
3628
{
3729
cwd,
3830
}

0 commit comments

Comments
 (0)