From 93782cfed223960abbe6c46122f96748f6e57cba Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 5 May 2021 10:42:22 -0400 Subject: [PATCH] Updated release scripts to work around GitHub / Circle CI integration problem --- .../print-summary.js | 7 ++---- .../release/download-experimental-build.js | 4 ---- .../download-build-artifacts.js | 8 ++++++- .../get-build-id-for-commit.js | 0 .../release/shared-commands/parse-params.js | 23 +++++++++++++++---- 5 files changed, 28 insertions(+), 14 deletions(-) rename scripts/release/{ => shared-commands}/get-build-id-for-commit.js (100%) diff --git a/scripts/release/download-experimental-build-commands/print-summary.js b/scripts/release/download-experimental-build-commands/print-summary.js index 21e97c0dd504a..6e7454a5a86a9 100644 --- a/scripts/release/download-experimental-build-commands/print-summary.js +++ b/scripts/release/download-experimental-build-commands/print-summary.js @@ -5,9 +5,8 @@ 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') @@ -15,13 +14,11 @@ module.exports = async () => { 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()); diff --git a/scripts/release/download-experimental-build.js b/scripts/release/download-experimental-build.js index 7f8b11dba122d..c57ec4f1bf664 100755 --- a/scripts/release/download-experimental-build.js +++ b/scripts/release/download-experimental-build.js @@ -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); diff --git a/scripts/release/shared-commands/download-build-artifacts.js b/scripts/release/shared-commands/download-build-artifacts.js index cca62baabdefe..f09b0f2c2809e 100644 --- a/scripts/release/shared-commands/download-build-artifacts.js +++ b/scripts/release/shared-commands/download-build-artifacts.js @@ -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}` ); }; diff --git a/scripts/release/get-build-id-for-commit.js b/scripts/release/shared-commands/get-build-id-for-commit.js similarity index 100% rename from scripts/release/get-build-id-for-commit.js rename to scripts/release/shared-commands/get-build-id-for-commit.js diff --git a/scripts/release/shared-commands/parse-params.js b/scripts/release/shared-commands/parse-params.js index 5baec235b661b..b632d06033683 100644 --- a/scripts/release/shared-commands/parse-params.js +++ b/scripts/release/shared-commands/parse-params.js @@ -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, @@ -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);