2020-03-20 20:28:31 +00:00
|
|
|
if (!process.env.CI) require('dotenv-safe').load();
|
2018-07-11 18:02:03 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const assert = require('assert');
|
2021-08-12 17:34:49 +00:00
|
|
|
const got = require('got');
|
2019-10-31 18:25:11 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds';
|
|
|
|
const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline';
|
|
|
|
const VSTS_URL = 'https://github.visualstudio.com/electron/_apis/build';
|
2020-07-17 16:08:44 +00:00
|
|
|
const DEVOPS_URL = 'https://dev.azure.com/electron-ci/electron/_apis/build';
|
2020-03-20 20:28:31 +00:00
|
|
|
const CIRCLECI_WAIT_TIME = process.env.CIRCLECI_WAIT_TIME || 30000;
|
2017-11-02 07:26:37 +00:00
|
|
|
|
2018-07-09 19:29:44 +00:00
|
|
|
const appVeyorJobs = {
|
2019-05-23 20:54:34 +00:00
|
|
|
'electron-x64': 'electron-x64-release',
|
2019-09-04 18:24:46 +00:00
|
|
|
'electron-ia32': 'electron-ia32-release',
|
|
|
|
'electron-woa': 'electron-woa-release'
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-07-09 19:29:44 +00:00
|
|
|
|
2020-07-21 11:55:00 +00:00
|
|
|
const circleCIPublishWorkflows = [
|
|
|
|
'linux-publish',
|
|
|
|
'macos-publish'
|
|
|
|
];
|
|
|
|
|
2021-06-07 14:17:27 +00:00
|
|
|
const circleCIPublishIndividualArches = {
|
|
|
|
'macos-publish': ['osx-x64', 'mas-x64', 'osx-arm64', 'mas-arm64'],
|
|
|
|
'linux-publish': ['arm', 'arm64', 'ia32', 'x64']
|
|
|
|
};
|
2020-02-11 20:42:37 +00:00
|
|
|
|
2019-01-22 21:14:01 +00:00
|
|
|
const vstsArmJobs = [
|
|
|
|
'electron-arm-testing',
|
2021-01-21 23:36:52 +00:00
|
|
|
'electron-osx-arm64-testing',
|
|
|
|
'electron-mas-arm64-testing',
|
2019-08-21 21:37:30 +00:00
|
|
|
'electron-arm64-testing',
|
|
|
|
'electron-woa-testing'
|
2020-03-20 20:28:31 +00:00
|
|
|
];
|
2018-10-04 16:01:16 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
let jobRequestedCount = 0;
|
2019-09-04 18:24:46 +00:00
|
|
|
|
2021-08-12 17:34:49 +00:00
|
|
|
async function makeRequest ({ auth, url, headers, body, method }) {
|
2021-08-13 17:37:30 +00:00
|
|
|
const clonedHeaders = {
|
|
|
|
...(headers || {})
|
|
|
|
};
|
|
|
|
if (auth && auth.bearer) {
|
|
|
|
clonedHeaders.Authorization = `Bearer ${auth.bearer}`;
|
|
|
|
}
|
2021-08-12 17:34:49 +00:00
|
|
|
const response = await got(url, {
|
2021-08-13 17:37:30 +00:00
|
|
|
headers: clonedHeaders,
|
2021-08-12 17:34:49 +00:00
|
|
|
body,
|
|
|
|
method,
|
2021-08-13 17:40:20 +00:00
|
|
|
auth: auth && (auth.username || auth.password) ? `${auth.username}:${auth.password}` : undefined
|
2020-03-20 20:28:31 +00:00
|
|
|
});
|
2021-08-13 17:25:17 +00:00
|
|
|
if (response.statusCode < 200 || response.statusCode >= 300) {
|
2021-08-12 17:34:49 +00:00
|
|
|
console.error('Error: ', `(status ${response.statusCode})`, response.body);
|
|
|
|
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
|
|
|
|
}
|
|
|
|
return JSON.parse(response.body);
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
|
2021-06-07 14:17:27 +00:00
|
|
|
async function circleCIcall (targetBranch, workflowName, options) {
|
|
|
|
console.log(`Triggering CircleCI to run build job: ${workflowName} on branch: ${targetBranch} with release flag.`);
|
2018-10-02 01:56:31 +00:00
|
|
|
const buildRequest = {
|
2020-03-20 15:12:18 +00:00
|
|
|
branch: targetBranch,
|
2021-11-29 23:09:07 +00:00
|
|
|
parameters: {}
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2019-09-17 18:48:02 +00:00
|
|
|
if (options.ghRelease) {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildRequest.parameters['upload-to-s3'] = '0';
|
2019-09-17 18:48:02 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildRequest.parameters['upload-to-s3'] = '1';
|
2018-05-14 21:21:51 +00:00
|
|
|
}
|
2021-06-07 14:17:27 +00:00
|
|
|
buildRequest.parameters[`run-${workflowName}`] = true;
|
|
|
|
if (options.arch) {
|
|
|
|
const validArches = circleCIPublishIndividualArches[workflowName];
|
|
|
|
assert(validArches.includes(options.arch), `Unknown CircleCI architecture "${options.arch}". Valid values are ${JSON.stringify(validArches)}`);
|
|
|
|
buildRequest.parameters['macos-publish-arch-limit'] = options.arch;
|
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
jobRequestedCount++;
|
2019-09-17 18:48:02 +00:00
|
|
|
// The logic below expects that the CircleCI workflows for releases each
|
|
|
|
// contain only one job in order to maintain compatibility with sudowoodo.
|
|
|
|
// If the workflows are changed in the CircleCI config.yml, this logic will
|
|
|
|
// also need to be changed as well as possibly changing sudowoodo.
|
|
|
|
try {
|
2020-03-20 20:28:31 +00:00
|
|
|
const circleResponse = await circleCIRequest(CIRCLECI_PIPELINE_URL, 'POST', buildRequest);
|
2021-06-07 14:17:27 +00:00
|
|
|
console.log(`CircleCI release build pipeline ${circleResponse.id} for ${workflowName} triggered.`);
|
2020-03-20 20:28:31 +00:00
|
|
|
const workflowId = await getCircleCIWorkflowId(circleResponse.id);
|
2019-09-17 18:48:02 +00:00
|
|
|
if (workflowId === -1) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return;
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
const workFlowUrl = `https://circleci.com/workflow-run/${workflowId}`;
|
2020-02-11 20:42:37 +00:00
|
|
|
if (options.runningPublishWorkflows) {
|
2021-06-07 14:17:27 +00:00
|
|
|
console.log(`CircleCI release workflow request for ${workflowName} successful. Check ${workFlowUrl} for status.`);
|
2020-02-11 20:42:37 +00:00
|
|
|
} else {
|
2021-06-07 14:17:27 +00:00
|
|
|
console.log(`CircleCI release build workflow running at https://circleci.com/workflow-run/${workflowId} for ${workflowName}.`);
|
2020-03-20 20:28:31 +00:00
|
|
|
const jobNumber = await getCircleCIJobNumber(workflowId);
|
2020-02-11 20:42:37 +00:00
|
|
|
if (jobNumber === -1) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return;
|
2020-02-11 20:42:37 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
const jobUrl = `https://circleci.com/gh/electron/electron/${jobNumber}`;
|
2021-06-07 14:17:27 +00:00
|
|
|
console.log(`CircleCI release build request for ${workflowName} successful. Check ${jobUrl} for status.`);
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
|
|
|
} catch (err) {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('Error calling CircleCI: ', err);
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getCircleCIWorkflowId (pipelineId) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const pipelineInfoUrl = `https://circleci.com/api/v2/pipeline/${pipelineId}`;
|
|
|
|
let workflowId = 0;
|
2019-11-01 15:47:45 +00:00
|
|
|
while (workflowId === 0) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const pipelineInfo = await circleCIRequest(pipelineInfoUrl, 'GET');
|
2019-09-17 18:48:02 +00:00
|
|
|
switch (pipelineInfo.state) {
|
|
|
|
case 'created': {
|
2020-03-20 20:28:31 +00:00
|
|
|
const workflows = await circleCIRequest(`${pipelineInfoUrl}/workflow`, 'GET');
|
2021-11-30 17:17:04 +00:00
|
|
|
// The logic below expects two workflow.items: publish [0] & setup [1]
|
|
|
|
if (workflows.items.length === 2) {
|
|
|
|
workflowId = workflows.items.find(item => item.name.includes('publish')).id;
|
2020-03-20 20:28:31 +00:00
|
|
|
break;
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('Unxpected number of workflows, response was:', pipelineInfo);
|
|
|
|
workflowId = -1;
|
|
|
|
break;
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
|
|
|
case 'error': {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('Error retrieving workflows, response was:', pipelineInfo);
|
|
|
|
workflowId = -1;
|
|
|
|
break;
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
await new Promise(resolve => setTimeout(resolve, CIRCLECI_WAIT_TIME));
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return workflowId;
|
2019-09-17 18:48:02 +00:00
|
|
|
}
|
|
|
|
|
2019-10-08 21:45:07 +00:00
|
|
|
async function getCircleCIJobNumber (workflowId) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const jobInfoUrl = `https://circleci.com/api/v2/workflow/${workflowId}/job`;
|
|
|
|
let jobNumber = 0;
|
2019-11-01 15:47:45 +00:00
|
|
|
while (jobNumber === 0) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const jobInfo = await circleCIRequest(jobInfoUrl, 'GET');
|
2019-10-08 21:45:07 +00:00
|
|
|
if (!jobInfo.items) {
|
2020-03-20 20:28:31 +00:00
|
|
|
continue;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
|
|
|
if (jobInfo.items.length !== 1) {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('Unxpected number of jobs, response was:', jobInfo);
|
|
|
|
jobNumber = -1;
|
|
|
|
break;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (jobInfo.items[0].status) {
|
|
|
|
case 'not_running':
|
|
|
|
case 'queued':
|
|
|
|
case 'running': {
|
|
|
|
if (jobInfo.items[0].job_number && !isNaN(jobInfo.items[0].job_number)) {
|
2020-03-20 20:28:31 +00:00
|
|
|
jobNumber = jobInfo.items[0].job_number;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
break;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
2019-11-01 15:47:45 +00:00
|
|
|
case 'canceled':
|
|
|
|
case 'error':
|
|
|
|
case 'infrastructure_fail':
|
|
|
|
case 'timedout':
|
|
|
|
case 'not_run':
|
|
|
|
case 'failed': {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log(`Error job returned a status of ${jobInfo.items[0].status}, response was:`, jobInfo);
|
|
|
|
jobNumber = -1;
|
|
|
|
break;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
await new Promise(resolve => setTimeout(resolve, CIRCLECI_WAIT_TIME));
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return jobNumber;
|
2019-10-08 21:45:07 +00:00
|
|
|
}
|
|
|
|
|
2019-09-17 18:48:02 +00:00
|
|
|
async function circleCIRequest (url, method, requestBody) {
|
|
|
|
return makeRequest({
|
|
|
|
auth: {
|
|
|
|
username: process.env.CIRCLE_TOKEN,
|
|
|
|
password: ''
|
|
|
|
},
|
|
|
|
method,
|
|
|
|
url,
|
2017-11-03 06:51:40 +00:00
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
2020-03-20 15:12:18 +00:00
|
|
|
Accept: 'application/json'
|
2017-11-03 06:51:40 +00:00
|
|
|
},
|
2019-09-17 18:48:02 +00:00
|
|
|
body: requestBody ? JSON.stringify(requestBody) : null
|
2017-11-16 21:04:50 +00:00
|
|
|
}, true).catch(err => {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('Error calling CircleCI:', err);
|
|
|
|
});
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 17:57:47 +00:00
|
|
|
function buildAppVeyor (targetBranch, options) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const validJobs = Object.keys(appVeyorJobs);
|
2018-07-09 19:29:44 +00:00
|
|
|
if (options.job) {
|
2020-03-20 20:28:31 +00:00
|
|
|
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
|
|
|
|
callAppVeyor(targetBranch, options.job, options);
|
2018-07-09 19:29:44 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
validJobs.forEach((job) => callAppVeyor(targetBranch, job, options));
|
2018-07-09 19:29:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function callAppVeyor (targetBranch, job, options) {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log(`Triggering AppVeyor to run build job: ${job} on branch: ${targetBranch} with release flag.`);
|
2018-09-27 05:38:06 +00:00
|
|
|
const environmentVariables = {
|
2020-03-30 19:46:42 +00:00
|
|
|
ELECTRON_RELEASE: 1,
|
|
|
|
APPVEYOR_BUILD_WORKER_CLOUD: 'libcc-20'
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2017-11-16 21:04:50 +00:00
|
|
|
|
2018-09-27 05:38:06 +00:00
|
|
|
if (!options.ghRelease) {
|
2020-03-20 20:28:31 +00:00
|
|
|
environmentVariables.UPLOAD_TO_S3 = 1;
|
2018-05-14 21:21:51 +00:00
|
|
|
}
|
|
|
|
|
2017-11-16 21:04:50 +00:00
|
|
|
const requestOpts = {
|
2019-10-31 18:25:11 +00:00
|
|
|
url: BUILD_APPVEYOR_URL,
|
2017-11-16 21:04:50 +00:00
|
|
|
auth: {
|
2019-05-23 20:54:34 +00:00
|
|
|
bearer: process.env.APPVEYOR_CLOUD_TOKEN
|
2017-11-16 21:04:50 +00:00
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2017-11-03 06:51:40 +00:00
|
|
|
body: JSON.stringify({
|
2019-05-23 20:54:34 +00:00
|
|
|
accountName: 'electron-bot',
|
2018-07-09 19:29:44 +00:00
|
|
|
projectSlug: appVeyorJobs[job],
|
2017-11-16 21:04:50 +00:00
|
|
|
branch: targetBranch,
|
2021-07-01 01:17:59 +00:00
|
|
|
commitId: options.commit || undefined,
|
2017-11-16 21:04:50 +00:00
|
|
|
environmentVariables
|
|
|
|
}),
|
|
|
|
method: 'POST'
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
|
|
|
jobRequestedCount++;
|
2021-04-13 07:37:23 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const { version } = await makeRequest(requestOpts, true);
|
|
|
|
const buildUrl = `https://ci.appveyor.com/project/electron-bot/${appVeyorJobs[job]}/build/${version}`;
|
|
|
|
console.log(`AppVeyor release build request for ${job} successful. Check build status at ${buildUrl}`);
|
|
|
|
} catch (err) {
|
|
|
|
console.log('Could not call AppVeyor: ', err);
|
|
|
|
}
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 17:57:47 +00:00
|
|
|
function buildCircleCI (targetBranch, options) {
|
2018-05-14 21:21:51 +00:00
|
|
|
if (options.job) {
|
2021-06-07 14:17:27 +00:00
|
|
|
assert(circleCIPublishWorkflows.includes(options.job), `Unknown CircleCI workflow name: ${options.job}. Valid values are: ${circleCIPublishWorkflows}.`);
|
2020-03-20 20:28:31 +00:00
|
|
|
circleCIcall(targetBranch, options.job, options);
|
2017-11-16 21:04:50 +00:00
|
|
|
} else {
|
2021-06-07 14:17:27 +00:00
|
|
|
assert(!options.arch, 'Cannot provide a single architecture while building all workflows, please specify a single workflow via --workflow');
|
2020-03-20 20:28:31 +00:00
|
|
|
options.runningPublishWorkflows = true;
|
|
|
|
circleCIPublishWorkflows.forEach((job) => circleCIcall(targetBranch, job, options));
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-13 20:11:26 +00:00
|
|
|
async function buildVSTS (targetBranch, options) {
|
2020-07-17 16:08:44 +00:00
|
|
|
assert(options.armTest, `${options.ci} only works with the --armTest option.`);
|
|
|
|
assert(vstsArmJobs.includes(options.job), `Unknown VSTS CI arm test job name: ${options.job}. Valid values are: ${vstsArmJobs}.`);
|
2019-02-06 21:36:17 +00:00
|
|
|
|
2020-07-17 16:08:44 +00:00
|
|
|
console.log(`Triggering VSTS to run build on branch: ${targetBranch}.`);
|
|
|
|
const environmentVariables = {};
|
2018-06-13 20:11:26 +00:00
|
|
|
|
2020-07-17 16:08:44 +00:00
|
|
|
if (options.circleBuildNum) {
|
|
|
|
environmentVariables.CIRCLE_BUILD_NUM = options.circleBuildNum;
|
|
|
|
} else if (options.appveyorJobId) {
|
|
|
|
environmentVariables.APPVEYOR_JOB_ID = options.appveyorJobId;
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
|
|
|
|
2020-07-17 16:08:44 +00:00
|
|
|
let vstsURL = VSTS_URL;
|
|
|
|
let vstsToken = process.env.VSTS_TOKEN;
|
2021-04-13 22:30:46 +00:00
|
|
|
assert(vstsToken, `${options.ci} requires the $VSTS_TOKEN environment variable to be provided`);
|
2020-07-17 16:08:44 +00:00
|
|
|
if (options.ci === 'DevOps') {
|
|
|
|
vstsURL = DEVOPS_URL;
|
|
|
|
vstsToken = process.env.DEVOPS_TOKEN;
|
|
|
|
}
|
2018-10-02 01:56:31 +00:00
|
|
|
const requestOpts = {
|
2020-07-17 16:08:44 +00:00
|
|
|
url: `${vstsURL}/definitions?api-version=4.1`,
|
2018-06-13 20:11:26 +00:00
|
|
|
auth: {
|
|
|
|
user: '',
|
2020-07-17 16:08:44 +00:00
|
|
|
password: vstsToken
|
2018-06-13 20:11:26 +00:00
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2021-04-13 07:37:23 +00:00
|
|
|
|
2020-07-17 16:08:44 +00:00
|
|
|
jobRequestedCount++;
|
2021-04-13 07:37:23 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const vstsResponse = await makeRequest(requestOpts, true);
|
|
|
|
const buildToRun = vstsResponse.value.find(build => build.name === options.job);
|
|
|
|
callVSTSBuild(buildToRun, targetBranch, environmentVariables, vstsURL, vstsToken);
|
|
|
|
} catch (err) {
|
|
|
|
console.log('Problem calling VSTS to get build definitions: ', err);
|
|
|
|
}
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
|
|
|
|
2020-07-17 16:08:44 +00:00
|
|
|
async function callVSTSBuild (build, targetBranch, environmentVariables, vstsURL, vstsToken) {
|
2018-10-02 01:56:31 +00:00
|
|
|
const buildBody = {
|
2018-06-13 20:11:26 +00:00
|
|
|
definition: build,
|
2018-10-19 12:56:40 +00:00
|
|
|
sourceBranch: targetBranch,
|
|
|
|
priority: 'high'
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-06-13 20:11:26 +00:00
|
|
|
if (Object.keys(environmentVariables).length !== 0) {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildBody.parameters = JSON.stringify(environmentVariables);
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
2018-10-02 01:56:31 +00:00
|
|
|
const requestOpts = {
|
2020-07-17 16:08:44 +00:00
|
|
|
url: `${vstsURL}/builds?api-version=4.1`,
|
2018-06-13 20:11:26 +00:00
|
|
|
auth: {
|
|
|
|
user: '',
|
2020-07-17 16:08:44 +00:00
|
|
|
password: vstsToken
|
2018-06-13 20:11:26 +00:00
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
body: JSON.stringify(buildBody),
|
|
|
|
method: 'POST'
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2021-04-13 07:37:23 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const { _links } = await makeRequest(requestOpts, true);
|
|
|
|
console.log(`VSTS release build request for ${build.name} successful. Check ${_links.web.href} for status.`);
|
|
|
|
} catch (err) {
|
|
|
|
console.log(`Could not call VSTS for job ${build.name}: `, err);
|
|
|
|
}
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 17:57:47 +00:00
|
|
|
function runRelease (targetBranch, options) {
|
2017-11-16 21:04:50 +00:00
|
|
|
if (options.ci) {
|
|
|
|
switch (options.ci) {
|
|
|
|
case 'CircleCI': {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildCircleCI(targetBranch, options);
|
|
|
|
break;
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
case 'AppVeyor': {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildAppVeyor(targetBranch, options);
|
|
|
|
break;
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
2020-07-17 16:08:44 +00:00
|
|
|
case 'DevOps':
|
2018-06-13 20:11:26 +00:00
|
|
|
case 'VSTS': {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildVSTS(targetBranch, options);
|
|
|
|
break;
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
|
|
|
default: {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log(`Error! Unknown CI: ${options.ci}.`);
|
|
|
|
process.exit(1);
|
2018-06-13 20:11:26 +00:00
|
|
|
}
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
buildCircleCI(targetBranch, options);
|
|
|
|
buildAppVeyor(targetBranch, options);
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log(`${jobRequestedCount} jobs were requested.`);
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
2017-11-02 07:26:37 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
module.exports = runRelease;
|
2017-11-02 07:26:37 +00:00
|
|
|
|
2017-11-16 21:04:50 +00:00
|
|
|
if (require.main === module) {
|
2018-05-14 21:21:51 +00:00
|
|
|
const args = require('minimist')(process.argv.slice(2), {
|
2018-10-09 20:19:05 +00:00
|
|
|
boolean: ['ghRelease', 'armTest']
|
2020-03-20 20:28:31 +00:00
|
|
|
});
|
|
|
|
const targetBranch = args._[0];
|
2017-11-16 21:04:50 +00:00
|
|
|
if (args._.length < 1) {
|
|
|
|
console.log(`Trigger CI to build release builds of electron.
|
2021-06-07 14:17:27 +00:00
|
|
|
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor|VSTS|DevOps]
|
2021-07-01 01:17:59 +00:00
|
|
|
[--ghRelease] [--armTest] [--circleBuildNum=xxx] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH
|
2020-03-20 20:28:31 +00:00
|
|
|
`);
|
|
|
|
process.exit(0);
|
2017-11-16 21:04:50 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
runRelease(targetBranch, args);
|
2017-11-03 06:51:40 +00:00
|
|
|
}
|