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

Remove payload key #19

Merged
merged 3 commits into from
Aug 7, 2024
Merged

Remove payload key #19

merged 3 commits into from
Aug 7, 2024

Conversation

cbartz
Copy link
Collaborator

@cbartz cbartz commented Aug 6, 2024

Applicable spec: n/a

Overview

Remove accessing the payload key when parsing the webhook payload.

Rationale

The key is non-existent. The webhook payload has the form

{
  'action': 'queued',
  'workflow_job': {
    'id': 28406633456,
    'run_id': 10262527884,
    'workflow_name': 'CI',
    'head_branch': 'push-test',
    'run_url': 'https://api.github.com/repos/canonical/cbartz-runner-testing/actions/runs/10262527884',
    'labels': [
      'self-hosted',
      'large'
    ],
  ...
  },
  'repository': {
...
  },
  'organization': {
...
  },
  'enterprise': {
...
  },
  'sender': {
...
  }
}

see also https://pastebin.canonical.com/p/zYhYJ53Rnq/

Juju Events Changes

n/a

Module Changes

parse.py: Do not assume the existence of the payload key in the payload.

Library Changes

n/a

Checklist

@cbartz cbartz added bug Something isn't working trivial labels Aug 6, 2024
@cbartz cbartz requested a review from a team as a code owner August 6, 2024 15:02
jdkandersson
jdkandersson previously approved these changes Aug 6, 2024
arturo-seijas
arturo-seijas previously approved these changes Aug 6, 2024
@cbartz cbartz dismissed stale reviews from arturo-seijas and jdkandersson via a501d85 August 7, 2024 08:30
Copy link

github-actions bot commented Aug 7, 2024

Test coverage for 1908fc8

Name                           Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------------
webhook_router/__init__.py         0      0      0      0   100%
webhook_router/app.py            103      0     32      0   100%
webhook_router/mq.py              22      0      7      0   100%
webhook_router/parse.py           47      0     14      0   100%
webhook_router/router.py          46      0     18      0   100%
webhook_router/validation.py       6      0      0      0   100%
--------------------------------------------------------------------------
TOTAL                            224      0     71      0   100%

Static code analysis report

Run started:2024-08-07 08:32:16.451846

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 1716
  Total lines skipped (#nosec): 7
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@cbartz cbartz merged commit cc4bcf2 into main Aug 7, 2024
17 checks passed
@cbartz cbartz deleted the fix/remove-payload-key branch August 7, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working trivial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants