Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(go): Release is not idempotent to existing tags #72

Merged
merged 3 commits into from
Apr 13, 2021

Conversation

iliapolo
Copy link
Contributor

@iliapolo iliapolo commented Apr 13, 2021

Depending on CI workflows, it might be that jsii-release will execute with the same version, but different branch content.

For example, the release workflow of cdk8s runs on every push to master, which may introduce changes to the generated go code, but without a version bump.

In this case we want to skip the release, instead of failing.

This PR will make sure it only pushes non-existing tags, and if no such tags exist, the release will be skipped.

@@ -36,22 +36,27 @@ export interface RunOptions {
*/
export function run(command: string, options: RunOptions = {}): string {
const shsplit = shlex.split(command);
const pipe = options.capture ?? false;
const pipeOrInherit = (options.capture ?? false) ? 'pipe': 'inherit';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now need stderr piping as well.

const cwd = process.cwd();
try {
process.chdir(repoDir);
git.init();
git.add('.');
git.identify('jsii-release-test', '<>');
git.commit('Initial Commit');
if (postInit) { postInit(repoDir); };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A way for tests to influence the target repository.

@iliapolo iliapolo marked this pull request as ready for review April 13, 2021 02:38
@eladb eladb merged commit 74e8f0f into master Apr 13, 2021
@mergify mergify bot deleted the epolon/go-idempotent-release branch April 13, 2021 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants