Skip to content
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

Updated release scripts to work around GitHub / Circle CI integration problems #21434

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sense for e.g. Firefox reviewer to have to re-run the commit-to-build check when we already have the build ID.

`;

console.log(message.replace(/\n +/g, '\n').trim());
Expand Down
4 changes: 0 additions & 4 deletions scripts/release/download-experimental-build.js
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
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}`
);
};
23 changes: 19 additions & 4 deletions scripts/release/shared-commands/parse-params.js
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