Skip to content

chore: publish to homebrew from CI MONGOSH-502 #541

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

Merged
merged 9 commits into from
Jan 13, 2021

Conversation

rose-m
Copy link
Contributor

@rose-m rose-m commented Jan 11, 2021

This adds publishing to homebrew to the build package as part of the publish command.

Publishing to our https://github.com/mongodb/homebrew-brew repository is done by:

  1. Generating new formula
  2. Checking out the homebrew-brew repository locally
  3. Checking if there was any change to the formula (there should)
  4. Commit the new formula to a new branch and push that branch to homebrew-brew
  5. Automatically create a PR in homebrew-brew from our new branch to master
  6. Automatically merge that PR

I'd suggest waiting with this PR until #535 has landed, then rebase on top and merge since homebrew publishing requires the NPM packages to be released already. (PR has landed)

@rose-m rose-m self-assigned this Jan 11, 2021
@rose-m rose-m force-pushed the mongosh-502-publish-to-homebrew-ci branch from a8b70e3 to c326261 Compare January 12, 2021 13:28
...this.repo,
pull_number: prNumber
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does whichever github user is running in CI have merge permissions for the repo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a great question, i don't think so, and i actually have no clue who we should ask, going to ask Jess, probably she knows

});
}

export function cloneRepository(cloneDir: string, repositoryUrl: string): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this still used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, good point - needs cleaning up!

@@ -81,6 +82,7 @@ export default async function release(
}
await fs.writeFile(path.join(config.outputDir, '.artifact_metadata'), JSON.stringify(tarballFile));
} else if (command === 'upload') {
const barque = new Barque(config);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@@ -17,11 +17,15 @@ chai.use(chaiAsPromised);
// to wait for these to finish.
const tick = promisify(setImmediate);

// We keep an additional index as we might create two temp directories
Copy link
Collaborator

@mcasimir mcasimir Jan 12, 2021

Choose a reason for hiding this comment

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

this one confuses me :), is this related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was... when I created git repos locally in tests I got conflicts as new Date() was not sufficient to create a unique folder name. I've left it in as it would prevent the same issue in the future.
I don't need it right now anymore so I can remove if you say we should strip.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fwiw, we do use Math.random() in a few other places as well. Doing that here would sound good to me in terms of consistency 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Or, to be clear, leaving it in this PR is also just fine with me!)

Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

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

Nice stuff!

@rose-m
Copy link
Contributor Author

rose-m commented Jan 13, 2021

Quick update: I've tested the Github Repo auto-commit/pr/merge behavior, fixed some issues, and it's operational now.

Here's a PR that was created with the publishToHomebrew function: rose-m/homebrew-brew#2

@rose-m rose-m merged commit f6e31c9 into master Jan 13, 2021
@rose-m rose-m deleted the mongosh-502-publish-to-homebrew-ci branch January 13, 2021 15:50
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.

3 participants