Skip to content

Commit

Permalink
Updated release scripts to work around GitHub / Circle CI integration…
Browse files Browse the repository at this point in the history
… problems (#21434)
  • Loading branch information
Brian Vaughn authored May 7, 2021
1 parent 0a8fefc commit e468072
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@
const clear = require('clear');
const {join, relative} = require('path');
const theme = require('../theme');
const {getCommitFromCurrentBuild} = require('../utils');

module.exports = async () => {
module.exports = async ({build}) => {
const commandPath = relative(
process.env.PWD,
join(__dirname, '../download-experimental-build.js')
);

clear();

const commit = await getCommitFromCurrentBuild();

const message = theme`
{caution An experimental build has been downloaded!}
You can download this build again by running:
{path ${commandPath}} --commit={commit ${commit}}
{path ${commandPath}} --build={build ${build}}
`;

console.log(message.replace(/\n +/g, '\n').trim());
Expand Down
4 changes: 0 additions & 4 deletions scripts/release/download-experimental-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ const run = async () => {
try {
addDefaultParamValue('-r', '--releaseChannel', 'experimental');

// Default to the latest commit in master.
// If this is a reproducible build (e.g. Firefox tester) a --commit will be specified.
addDefaultParamValue(null, '--commit', 'master');

const params = await parseParams();
params.cwd = join(__dirname, '..', '..');
params.packages = await getPublicPackages(true);
Expand Down
8 changes: 7 additions & 1 deletion scripts/release/shared-commands/download-build-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ const run = async ({build, cwd, releaseChannel}) => {
};

module.exports = async ({build, commit, cwd, releaseChannel}) => {
let buildLabel;
if (commit !== null) {
buildLabel = theme`commit {commit ${commit}} (build {build ${build}})`;
} else {
buildLabel = theme`build {build ${build}}`;
}
return logPromise(
run({build, cwd, releaseChannel}),
theme`Downloading artifacts from Circle CI for commit {commit ${commit}} (build {build ${build}})`
theme`Downloading artifacts from Circle CI for ${buildLabel}`
);
};
File renamed without changes.
23 changes: 19 additions & 4 deletions scripts/release/shared-commands/parse-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
'use strict';

const commandLineArgs = require('command-line-args');
const getBuildIdForCommit = require('../get-build-id-for-commit');
const getBuildIdForCommit = require('./get-build-id-for-commit');
const theme = require('../theme');
const {logPromise} = require('../utils');

const paramDefinitions = [
{
name: 'build',
type: String,
description:
'CI build ID corresponding to the "process_artifacts_combined" task.',
defaultValue: null,
},
{
name: 'commit',
type: String,
Expand Down Expand Up @@ -39,13 +47,20 @@ module.exports = async () => {
process.exit(1);
}

if (params.commit === null) {
console.error(theme.error`No --commit param specified.`);
if (params.build === null && params.commit === null) {
console.error(
theme.error`Either a --commit or --build param must be specified.`
);
process.exit(1);
}

try {
params.build = await getBuildIdForCommit(params.commit);
if (params.build === null) {
params.build = await logPromise(
getBuildIdForCommit(params.commit),
theme`Getting build ID for commit "${params.commit}"`
);
}
} catch (error) {
console.error(theme.error(error));
process.exit(1);
Expand Down

0 comments on commit e468072

Please sign in to comment.