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

Upgrade dependencies 2023-11-27 (#5723) #5735

Merged
merged 14 commits into from
Dec 6, 2023

Conversation

dsotirho-ucsc
Copy link
Contributor

@dsotirho-ucsc dsotirho-ucsc commented Nov 29, 2023

Connected issues: #5723

Checklist

Author

  • PR is a draft
  • Target branch is develop
  • Name of PR branch matches issues/<GitHub handle of author>/<issue#>-<slug>
  • PR title references all connected issues
  • PR title matches1 that of a connected issue or comment in PR explains why they're different
  • For each connected issue, there is at least one commit whose title references that issue
  • PR is connected to all connected issues via ZenHub
  • PR description links to connected issues
  • Added p tag to titles of partial commits
  • Added partial label to PR or this PR completely resolves all connected issues
  • All connected issues are resolved partially or this PR does not have the partial label

1 when the issue title describes a problem, the corresponding PR
title is Fix: followed by the issue title

Author (reindex, API changes)

  • Added r tag to commit title or this PR does not require reindexing
  • Added reindex label to PR or this PR does not require reindexing
  • PR and connected issue are labeled API or this PR does not modify a REST API
  • Added a (A) tag to commit title for backwards (in)compatible changes or this PR does not modify a REST API
  • Updated REST API version number in app.py or this PR does not modify a REST API

Author (chains)

  • This PR is blocked by previous PR in the chain or this PR is not chained to another PR
  • Added base label to the blocking PR or this PR is not chained to another PR
  • Added chained label to this PR or this PR is not chained to another PR

Author (upgrading)

  • Documented upgrading of deployments in UPGRADING.rst or this PR does not require upgrading
  • Added u tag to commit title or this PR does not require upgrading
  • Added upgrade label to PR or this PR does not require upgrading

Author (operator tasks)

  • Added checklist items for additional operator tasks or this PR does not require additional tasks

Author (hotfixes)

  • Added F tag to main commit title or this PR does not include permanent fix for a temporary hotfix
  • Reverted the temporary hotfixes for any connected issues or the prod branch has no temporary hotfixes for any connected issues

Author (before every review)

  • Rebased PR branch on develop, squashed old fixups
  • Ran make requirements_update or this PR does not touch requirements*.txt, common.mk, Makefile and Dockerfile
  • Added R tag to commit title or this PR does not touch requirements*.txt
  • Added reqs label to PR or this PR does not touch requirements*.txt
  • make integration_test passes in personal deployment or this PR does not touch functionality that could break the IT

Peer reviewer (after requesting changes)

Uncheck the Author (before every review) checklists.

Peer reviewer (after approval)

  • PR is not a draft
  • Ticket is in Review requested column
  • Requested review from primary reviewer
  • Assigned PR to primary reviewer

Primary reviewer (after requesting changes)

Uncheck the before every review checklists. Update the N reviews label.

Primary reviewer (after approval)

  • Actually approved the PR
  • Labeled connected issues as demo or no demo
  • Commented on connected issues about demo expectations or all connected issues are labeled no demo
  • Decided if PR can be labeled no sandbox
  • PR title is appropriate as title of merge commit
  • N reviews label is accurate
  • Moved ticket to Approved column
  • Assigned PR to current operator

Operator (before pushing merge the commit)

  • Checked reindex label and r commit title tag
  • Checked that demo expectations are clear or all connected issues are labeled no demo
  • PR has checklist items for upgrading instructions or PR is not labeled upgrade
  • Squashed PR branch and rebased onto develop
  • Sanity-checked history
  • Pushed PR branch to GitHub
  • Deployed dev.shared
  • Pushed PR branch to GitLab dev and added sandbox label or PR is labeled no sandbox
  • Deployed anvildev.shared
  • Pushed PR branch to GitLab anvildev or PR is labeled no sandbox
  • Deployed anvilprod.shared
  • Pushed PR branch to GitLab anvilprod or PR is labeled no sandbox
  • Build passes in sandbox deployment or PR is labeled no sandbox
  • Build passes in anvilbox deployment or PR is labeled no sandbox
  • Build passes in hammerbox deployment or PR is labeled no sandbox
  • Reviewed build logs for anomalies in sandbox deployment or PR is labeled no sandbox
  • Reviewed build logs for anomalies in anvilbox deployment or PR is labeled no sandbox
  • Reviewed build logs for anomalies in hammerbox deployment or PR is labeled no sandbox
  • Deleted unreferenced indices in sandbox or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Deleted unreferenced indices in anvilbox or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Deleted unreferenced indices in hammerbox or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Started reindex in sandbox or this PR does not require reindexing sandbox
  • Started reindex in anvilbox or this PR does not require reindexing sandbox
  • Started reindex in hammerbox or this PR does not require reindexing sandbox
  • Checked for failures in sandbox or this PR does not require reindexing sandbox
  • Checked for failures in anvilbox or this PR does not require reindexing sandbox
  • Checked for failures in hammerbox or this PR does not require reindexing sandbox
  • Title of merge commit starts with title from this PR
  • Added PR reference to merge commit title
  • Collected commit title tags in merge commit title but only include p if the PR is labeled partial
  • Moved connected issues to Merged column in ZenHub
  • Pushed merge commit to GitHub

Operator (chain shortening)

  • Changed the target branch of the blocked PR to develop or this PR is not labeled base
  • Removed the chained label from the blocked PR or this PR is not labeled base
  • Removed the blocking relationship from the blocked PR or this PR is not labeled base
  • Removed the base label from this PR or this PR is not labeled base

Operator (after pushing the merge commit)

  • Deployed dev.gitlab
  • Ran make -C terraform/gitlab/runner (to dev.gitlab)
  • Pushed merge commit to GitLab dev or PR is labeled no sandbox
  • Deployed anvildev.gitlab
  • Ran make -C terraform/gitlab/runner (to anvildev.gitlab)
  • Pushed merge commit to GitLab anvildev or PR is labeled no sandbox
  • Deployed anvilprod.gitlab
  • Ran make -C terraform/gitlab/runner (to anvilprod.gitlab)
  • Pushed merge commit to GitLab anvilprod or PR is labeled no sandbox
  • Build passes on GitLab dev1
  • Reviewed build logs for anomalies on GitLab dev1
  • Build passes on GitLab anvildev1
  • Reviewed build logs for anomalies on GitLab anvildev1
  • Build passes on GitLab anvilprod1
  • Reviewed build logs for anomalies on GitLab anvilprod1
  • Deleted PR branch from GitHub
  • Deleted PR branch from GitLab dev
  • Deleted PR branch from GitLab anvildev
  • Deleted PR branch from GitLab anvilprod

1 When pushing the merge commit is skipped due to the PR being
labelled no sandbox, the next build triggered by a PR whose merge commit is
pushed determines this checklist item.

Operator (reindex)

  • Deleted unreferenced indices in dev or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Deleted unreferenced indices in anvildev or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Deleted unreferenced indices in anvilprod or this PR does not remove catalogs or otherwise causes unreferenced indices
  • Started reindex in dev or this PR does not require reindexing
  • Started reindex in anvildev or this PR does not require reindexing
  • Started reindex in anvilprod or this PR does not require reindexing
  • Checked for and triaged indexing failures in dev or this PR does not require reindexing
  • Checked for and triaged indexing failures in anvildev or this PR does not require reindexing
  • Checked for and triaged indexing failures in anvilprod or this PR does not require reindexing
  • Emptied fail queues in dev deployment or this PR does not require reindexing
  • Emptied fail queues in anvildev deployment or this PR does not require reindexing
  • Emptied fail queues in anvilprod deployment or this PR does not require reindexing

Primary Reviewer

Operator

  • Added CL items to prod promotion PR:
  • Deployed prod.shared
  • Deployed prod.gitlab
  • Ran make -C terraform/gitlab/runner (to prod.gitlab)
  • Unassigned PR

Shorthand for review comments

  • L line is too long
  • W line wrapping is wrong
  • Q bad quotes
  • F other formatting problem

@github-actions github-actions bot added the orange [process] Done by the Azul team label Nov 29, 2023
@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch from 9102660 to 929a5e3 Compare November 29, 2023 20:26
@coveralls
Copy link

coveralls commented Nov 29, 2023

Coverage Status

coverage: 83.071% (+0.005%) from 83.066%
when pulling 1520f6f on issues/dsotirho-ucsc/5723-upgrade-dependencies
into 0bd9865 on develop.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0bd9865) 83.04% compared to head (1520f6f) 83.05%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5735   +/-   ##
========================================
  Coverage    83.04%   83.05%           
