From a8c6a1b34e93f88f285a1a042bf473f39a30c886 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 14 Oct 2019 14:15:23 -0700 Subject: [PATCH] Update release scripts to support experimental releases (#17086) * Download correct artifacts for release channel Experimental builds should pull artifacts from the `process_artifacts_experimental` job. I think instead of two separate CI workflows, a better approach might be to build stable artifacts to the `build` directory and the experimental artifacts to a `build_experimental` directory, and generate both within the same workflow. This would take some work since lots of things assume the output directory is `build`, but something to consider in the future. * Prevent experimental promotion to stable Adds a check to the `prepare-stable` script to prevent experimental builds from being published using stable semver versions. --- scripts/release/prepare-stable.js | 8 ++++++++ scripts/release/utils.js | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/release/prepare-stable.js b/scripts/release/prepare-stable.js index 04d507fdadfe..ef03ee8c5b26 100755 --- a/scripts/release/prepare-stable.js +++ b/scripts/release/prepare-stable.js @@ -14,6 +14,7 @@ const printPrereleaseSummary = require('./shared-commands/print-prerelease-summa const testPackagingFixture = require('./shared-commands/test-packaging-fixture'); const testTracingFixture = require('./shared-commands/test-tracing-fixture'); const updateStableVersionNumbers = require('./prepare-stable-commands/update-stable-version-numbers'); +const theme = require('./theme'); const run = async () => { try { @@ -30,6 +31,13 @@ const run = async () => { params.version = await getLatestCanaryVersion(); } + if (params.version.includes('experimental')) { + console.error( + theme.error`Cannot promote an experimental build to stable.` + ); + process.exit(1); + } + await checkOutPackages(params); await guessStableVersionNumbers(params, versionsMap); await confirmStableVersionNumbers(params, versionsMap); diff --git a/scripts/release/utils.js b/scripts/release/utils.js index 816f0fdfc285..b04d46ba157d 100644 --- a/scripts/release/utils.js +++ b/scripts/release/utils.js @@ -51,18 +51,22 @@ const getArtifactsList = async buildID => { ); process.exit(1); } - + const artifactsJobName = buildMetadata.workflows.job_name.endsWith( + '_experimental' + ) + ? 'process_artifacts_experimental' + : 'process_artifacts'; const workflowID = buildMetadata.workflows.workflow_id; const workflowMetadataURL = `https://circleci.com/api/v2/workflow/${workflowID}/jobs?circle-token=${ process.env.CIRCLE_CI_API_TOKEN }`; const workflowMetadata = await http.get(workflowMetadataURL, true); const job = workflowMetadata.items.find( - ({name}) => name === 'process_artifacts' + ({name}) => name === artifactsJobName ); if (!job || !job.job_number) { console.log( - theme`{error Could not find "process_artifacts" job for workflow ${workflowID}.}` + theme`{error Could not find "${artifactsJobName}" job for workflow ${workflowID}.}` ); process.exit(1); }