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

Refactor bootstrap process to use fluxcd/pkg/git #3299

Merged
merged 4 commits into from Nov 17, 2022

Conversation

aryan9600
Copy link
Member

@aryan9600 aryan9600 commented Nov 8, 2022

Refactors the bootstrap process to use https://github.com/fluxcd/pkg/tree/main/git/gogit, getting rid of the
pkg/bootstrap/git in the process.

Fixes: #3273
Related to: #3282

Signed-off-by: Sanskar Jaiswal jaiswalsanskar078@gmail.com

@aryan9600 aryan9600 requested review from phillebaba, hiddeco and stefanprodan and removed request for phillebaba and hiddeco November 8, 2022 16:20
@aryan9600
Copy link
Member Author

aryan9600 commented Nov 9, 2022

commands and providers tested:

  • flux bootstrap gitub
  • flux bootstrap gitlab
  • flux bootstrap git with GitHub SSH
  • flux bootstrap git with GitHub HTTPS
  • flux bootstrap git with GitLab SSH
  • flux bootstrap git with GitLab HTTPS
  • flux bootstap git with BitBucket Cloud SSH
  • flux bootstrap git with BitBucket Cloud HTTPS
  • flux bootstrap git with AWS CodeCommit SSH
  • flux bootstrap git with AWS CodeCommit HTTPS
  • flux bootstrap git with Azure Devops SSH
  • flux bootstrap git with Azure Devops HTTPS
  • flux bootstrap git with BitBucket Server SSH
  • flux bootstrap git with BitBucket Server HTTPS
  • flux bootstrap bitbucket-server

@pjbgf pjbgf added the area/git Git related issues and pull requests label Nov 9, 2022
@pjbgf pjbgf added this to the Bootstrap GA milestone Nov 9, 2022
go.mod Outdated Show resolved Hide resolved
@aryan9600 aryan9600 force-pushed the use-pkg-git branch 2 times, most recently from 3601f85 to 77ff5fd Compare November 9, 2022 12:36
@pjbgf
Copy link
Member

pjbgf commented Nov 9, 2022

Tested the bootstrap with GPG signing, which worked fine in GitHub:
image

@aryan9600 aryan9600 marked this pull request as ready for review November 10, 2022 17:28
@aryan9600 aryan9600 changed the title [WIP] refactor bootstrap process to use fluxcd/pkg/git refactor bootstrap process to use fluxcd/pkg/git Nov 10, 2022
Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

LGTM

Great stuff @aryan9600! 🚀

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @aryan9600 🏅

@stefanprodan stefanprodan added the area/bootstrap Bootstrap related issues and pull requests label Nov 11, 2022
@stefanprodan stefanprodan changed the title refactor bootstrap process to use fluxcd/pkg/git Refactor bootstrap process to use fluxcd/pkg/git Nov 11, 2022
@pjbgf
Copy link
Member

pjbgf commented Nov 14, 2022

@stefanprodan please review the latest changes from an UX PoV. They were required due to the CodeCommit workflow for non --token-auth.

@stefanprodan
Copy link
Member

@aryan9600 @pjbgf I don't understand why is the SSH username a prompt instead of a flag to set it. I also don't understand how and why is this used. Please post an example for AWS CodeCommit to show case what this does.

@stefanprodan
Copy link
Member

stefanprodan commented Nov 14, 2022

I propose we undo the --prompt-ssh-username flag, and tell AWS users to provision a SSH key before bootstrap, then they can simply do:

flux bootstrap git \
--url ssh://SSH-Key-ID@git-codecommit.<region>.amazonaws.com/v1/repos/<repository> \
--private-key-file=<path/to/private.key>

We could add a regex for AWS CodeCommit SSH URLs and error out if the private key is not supplied. We also need to add an example like the above to the command help.

cmd/flux/bootstrap_git.go Outdated Show resolved Hide resolved
cmd/flux/bootstrap_git.go Outdated Show resolved Hide resolved
@aryan9600 aryan9600 force-pushed the use-pkg-git branch 2 times, most recently from cfbf96b to 45e10f0 Compare November 17, 2022 11:27
Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

LGTM

Awesome work @aryan9600! 🙇

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Great work 🥇

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
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
Status: Done
Development

Successfully merging this pull request may close these issues.

Refactor Git operations and introduce go-git support for Azure DevOps and AWS CodeCommit
3 participants