Skip to content

Commit

Permalink
ci(brigade.js): run tests before proceeding with a release (#1033)
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <vadice@microsoft.com>
  • Loading branch information
vdice committed Dec 6, 2019
1 parent 8ffeb29 commit 4cf9ff1
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions brigade.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ function githubRelease(p, tag) {
}
// Cross-compile binaries for a given release and upload them to GitHub.
var job = new Job("release", goImg);
job.shell = "/bin/bash";
job.mountPath = localPath;
parts = p.repo.name.split("/", 2);
// Set a few environment variables.
Expand All @@ -173,9 +174,10 @@ function githubRelease(p, tag) {
`github-release release \
-t ${tag} \
-n "${parts[1]} ${tag}" \
-d "$(git log --no-merges --pretty=format:'- %s %H (%aN)' HEAD ^$last_tag)" \
|| echo "release ${tag} exists"`,
`for bin in ./bin/*; do github-release upload -f $bin -n $(basename $bin) -t ${tag}; done`
-d "$(git log --no-merges --pretty=format:'- %s %H (%aN)' HEAD ^$last_tag)" 2>&1 | sed -e "s/\${GITHUB_TOKEN}/<REDACTED>/"`,
`for bin in ./bin/*; do \
github-release upload -f $bin -n $(basename $bin) -t ${tag} 2>&1 | sed -e "s/\${GITHUB_TOKEN}/<REDACTED>/"; \
done`
];
console.log(job.tasks);
console.log(`releases at https://github.com/${p.repo.name}/releases/tag/${tag}`);
Expand Down Expand Up @@ -210,7 +212,8 @@ events.on("e2e", () => {
events.on("exec", (e, p) => {
return Group.runAll([
goTest(),
jsTest()
jsTest(),
e2e()
]);
});

Expand All @@ -220,17 +223,26 @@ events.on("push", (e, p) => {
// This is an official release with a semantically versioned tag
let matchTokens = Array.from(matchStr);
let version = matchTokens[1];
return buildAndPublishImages(p, version).run()
return Group.runAll([
goTest(),
jsTest(),
e2e()
])
.then(() => {
githubRelease(p, version).run();
})
.then(() => {
slackNotify(
"Brigade Release",
`${version} release now on GitHub! <https://github.com/${p.repo.name}/releases/tag/${version}>`,
p
).run();
Group.runEach([
buildAndPublishImages(p, version),
githubRelease(p, version),
slackNotify(
"Brigade Release",
`${version} release now on GitHub! <https://github.com/${p.repo.name}/releases/tag/${version}>`,
p
)
])
});
} else {
if (e.revision.ref.startsWith('refs/tags')) {
console.log(`Ref ${e.revision.ref} does not match expected official release tag regex (${releaseTagRegex}); not releasing.`);
}
}
})

Expand Down

0 comments on commit 4cf9ff1

Please sign in to comment.