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

Add GitLab HTTPS auth to bootstrap options #351

Merged
merged 3 commits into from
Oct 17, 2020
Merged

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Oct 16, 2020

This PR changes the bootstrap procedure for GitLab. It will generate a deploy key only when --ssh-hostname is specified, otherwise it uses the GITLAB_TOKEN to authenticate against Git over HTTPS instead of SSH.

Testing this PR:

git clone https://github.com/fluxcd/toolkit.git
cd toolkit
git checkout gitlab-https-auth

# needs Go 1.15
make build

# HTTPS Auth
./cmd/gotk bootstrap gitlab --owner=<group> --repository=<repo name> \
--hostname=gitlab.com

# SSH Auth (uses the GitLab deploy keys API)
./cmd/gotk bootstrap gitlab --owner=<group> --repository=<repo name> \
--hostname=gitlab.com \
--ssh-hostname=gitlab.com

Using HTTPS auth should fix: #335 and fix: fluxcd/source-controller#120

PS. I tested this on Gitlab.com with both https and ssh.

@stefanprodan stefanprodan added area/git Git related issues and pull requests area/bootstrap Bootstrap related issues and pull requests labels Oct 16, 2020
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan
Copy link
Member Author

/rebase

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
```

!!! hint "Authentication"
When providing the `--ssh-hostname`, a readonly deploy key will be added
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
When providing the `--ssh-hostname`, a readonly deploy key will be added
When providing the `--ssh-hostname`, a read-only (SSH) deploy key will be added

!!! hint "Authentication"
When providing the `--ssh-hostname`, a readonly deploy key will be added
to your repository, otherwise your GitLab personal token will be used to
authenticate against the HTTPS endpoint instead of SSH.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
authenticate against the HTTPS endpoint instead of SSH.
authenticate against the HTTPS endpoint instead.

@stefanprodan stefanprodan merged commit b4f13e1 into main Oct 17, 2020
@stefanprodan stefanprodan deleted the gitlab-https-auth branch October 17, 2020 10:15
ybelleguic pushed a commit to ybelleguic/flux2 that referenced this pull request Jan 9, 2023
Configure ignore domain for GitRepository rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bootstrap Bootstrap related issues and pull requests area/git Git related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitlab.com Bootstrap issue GitLab self-hosted: git clone unknown error
2 participants