Skip to content

dependency add and project build do not support Git HTTPS authentication for private dependencies #370

Description

@DanielTezolin

What happened?

Our corporate network cannot access public source-code hosts such as GitHub. We mirror the CRD manifests we need in a private repository on our internal Git server and use that repository as a project dependency.

The CLI cannot authenticate to that repository when it is accessed by crossplane dependency add or crossplane project build.

This leaves us unable to:

  1. Add the Git dependency to a project in the first place.
  2. Build a project when its dependency schemas need to be generated or refreshed.

This is surprising because crossplane dependency update-cache already supports Git-over-HTTPS authentication with:

  • --git-token / CROSSPLANE_GIT_TOKEN
  • --git-username / CROSSPLANE_GIT_USERNAME

The equivalent options are not available to dependency add or project build.

How can we reproduce it?

dependency add rejects the authentication flag:

$ crossplane dependency add --git-token=not-a-real-token
crossplane: error: unknown flag --git-token

The same flag is available on dependency update-cache:

$ crossplane dependency update-cache --help
...
      --git-token=STRING    Token for git HTTPS authentication ($CROSSPLANE_GIT_TOKEN).
      --git-username="x-access-token"
                            Username for git HTTPS authentication ($CROSSPLANE_GIT_USERNAME).

I expect this workflow to work:

export CROSSPLANE_GIT_TOKEN=<read-only-token>

crossplane dependency add \
  https://<git-server>/<organization>/<repository>.git \
  --git-ref main \
  --git-path config/crd/bases

After the dependency has been added, a regular build should also be able to access it:

crossplane project build

Both commands should use credentials supplied through environment variables. Credentials must not be written to crossplane-project.yaml, included in the repository URL, or exposed in logs and error messages.

I would be happy to contribute a fix for this issue.

What environment did it happen in?

  • Crossplane CLI version: v2.5.0
  • Platform: linux/amd64
  • Crossplane version: not applicable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions