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

DOP-4599: Deploy-all slack button deploys all active versions of repos #1042

Closed
wants to merge 49 commits into from

Conversation

anabellabuckvar
Copy link
Contributor

@anabellabuckvar anabellabuckvar commented May 8, 2024

Stories/Links:

DOP-4599

Notes

This PR accomplishes two goals:

  1. Anyone marked as an "admin" in their personal Atlas pool.entitlements entry can deploy all repos in repos branches without having to manually add any entitlements to their entitlements array
  2. The recently released deploy-all button will now deploy all prod-deployable repos and all of thei their active versions, as opposed to just the master branch of all prod-deployable repos

The PR is currently in PrePrd for reviewing purposes so reviewers can test themselves.

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

Copy link

github-actions bot commented May 8, 2024

Your feature branch infrastructure has been deployed!

Your webhook URL is: https://9tvbube0zh.execute-api.us-east-2.amazonaws.com/prod/webhook/githubEndpoint/trigger/build

For more information on how to use this endpoint, follow these instructions.

@anabellabuckvar anabellabuckvar changed the title Dop 4599 DOP-4599: Deploy-all slack button deploys all active versions of repos May 9, 2024
@@ -3,6 +3,7 @@ on:
branches:
- "main"
- "integration"
- "DOP-4599"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be deleted upon PR approval

@anabellabuckvar anabellabuckvar marked this pull request as ready for review May 28, 2024 14:23
Comment on lines 74 to 78
values['repo_option'].push(
...group.options.map((option) => {
if (!option.text.text.startsWith('(!inactive)')) return option;
})
);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the filter method for this rather than map so that we don't end up with undefined values in the array

@@ -66,7 +81,7 @@ async function deployRepo(deployable: Array<any>, logger: ILogger, jobRepository
try {
await jobRepository.insertBulkJobs(deployable, jobQueueUrl);
} catch (err) {
logger.error('deployRepo', err);
console.error('Deploy repo error');
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we still log the error? It can sometimes be such a blessing.

Copy link
Contributor Author

@anabellabuckvar anabellabuckvar May 30, 2024

Choose a reason for hiding this comment

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

Happy to, but it won't make much of a difference in this case! The only place we can view the output for the Slack Deploy Repo lambda is in its corresponding CloudWatch group. The output for console.error looks like the following, and logging the error would just change the format slightly:
Screenshot 2024-05-30 at 2 52 48 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Fascinating! I wonder if that's always the case... I lean towards keeping the error logged just in case it can sometimes be helpful. But good catch!

src/constants.ts Outdated Show resolved Hide resolved
api/controllers/v1/slack.ts Outdated Show resolved Hide resolved
for (const group of optionGroups) {
values['repo_option'].push(
...group.options.filter((option) => {
!option.text.text.startsWith('(!inactive)');
Copy link
Contributor

Choose a reason for hiding this comment

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

We should return this to ensure things are being filtered as expected. Right now, I believe the array would be empty

@@ -65,8 +80,9 @@ export const DisplayRepoOptions = async (event: APIGatewayEvent): Promise<APIGat
async function deployRepo(deployable: Array<any>, logger: ILogger, jobRepository: JobRepository, jobQueueUrl) {
try {
await jobRepository.insertBulkJobs(deployable, jobQueueUrl);
console.error('testing console error logging');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it will be- left it in for Matt to reference regarding his comment on logging !

@rayangler
Copy link
Contributor

rayangler commented May 31, 2024

Hey @anabellabuckvar, I think there may be a bug with the test deployment process in that some jobs seem to fail due to an authorization error. I was looking into it and I wonder if we need to update the throwIfUserNotEntitled function such that it bypasses the check for admin users. For example, I don't have mongodb/docs-kotlin as an entitlement, but attempting to test deploy all resulted in the error (build log).

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