Skip to content

Commit

Permalink
Merge pull request #11 from askwonder/feature/conditional-prune
Browse files Browse the repository at this point in the history
only prune a branch if it exists
  • Loading branch information
Joey Staehle authored Apr 30, 2019
2 parents 451d93c + 640eec6 commit c5ca722
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/prune.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,26 @@ const prune = ({
clusterName,
subDomain,
}))
// eslint-disable-next-line consistent-return
.then((task) => {
scope.task = task;
return stopTask({
awsRegion,
clusterName,
taskArn: task.taskArn,
});
if (task) {
scope.task = task;
return stopTask({
awsRegion,
clusterName,
taskArn: task.taskArn,
});
}
})
// eslint-disable-next-line consistent-return
.then(() => {
if (scope.task) {
return deregisterTaskDefinition({
awsRegion,
task: scope.task,
});
}
})
.then(() => deregisterTaskDefinition({
awsRegion,
task: scope.task,
}))
.then(() => deleteImages({
awsRegion,
subDomain,
Expand Down

0 comments on commit c5ca722

Please sign in to comment.