========================================
  Files          153      153           
  Lines        19410    19416    +6     
========================================
+ Hits         16119    16125    +6     
  Misses        3291     3291           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch 4 times, most recently from 3f7bcc5 to c597169 Compare December 1, 2023 01:19
@dsotirho-ucsc dsotirho-ucsc added the upgrade [process] PR includes commit requiring manual upgrade label Dec 1, 2023
@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch from c597169 to 7abca52 Compare December 1, 2023 01:32
@dsotirho-ucsc dsotirho-ucsc added the reqs [process] PR includes commit requiring ``make requirements`` label Dec 1, 2023
@dsotirho-ucsc
Copy link
Contributor Author

PR was deployed to personal deployment & passed tests including IT.
PR was deployed to GitLab dev (for the GitLab update) and pushed to sandbox. Pipeline 28706 successfully.

Copy link
Member

@achave11-ucsc achave11-ucsc left a comment

Choose a reason for hiding this comment

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

Changes look good, nicely done. A few nits.
Also consider doing another pass over your Inspector script, it might benefit from having more type hints and other misc formatting changes.

- [ ] … update to ClamAV image
- [ ] … update to GitLab AMI
- [ ] … update to [Python](https://hub.docker.com/_/python/tags) (only patch versions)
- [ ] … Updates to [Terraform](https://hub.docker.com/r/hashicorp/terraform/tags) (only patch versions)
Copy link
Member

Choose a reason for hiding this comment

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

U… might be a typo here.

Comment on lines 43 to 44
f'Default: {cls.default_severities}\n'
'Choices: ' + ','.join(cls.all_severities))
Copy link
Member

Choose a reason for hiding this comment

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

Consider adhering to a single format, whether it be f-strings or concatenation, I think it might improve consistency.

Comment on lines 43 to 44
f'Default: {cls.default_severities}\n'
'Choices: ' + ','.join(cls.all_severities))
Copy link
Member

