-
Notifications
You must be signed in to change notification settings - Fork 3
Add Azul GitHub project and priority support to schedule.py (#7474, #7548) #7622
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
base: develop
Are you sure you want to change the base?
Add Azul GitHub project and priority support to schedule.py (#7474, #7548) #7622
Conversation
| url | ||
| ] | ||
| log.info('Running %r …', command) | ||
| process = subprocess.run(command, check=True, stdout=subprocess.PIPE) |
Check notice
Code scanning / CodeQL
Unused local variable Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
False positive, the variable is used on the next line
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7622 +/- ##
========================================
Coverage 84.84% 84.84%
========================================
Files 157 157
Lines 22871 22871
========================================
Hits 19405 19405
Misses 3466 3466 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ed9db65 to
8f71a70
Compare
9fbbec1 to
0938b89
Compare
|
Title differs from the issue because the PR addresses two issues. |
31cdffc to
6ac3db6
Compare
4d95c72 to
0cf4188
Compare
.github/workflows/schedule.py
Outdated
| log.info('Successfully created and verfied issue #%s', issue_number) | ||
| self.verify_issue(assignees, issue, labels, repository, type, url) | ||
|
|
||
| def verify_issue(self, assignees, issue, labels, repository, type, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type annotations would be nice here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of this change? The PR doesn't add any other call sites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of this change?
To encapsulate the verification logic, but is not as extensive as I originally thought so I've dropped this change.
The PR doesn't add any other call sites.
Respectfully, is that a requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it isn't a requirement. It's the most obvious reason for extracting a method, but there are other valid reasons, including encapsulation. If you had decided to keep the change, I would have accepted your rationale.
.github/workflows/schedule.py
Outdated
| assert set(labels) <= actual_labels, (labels, actual_labels) | ||
| actual_type = issue['type']['name'] | ||
| assert type == actual_type, (type, actual_type) | ||
| log.info('Successfully created and verfied issue #%s', issue_number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in "verfied". Fix in a separate commit.
.github/workflows/schedule.py
Outdated
| assert issue_project['title'] == issue['title'], issue_project['title'] | ||
| assert issue_project['url'] == url, issue_project['url'] | ||
| assert issue_project['id'] == project['id'], issue_project['id'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert issue_project['title'] == issue['title'], issue_project['title'] | |
| assert issue_project['url'] == url, issue_project['url'] | |
| assert issue_project['id'] == project['id'], issue_project['id'] | |
| assert issue_project['title'] == issue['title'], (issue_project['title'], issue['title']) | |
| assert issue_project['url'] == url, (issue_project['url'], url) | |
| assert issue_project['id'] == project['id'], (issue_project['id'], project['id']) |
7443e1e to
a0961b9
Compare
.github/workflows/schedule.py
Outdated
| process = subprocess.run(command, check=True, stdout=subprocess.PIPE) | ||
| item = json.loads(process.stdout) | ||
| assert item['id'], item | ||
| priority = self.properties.get('_project_item_priority') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using .get is a bad idea here, because if priority is None then line 241 will raise a KeyError.
| priority = self.properties.get('_project_item_priority') | |
| priority = self.properties['_project_item_priority'] |
.github/workflows/schedule.py
Outdated
| project = json.loads(process.stdout) | ||
| assert project['title'] == title, (project['title'], title) | ||
| assert project['url'] == url, (project['url'], url) | ||
| assert project['id'] == item['id'], (project['id'], item['id']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three separate lookups of item['id'], so maybe extract a local for it?
.github/workflows/schedule.py
Outdated
| log.info('Successfully created and verfied issue #%s', issue_number) | ||
| self.verify_issue(assignees, issue, labels, repository, type, url) | ||
|
|
||
| def verify_issue(self, assignees, issue, labels, repository, type, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it isn't a requirement. It's the most obvious reason for extracting a method, but there are other valid reasons, including encapsulation. If you had decided to keep the change, I would have accepted your rationale.
a0961b9 to
d1a5c69
Compare
.github/workflows/schedule.py
Outdated
|
|
||
|
|
||
| azul_project_number = '3' | ||
| azul_project_id = 'PVT_kwDOAfSQ384BCJY8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember agreeing that it would be OK to hard-code all this
$ gh project list --format json --owner DataBiosphere --jq '.projects[]|select(.title == "Azul")|.number'
3
$ gh project field-list 3 --owner=DataBiosphere --format=json --jq '.fields[]|select(.name == "Priority")|.options'
[
{
"id": "bdf99630",
"name": "++"
},
{
"id": "3333032d",
"name": "+"
},
{
"id": "5e2e7b47",
"name": "-"
},
{
"id": "b903d2dc",
"name": "--"
}
]
You can probably extract the owner from the environment. The only thing you'd have to hard-code is the project and field name.
f694245 to
8de92d8
Compare
87d2bec to
e09f602
Compare
| '-f', f'body={self.body}', | ||
| '-f', f'type={type}' | ||
| ] | ||
| command = list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| command = list() | |
| command = [] |
| for label in labels: | ||
| command.extend(['-f', f'labels[]={label}']) | ||
| if self.dry_run: | ||
| log.info('Would run %r', command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just logs a fragment of the command, which isn't helpful.
| ]) | ||
| priority_ids = {pf['name']: pf['id'] for pf in priority_field['options']} | ||
| priority = self.properties['_project_item_priority'] | ||
| project = self.gh_json([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this variable holds an item, not a project.
achave11-ucsc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Monthly web app vulnerability scans' ticket is missing operator label.
Linked issues: #7474, #7548
Note
schedule.pyto fully include project scopeChecklist
Author
developissues/<GitHub handle of author>/<issue#>-<slug>1 when the issue title describes a problem, the corresponding PR
title is
Fix:followed by the issue titleAuthor (partiality)
ptag to titles of partial commitspartialor completely resolves all linked issuespartiallabelAuthor (reindex)
rtag to commit title or the changes introduced by this PR will not require reindexing of any deploymentreindex:devor the changes introduced by it will not require reindexing ofdevreindex:anvildevor the changes introduced by it will not require reindexing ofanvildevreindex:anvilprodor the changes introduced by it will not require reindexing ofanvilprodreindex:prodor the changes introduced by it will not require reindexing ofprodreindex:partialand its description documents the specific reindexing procedure fordev,anvildev,anvilprodandprodor requires a full reindex or carries none of the labelsreindex:dev,reindex:anvildev,reindex:anvilprodandreindex:prodAuthor (API changes)
APIor this PR does not modify a REST APIa(A) tag to commit title for backwards (in)compatible changes or this PR does not modify a REST APIapp.pyor this PR does not modify a REST APIAuthor (upgrading deployments)
make docker_images.jsonand committed the resulting changes or this PR does not modifyazul_docker_images, or any other variables referenced in the definition of that variableutag to commit title or this PR does not require upgrading deploymentsupgradeor does not require upgrading deploymentsdeploy:sharedor does not modifydocker_images.json, and does not require deploying thesharedcomponent for any other reasondeploy:gitlabor does not require deploying thegitlabcomponentdeploy:runneror does not require deploying therunnerimageAuthor (hotfixes)
Ftag to main commit title or this PR does not include permanent fix for a temporary hotfixanvilprodandprod) have temporary hotfixes for any of the issues linked to this PRAuthor (before every review)
develop, squashed fixups from prior reviewsmake requirements_updateor this PR does not modifyDockerfile,environment,requirements*.txt,common.mk,Makefileorenvironment.bootRtag to commit title or this PR does not modifyrequirements*.txtreqsor does not modifyrequirements*.txtmake integration_testpasses in personal deployment or this PR does not modify functionality that could affect the IT outcomePeer reviewer (after approval)
Note that after requesting changes, the PR must be assigned to only the author.
System administrator (after approval)
demoorno demono demono sandboxN reviewslabel is accurateOperator
reindex:…labels andrcommit title tagno demodevelopOperator (deploy
.sharedand.gitlabcomponents)_select dev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unusedor this PR is not labeleddeploy:shared_select dev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab applyor this PR is not labeleddeploy:gitlab_select anvildev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unusedor this PR is not labeleddeploy:shared_select anvildev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab applyor this PR is not labeleddeploy:gitlabdeploy:gitlabdeploy:gitlabSystem administrator (post-deploy of
.gitlabcomponent)dev.gitlabare complete or this PR is not labeleddeploy:gitlabanvildev.gitlabare complete or this PR is not labeleddeploy:gitlabOperator (deploy runner image)
_select dev.gitlab && make -C terraform/gitlab/runneror this PR is not labeleddeploy:runner_select anvildev.gitlab && make -C terraform/gitlab/runneror this PR is not labeleddeploy:runnerOperator (sandbox build)
sandboxlabel or PR is labeledno sandboxdevor PR is labeledno sandboxanvildevor PR is labeledno sandboxsandboxdeployment or PR is labeledno sandboxanvilboxdeployment or PR is labeledno sandboxsandboxdeployment or PR is labeledno sandboxanvilboxdeployment or PR is labeledno sandboxsandboxor this PR does not remove catalogs or otherwise causes unreferenced indices indevanvilboxor this PR does not remove catalogs or otherwise causes unreferenced indices inanvildevsandboxor this PR is not labeledreindex:devanvilboxor this PR is not labeledreindex:anvildevsandboxor this PR is not labeledreindex:devanvilboxor this PR is not labeledreindex:anvildevOperator (merge the branch)
pif the PR is also labeledpartialOperator (main build)
devanvildevdevdevanvildevanvildev_select dev.shared && make -C terraform/shared applyor this PR is not labeleddeploy:shared_select anvildev.shared && make -C terraform/shared applyor this PR is not labeleddeploy:shareddevanvildevOperator (reindex)
devor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevdevor this PR does not require reindexingdevdeploy_browserjob in the GitLab pipeline for this PR indevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdeploy_browserjob in the GitLab pipeline for this PR inanvildevor this PR does not require reindexinganvildevOperator (mirroring)
devor this PR does not require mirroringdevanvildevor this PR does not require mirroringanvildevdevor this PR does not require mirroringdevanvildevor this PR does not require mirroringanvildevdevor this PR does not require mirroringdevanvildevor this PR does not require mirroringanvildevOperator
deploy:shared,deploy:gitlab,deploy:runner,API,reindex:partial,reindex:anvilprodandreindex:prodlabels to the next promotion PRs or this PR carries none of these labelsdeploy:shared,deploy:gitlab,deploy:runner,API,reindex:partial,reindex:anvilprodandreindex:prodlabels, from the description of this PR to that of the next promotion PRs or this PR carries none of these labelsShorthand for review comments
Lline is too longWline wrapping is wrongQbad quotesFother formatting problem