Skip to content

Remove dependency on build artifacts mirror #24575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,22 @@ jobs:
environment: *environment
steps:
- checkout
- run: yarn workspaces info | head -n -1 > workspace_info.txt
- *restore_node_modules
- run:
name: Download artifacts for base revision
# TODO: We can't use the normal download-build script here because it
# depends on the CircleCI artifacts API, which was recently changed to
# require authorization. And we can't pass an authorization token
# without possibly leaking it to the public, since we run sizebot on
# PRs from external contributors. As a temporary workaround, this job
# will pull the artifacts from a public mirror that I set up. But we
# should find some other solution so we don't have to maintain
# the mirror.
command: |
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
mv ./build ./base-build
git fetch origin main
cd ./scripts/release && yarn && cd ../../
scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main)
mv ./build ./base-build
- run:
# TODO: The `download-experimental-build` script copies the npm
# packages into the `node_modules` directory. This is a historical
# quirk of how the release script works. Let's pretend they
# don't exist.
name: Delete extraneous files
command: rm -rf ./base-build/node_modules

- persist_to_workspace:
root: .
Expand Down
10 changes: 1 addition & 9 deletions scripts/release/shared-commands/download-build-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ const {getArtifactsList, logPromise} = require('../utils');
const theme = require('../theme');

const run = async ({build, cwd, releaseChannel}) => {
const CIRCLE_TOKEN = process.env.CIRCLE_CI_API_TOKEN;
if (!CIRCLE_TOKEN) {
console.error(
theme.error('Missing required environment variable: CIRCLE_CI_API_TOKEN')
);
process.exit(1);
}

const artifacts = await getArtifactsList(build);
const buildArtifacts = artifacts.find(entry =>
entry.path.endsWith('build.tgz')
Expand All @@ -32,7 +24,7 @@ const run = async ({build, cwd, releaseChannel}) => {
// Download and extract artifact
await exec(`rm -rf ./build`, {cwd});
await exec(
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} -H "Circle-Token: ${CIRCLE_TOKEN}" | tar -xvz`,
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
{
cwd,
}
Expand Down