Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Remove CircleCI 1.0 support from the rebuild command
Browse files Browse the repository at this point in the history
Fixes #517.

 🐿 v2.10.2
  • Loading branch information
simonplend committed Sep 12, 2018
1 parent 43db6ee commit 4011296
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions tasks/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ async function circleFetch (path, opts) {
}
}

const clearCache = (project) => circleFetch(`/${project}/build-cache`, { method: 'DELETE' });

const rebuildMasterBuild = (project) => circleFetch(`/${project}/tree/master`, { method: 'POST' });

const triggerMasterBuild = (project) => circleFetch(`/${project}/build`, { method: 'POST', body: JSON.stringify({ branch: 'master' }) });

const lastMasterBuild = (project) => circleFetch(`/${project}/tree/master`);
Expand Down Expand Up @@ -75,28 +71,10 @@ async function task (options) {
console.log(`Considering whether to rebuild ${app}`); // eslint-disable-line no-console
try {
const [lastBuild] = await lastMasterBuild(app);

switch (lastBuild.platform) {
case '1.0':
if (lastBuild.status !== 'running' && lastBuild.status !== 'not_running') {
console.log(`Clearing cache and triggering rebuild of last master build of ${app} (${lastBuild.committer_name}: ${lastBuild.subject ? lastBuild.subject.replace(/\n/g, ' ') : 'No subject'})`); // eslint-disable-line no-console
await clearCache(app);
await rebuildMasterBuild(app);
} else {
console.log(`Skipping rebuild of ${app} because job already exists.`); // eslint-disable-line no-console
}
break;
case '2.0':
console.log(`Triggering master build for ${app} (git commit: ${lastBuild.vcs_revision})`); // eslint-disable-line no-console
await triggerMasterBuild(app);
break;
default:
throw new Error(`CircleCI platform version ${lastBuild.platform} is not supported by this command`);
break;
}

console.log(`Triggering master build for ${app} (git commit: ${lastBuild.vcs_revision})`); // eslint-disable-line no-console
await triggerMasterBuild(app);
} catch (error) {
console.log(`Skipped rebuild of ${app} probably because Circle CI not set up for this repo`); // eslint-disable-line no-console
console.log(`Skipped rebuild of ${app}, probably because Circle CI not set up for this repo`); // eslint-disable-line no-console
}
}));
};
Expand Down

0 comments on commit 4011296

Please sign in to comment.