Repository navigation
Conversation
config defaulted VcsBaseUrl to "https://<vcs-type>.com". That is the instance root GitLab wants, but on GitHub it's the website, never a valid API base, so every GitHub code path had to ignore it unless VcsUploadUrl was also set. #575 didn't, and pointed the App's installation-token requests at https://github.com/app/installations/<id>/access_tokens, which answers 422: on v3.6.0 and v3.7.0 every github.com install using App auth fails every API call. Default GitHub to https://api.github.com, and GitLab to https://gitlab.com as before. VcsBaseUrl is now always the API base, and every config comes through that default, so DownloadArchive and the App transport use it directly: no guessing Enterprise from VcsUploadUrl, and no fallback for an empty value. The flag's help text says what the value is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Temporary Helm chart (version Install directly: helm install kubechecks oci://ghcr.io/zapier/charts/kubechecks --version 0.0.0-pr583Pull to inspect: helm pull oci://ghcr.io/zapier/charts/kubechecks --version 0.0.0-pr583Note: OCI charts don't use |
Follow-up fixes from the review of this branch: - config: reject unknown vcs-type values at config load; an env-sourced KUBECHECKS_VCS_TYPE bypasses the flag-level "one of" help text - github_client: fail loudly in DownloadArchive when VcsBaseUrl is empty instead of building a relative archive URL; the client contract now states that pkg/config is expected to have defaulted it - gitlab_client: extract gitlabArchiveURL and append /api/v4 exactly once, so legacy configs that already carry the suffix stop 404ing - docs: document the KUBECHECKS_VCS_BASE_URL defaults in usage.md - tests: cover the new validation, the empty base url, and both GitLab URL forms
The default column is generated from the flags' pflag defaults, and vcs-base-url has none (it is defaulted from vcs-type at runtime), so the hand-written default value did not match the output of 'make rebuild-docs'.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
VcsBaseUrlis unset,pkg/configdefaults it tohttps://<vcs-type>.com. For GitLab that's the instance root the client expects. For GitHub it'shttps://github.com, the website, which is never a valid API base. Every GitHub code path had to ignore the value unlessVcsUploadUrlwas also set.#575 (released in v3.6.0) didn't do that: it sets the ghinstallation transport's
BaseURLwheneverVcsBaseUrlis non-empty. On github.com, every installation-token request now goes to the website and fails:As a result, every github.com install using GitHub App auth on v3.6.0 or v3.7.0 can't call the API at all. Fetching PR details, posting comments and downloading archives all fail.
Fix
Make the default correct instead of working around it:
pkg/configdefaultsVcsBaseUrltohttps://api.github.comforgithub, and tohttps://gitlab.comforgitlabas before.VcsBaseUrlis now always the API base, and every config is built byconfig.New(), soDownloadArchiveand the App transport use it directly. Neither guesses Enterprise fromVcsUploadUrlor falls back when the value is empty.docs/usage.md) now says what the value is: the Enterprise API base (https://<host>/api/v3) or the self-hosted GitLab root.NewClientstill requires both URLs before it usesWithEnterpriseURLs, which needs an upload URL anyway.Tests
TestNew_VcsBaseUrlDefaultchecks the defaults for both VCS types and that an explicit value is kept. It fails on the old default (https://github.com).TestCreateHttpClientAppBaseURLnow covers the defaultedhttps://api.github.com, and drops its empty-value case.DownloadArchivetests pass the base URLconfig.New()would give them.TestClient_DownloadArchive_DefaultedVcsBaseUrlis removed, because it only existed to encode the old default andHappyPathnow covers github.com.🤖 Generated with Claude Code