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

tasks: Add cockpituous refs/heads/main mock API endpoint #597

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tasks/mock-github
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ argparser.add_argument('--print-pr-event', action='store_true',
argparser.add_argument('--print-image-refresh-event', action='store_true',
help="Print GitHub webhook issue event for an image-refresh and exit")
argparser.add_argument('--log', metavar="PATH", help="Log requests to this file")
argparser.add_argument('--cockpituous-sha', metavar="SHA", help="resolve cockpituous main branch to this SHA")
argparser.add_argument('repo', metavar='USER/PROJECT', help="GitHub user/org and project name")
argparser.add_argument('sha', help="SHA to test in repo for the mock PR")
args = argparser.parse_args()
Expand Down Expand Up @@ -112,6 +113,11 @@ GITHUB_DATA = {
f'/repos/{repo}/git/ref/heads/main': {
'object': {'sha': sha},
},
# for cross-project test; job-runner uses it to determine the clone SHA
'/repos/cockpit-project/cockpituous/git/refs/heads/main': {
# that fallback is strictly wrong, but good enough
'object': {'sha': args.cockpituous_sha or "main"},
Copy link
Member

Choose a reason for hiding this comment

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

I considered checking this for validity on receipt, but meh. If it works, it works. It's just mocking, after all.

I'm more bothered by the ad-hoc way in which we keep adding stuff here. I want git-serve.

},
}

if args.print_pr_event:
Expand Down