Choose a reason for hiding this comment

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

Also consider a space character after the comma in the join command, to improve readability.


def main(self):
log.info('Fetching all findings from AWS Inspector')
client = aws.client('inspector2') # Note inspector2 not inspector
Copy link
Member

Choose a reason for hiding this comment

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

The comment might be redundant, I think it's protocol (has been enforced during review process) to use the most recent client or resource API version available.

paginator = client.get_paginator('list_findings')
for page in paginator.paginate():
self.findings.extend(page['findings'])
log.info(f'Fetched a total of {len(self.findings)} findings from AWS Inspector')
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines 106 to 108
log.info(f'Found {finding_count} vulnerabilities with a severity '
f'{self.severities!r}')
log.info(f'Grouped findings by {len(findings)} unique vulnerabilities')
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

file_data.append(row)

output_file_name = f'inspector-findings_{self.date}.csv'
log.info(f'Writing file {output_file_name!r}')
Copy link
Member

Choose a reason for hiding this comment

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

Also here.

Comment on lines 79 to 80
if severity not in self.severities:
continue
Copy link
Member

Choose a reason for hiding this comment

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

This looks to me like what the first bulleted item in https://github.com/DataBiosphere/azul/blob/develop/CONTRIBUTING.rst#control-flow describes.

assert summary['instances'] or summary['images'], summary
finding_count += 1
findings[vulnerability].append(summary)
log.info(f'Found {finding_count} vulnerabilities with a severity '
Copy link
Member

Choose a reason for hiding this comment

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

Would len(findings) not achieve the same here?
The counter might be unnecessary.

Copy link
Contributor Author

@dsotirho-ucsc dsotirho-ucsc Dec 1, 2023

Choose a reason for hiding this comment

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

finding_count is the total number of findings (that matched the specified severity), while len(findings) gives the number of unique vulnerabilities (e.g. CVE-1234), which can have one or more finding associated with it. Not entirely necessary as log output however, I'll clean this up.

self.write_compact_csv()
log.info('Done.')

def parse_findings_for_csv(self) -> tuple[dict, set, set]:
Copy link
Member

Choose a reason for hiding this comment

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

The definition of this method seems a bit complicated. Consider doing another pass over this method to see if it might do with a bit of de-duplication or simplification.

Copy link
Member

Choose a reason for hiding this comment

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

Additionally, a bit of preprocessing might help cleanup and address what looks like a bail-out.

@achave11-ucsc achave11-ucsc removed their assignment Dec 1, 2023
@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch 2 times, most recently from 8b0b2e2 to 3cfe124 Compare December 2, 2023 00:19
@dsotirho-ucsc
Copy link
Contributor Author

dsotirho-ucsc commented Dec 2, 2023

Note: I amended the Update GitLab… commit (instead of adding a fixup) to change the new version to 6.16.1 (instead of 6.16.0).

PR was redeployed to dev.gitlab to test GitLab 6.16.1, and the PR passed on sandbox (Pipeline 28731)

achave11-ucsc
achave11-ucsc previously approved these changes Dec 2, 2023
Copy link
Member

@achave11-ucsc achave11-ucsc left a comment

Choose a reason for hiding this comment

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

🦭✅

@achave11-ucsc achave11-ucsc marked this pull request as ready for review December 2, 2023 04:08
@hannes-ucsc hannes-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch from 3cfe124 to ba0d08a Compare December 5, 2023 00:59
hannes-ucsc
hannes-ucsc previously approved these changes Dec 5, 2023
@hannes-ucsc hannes-ucsc added the 0 reviews [process] Lead didn't request any changes label Dec 5, 2023
@hannes-ucsc hannes-ucsc removed their assignment Dec 5, 2023
@hannes-ucsc
Copy link
Member

When I rebased, some of the commits were squashed out. I also ran make requirements_update again.

@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch from ba0d08a to da6ffd6 Compare December 6, 2023 00:25
@dsotirho-ucsc dsotirho-ucsc force-pushed the issues/dsotirho-ucsc/5723-upgrade-dependencies branch from da6ffd6 to 1520f6f Compare December 6, 2023 00:53
@dsotirho-ucsc dsotirho-ucsc added the sandbox [process] Resolution is being verified in sandbox deployment label Dec 6, 2023
@dsotirho-ucsc dsotirho-ucsc merged commit 33ec475 into develop Dec 6, 2023
8 checks passed
@dsotirho-ucsc dsotirho-ucsc deleted the issues/dsotirho-ucsc/5723-upgrade-dependencies branch December 7, 2023 00:39
@hannes-ucsc hannes-ucsc removed their assignment Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 reviews [process] Lead didn't request any changes orange [process] Done by the Azul team reqs [process] PR includes commit requiring ``make requirements`` sandbox [process] Resolution is being verified in sandbox deployment upgrade [process] PR includes commit requiring manual upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants