mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
Don't ask for user credentials if username and password are specified as arguments (#129)
* Don't ask for user credentials if username and password are specified as arguments * Add cli image make target * Don't re-prompt username/password in PromptCredentials
This commit is contained in:
parent
38d20d0f04
commit
11260f2476
4 changed files with 9 additions and 8 deletions
7
Makefile
7
Makefile
|
|
@ -101,6 +101,11 @@ controller-image:
|
|||
docker build --build-arg BINARY=argocd-application-controller --build-arg MAKE_TARGET=controller -t $(IMAGE_PREFIX)argocd-application-controller:$(IMAGE_TAG) -f Dockerfile-argocd .
|
||||
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-application-controller:$(IMAGE_TAG) ; fi
|
||||
|
||||
.PHONY: cli-image
|
||||
cli-image:
|
||||
docker build --build-arg BINARY=argocd --build-arg MAKE_TARGET=cli -t $(IMAGE_PREFIX)argocd-cli:$(IMAGE_TAG) -f Dockerfile-argocd .
|
||||
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argocd-cli:$(IMAGE_TAG) ; fi
|
||||
|
||||
.PHONY: builder-image
|
||||
builder-image:
|
||||
docker build -t $(IMAGE_PREFIX)argo-cd-ci-builder:$(IMAGE_TAG) -f Dockerfile-ci-builder .
|
||||
|
|
@ -130,4 +135,4 @@ release-precheck:
|
|||
@if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi
|
||||
|
||||
.PHONY: release
|
||||
release: release-precheck precheckin cli-darwin cli-linux server-image controller-image repo-server-image
|
||||
release: release-precheck precheckin cli-darwin cli-linux server-image controller-image repo-server-image cli-image
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func NewLoginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comman
|
|||
}
|
||||
}
|
||||
|
||||
username, password = cli.PromptCredentials()
|
||||
username, password = cli.PromptCredentials(username, password)
|
||||
|
||||
clientOpts := argocdclient.ClientOptions{
|
||||
ConfigPath: "",
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
|
|||
log.Fatal(err)
|
||||
}
|
||||
// If we can't test the repo, it's probably private. Prompt for credentials and try again.
|
||||
repo.Username, repo.Password = cli.PromptCredentials()
|
||||
repo.Username, repo.Password = cli.PromptCredentials(repo.Username, repo.Password)
|
||||
err = git.TestRepo(repo.Repo, repo.Username, repo.Password, repo.SSHPrivateKey)
|
||||
}
|
||||
errors.CheckError(err)
|
||||
|
|
|
|||
|
|
@ -56,11 +56,7 @@ func AddKubectlFlagsToCmd(cmd *cobra.Command) clientcmd.ClientConfig {
|
|||
}
|
||||
|
||||
// PromptCredentials is a helper to prompt the user for a username and password
|
||||
func PromptCredentials() (string, string) {
|
||||
var (
|
||||
username string
|
||||
password string
|
||||
)
|
||||
func PromptCredentials(username, password string) (string, string) {
|
||||
for username == "" {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print("Username: ")
|
||||
|
|
|
|||
Loading…
Reference in a new issue