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

570 external git server #646

Closed
wants to merge 18 commits into from
Closed

570 external git server #646

wants to merge 18 commits into from

Conversation

YrrepNoj
Copy link
Contributor

@YrrepNoj YrrepNoj commented Jul 28, 2022

Fixes #570

@YrrepNoj YrrepNoj requested review from jeff-mccoy and Racer159 July 28, 2022 19:48
@YrrepNoj YrrepNoj marked this pull request as ready for review July 28, 2022 20:10
Makefile Outdated Show resolved Hide resolved
Racer159
Racer159 previously approved these changes Jul 29, 2022
src/internal/git/push.go Outdated Show resolved Hide resolved
Racer159
Racer159 previously approved these changes Jul 29, 2022
Copy link
Contributor

@jeff-mccoy jeff-mccoy left a comment

Choose a reason for hiding this comment

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

Will continue PR review after we work through these comments--this is going to be a great option for larger deployments and lays the needed groundwork for external registry support 🥳

Makefile Show resolved Hide resolved
src/cmd/initialize.go Outdated Show resolved Hide resolved
src/cmd/initialize.go Outdated Show resolved Hide resolved
src/cmd/tools.go Outdated Show resolved Hide resolved
src/internal/agent/hooks/flux.go Outdated Show resolved Hide resolved
src/internal/git/push.go Outdated Show resolved Hide resolved
src/internal/git/push.go Show resolved Hide resolved
src/internal/k8s/tunnel.go Show resolved Hide resolved
src/internal/k8s/tunnel.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@YrrepNoj YrrepNoj force-pushed the 570-external-git-server branch 2 times, most recently from a3fb178 to e6240a0 Compare August 3, 2022 02:49
Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@jeff-mccoy jeff-mccoy left a comment

Choose a reason for hiding this comment

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

Left more comments, happy to discuss further--think it's getting pretty close and is a major enhancement to zarf's deployment flexibility, thanks!

YrrepNoj added 12 commits August 9, 2022 01:43
general cleanup and oranization of functions in hooks package for zarf agent
Makes sure the svc url comes at the end of the provided URL. This captures edge cases where someone has a subdomain that looks just like a service url would. eg) https://svc.cluster.local.example.com
update GitHub workflows to not explicitly create init-package if it's not needed (if it already exists)
The get-admin-password was a bad name because it wasn't clear what 'admin' meant. We are now making the name more explicit
update the flag git-username to git-account and add a note in the usage text to describe what to do if the repository belongs under an org
verify that the git-user and git-password has been provided if using an external git server
give users the ability to set some of the flags for the GitServerInfo without needing to host an extneral repository
@YrrepNoj YrrepNoj force-pushed the 570-external-git-server branch from f8ac796 to e9b270d Compare August 9, 2022 05:49
@@ -34,15 +36,28 @@ func NewGitRepositoryMutationHook() operations.Hook {
func mutateGitRepository(r *v1.AdmissionRequest) (*operations.Result, error) {
var patches []operations.PatchOperation

zarfState, err := getZarfStateFromFileWithinAgentPod(zarfStatePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be shortened to just getZarfStateFromAgent (or similar)? getZarfStateFromFileWithinAgentPod is a little long

// Form the gitServerURL from the state
gitServerURL := zarfState.GitServer.Address
if zarfState.GitServer.Port != 0 {
gitServerURL += fmt.Sprintf(":%d", zarfState.GitServer.Port)
Copy link
Contributor

Choose a reason for hiding this comment

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

What I said above is not true though when using a non-default port. If I hosted gittea behind an nginx server and rewrote a subpath to point to my git server then this would result in something like: https://example.com/my-scm:5000...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case you could add the port as a string within the server URL and just not populate the port flag. If we ever actually need the port we could try to parse the port using net/url.

@Racer159 Do you think this works or do you think we need to come up with a more robust solution?

Copy link
Contributor

@Racer159 Racer159 Aug 12, 2022

Choose a reason for hiding this comment

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

I think that works, but at that point why specify the port as a separate flag at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point, I thought it would have been needed earlier but I'll just give the url

src/internal/git/push.go Show resolved Hide resolved
src/test/external-git/README.md Show resolved Hide resolved
@YrrepNoj
Copy link
Contributor Author

Closing this as it's being duplicated by #666 along with other features (handling an external container registry)

@YrrepNoj YrrepNoj closed this Aug 13, 2022
@YrrepNoj YrrepNoj deleted the 570-external-git-server branch September 19, 2022 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for using external Gitlab instead of gitea on zarf init
3 participants