chart-testing icon indicating copy to clipboard operation
chart-testing copied to clipboard

[BUG] 403 when building dependencies in ct lint command

Open fnarvaez-applydigital opened this issue 1 year ago • 0 comments

Is this a request for help?:

Yes

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Version of Helm and Kubernetes: Helm version

version.BuildInfo{Version:"v3.16.1", GitCommit:"5a5449dc42be07001fd5771d56429132984ab3ab", GitTreeState:"dirty", GoVersion:"go1.23.1"}

kubectl version

Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

ct version

Version:	 3.11.0
Git commit:	 a2ecd82b650c223a8d264920fd0bab40de16b915
Date:		 2024-04-21
License:	 Apache 2.0

What happened: ct lint throws a 403 even if login succeeded.

ct.yaml
remote: origin
target-branch: main
chart-dirs:
  - charts
chart-repos:
  - stable=oci://us-docker.pkg.dev
helm-extra-args: --timeout=600s --debug
helm-repo-extra-args:
  - stable=--username=oauth2accesstoken --password-stdin
validate-maintainers: false
ct logs
  gcloud auth application-default print-access-token | ct lint --config ct.yaml --debug
  Linting charts...
  >>> helm version --template {{ .Version }}
  >>> git rev-parse --is-inside-work-tree
  >>> git rev-parse --verify origin/main
  >>> git merge-base origin/main HEAD
  >>> git diff --find-renames --name-only bc9a323e403a39ffee56c660db4339d7a37efdfe -- charts
  
  ------------------------------------------------------------------------------------------------------------------------
Charts to be processed:
  ------------------------------------------------------------------------------------------------------------------------
springboot-app => (version: "0.0.1", path: "charts/springboot-app")
  ------------------------------------------------------------------------------------------------------------------------

  >>> helm registry login us-docker.pkg.dev --username=oauth2accesstoken --password-stdin
  Login Succeeded
  >>> helm dependency build charts/springboot-app
  Hang tight while we grab the latest from your chart repositories...
  ...Successfully got an update from the "mongodb" chart repository
  ...Successfully got an update from the "ingress-nginx" chart repository
  ...Successfully got an update from the "jetstack" chart repository
  Update Complete. ⎈Happy Helming!⎈
  Saving 1 charts
  Downloading ch-base from repo oci://us-docker.pkg.dev/<project-id>/<registry>
Save error occurred:  could not download oci://us-docker.pkg.dev/<project-id>/<registry>/ch-base: ...
Error: could not download oci://us-docker.pkg.dev//<project-id>/<registry>/ch-base: failed to authorize: failed to fetch anonymous token: unexpected status from GET request to https://us-docker.pkg.dev/v2/./..

Also I executed manually the same command but everything goes just fine.

What you expected to happen: Download the dependencies

How to reproduce it (as minimally and precisely as possible):

  1. have a private repository
  2. create a 2 charts, supposed you have A and B and B depends on A, and A already exists in the private registry.

to reproduce it, execute the following command gcloud auth application-default print-access-token | ct lint --config ct.yaml

fnarvaez-applydigital avatar Oct 04 '24 16:10 fnarvaez-applydigital