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

bootstrapping: added validation case for repo url without scheme #3664

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

enekofb
Copy link
Contributor

@enekofb enekofb commented Nov 22, 2023

Part of #3659

What changed?

  • Handled validation case where repo URL does not have scheme
  • Refactored git repo configuration

Why was this change made?

  • We currently do not support git repo URLs without scheme but the validation of the repo configuration didn't support it so translated into a internal error instead of user input. this PR changes this.

How was this change implemented?

How did you validate the change?

  • Explain how a reviewer can verify the change themselves

Run bootstrapping with a repo URL without scheme ... you should see an error

➜  weave-gitops-enterprise git:(wge-3659-validation-ssh) ✗ go run cmd/gitops/main.go bootstrap \                                         <aws:sts>
     --private-key=abc  --private-key-password="" \
     --version="0.36.0" \
     --domain-type="localhost" \
     --password="admin123"  \
     --branch="main"  \
     --repo-path=clusters/management


► creating client to cluster
✔ created client to cluster: https://127.0.0.1:63867
◎ checking flux
► verifying flux installation
✗ flux installed error: ► checking prerequisites
✔ Kubernetes 1.27.3 >=1.25.0-0
► checking controllers
✗ no controllers found in the 'flux-system' namespace with the label selector 'app.kubernetes.io/part-of=flux'
► checking crds
✗ no crds found with the label selector 'app.kubernetes.io/part-of=flux'
✗ check failed
. flux is not bootstrapped in 'flux-system' namespace: more info https://fluxcd.io/flux/installation
◎ bootstrap flux
? do you want to bootstrap flux using the generic way? [y/N] y█
◎ flux repository configuration
please enter your flux git https or ssh repository url: [email protected]/enekofb/cli-dev
Error: cannot execute bootstrap: cannot execute 'flux repository configuration': error creating git repository configuration: error parsing repo scheme: repository scheme cannot be empty
exit status 1


  • Unit tests -- what is covered, what cannot be covered; are
    there tests that fail without the change?

Added validation test case for the empty scheme scenario

Release notes

Documentation Changes

Other follow ups

@enekofb enekofb added the bug Something isn't working label Nov 22, 2023
@enekofb enekofb marked this pull request as ready for review November 22, 2023 09:29
Copy link
Contributor

@waleedhammam waleedhammam left a comment

Choose a reason for hiding this comment

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

LGTM

@enekofb enekofb force-pushed the wge-3659-validation-ssh branch from 2394c3f to 883b0ae Compare November 22, 2023 09:36
@enekofb enekofb merged commit 9948a1f into main Nov 22, 2023
10 checks passed
@enekofb enekofb deleted the wge-3659-validation-ssh branch November 22, 2023 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants