Skip to content

Commit

Permalink
Update release scripts to support experimental releases (#17086)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
acdlite committed Oct 14, 2019
1 parent d364d85 commit a8c6a1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions scripts/release/prepare-stable.js
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
10 changes: 7 additions & 3 deletions scripts/release/utils.js
Expand Up @@ -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);
}
Expand Down

0 comments on commit a8c6a1b

Please sign in to comment.