Skip to content

Commit ddae784

Browse files
CR-9441 remove PAT request from wizard (#257)
* removed PAT request from wizard * bump * changed info message * small change
1 parent 27c6ff8 commit ddae784

File tree

5 files changed

+11
-42
lines changed

5 files changed

+11
-42
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.0.239
1+
VERSION=v0.0.240
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/common.go

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -291,47 +291,16 @@ func ensureGitToken(cmd *cobra.Command, cloneOpts *git.CloneOptions, verify bool
291291
}
292292

293293
func ensureGitPAT(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
294-
var err error
295-
tokenFromFlag := opts.GitIntegrationRegistrationOpts.Token
296-
297-
if tokenFromFlag == "" {
298-
if !store.Get().Silent {
299-
err = getGitPATFromUserInput(cmd, opts)
300-
if err != nil {
301-
return err
302-
}
303-
} else {
304-
log.G(cmd.Context()).Info("Using runtime token as personal user token")
305-
opts.GitIntegrationRegistrationOpts.Token = opts.InsCloneOpts.Auth.Password
306-
if err != nil {
307-
return err
308-
}
309-
}
310-
}
311-
312-
return cfgit.VerifyToken(cmd.Context(), opts.InsCloneOpts.Provider, opts.GitIntegrationRegistrationOpts.Token, cfgit.PersonalToken)
313-
}
314-
315-
func getGitPATFromUserInput(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
316-
gitPATPrompt := promptui.Prompt{
317-
Label: "Personal git token for your user (skip to use runtime token)",
318-
Mask: '*',
319-
}
320-
321-
gitPAT, err := gitPATPrompt.Run()
322-
if err != nil {
323-
return err
324-
}
325-
326-
if gitPAT == "" {
327-
gitPAT, err = cmd.Flags().GetString("git-token")
294+
if opts.GitIntegrationRegistrationOpts.Token == "" {
295+
opts.GitIntegrationRegistrationOpts.Token = opts.InsCloneOpts.Auth.Password
296+
currentUser, err := cfConfig.NewClient().Users().GetCurrent(cmd.Context())
328297
if err != nil {
329-
return fmt.Errorf("%w", err)
298+
return fmt.Errorf("failed to retrieve username from platform: %w", err)
330299
}
300+
log.G(cmd.Context()).Infof("Personal git token was not provided. Using runtime git token to register user: \"%s\". You may replace your personal git token at any time from the UI in the user settings", currentUser.Name)
331301
}
332-
opts.GitIntegrationRegistrationOpts.Token = gitPAT
333302

334-
return nil
303+
return cfgit.VerifyToken(cmd.Context(), opts.InsCloneOpts.Provider, opts.GitIntegrationRegistrationOpts.Token, cfgit.PersonalToken)
335304
}
336305

337306
func getGitTokenFromUserInput(cmd *cobra.Command) error {

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.239/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.240/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.239/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.240/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.1
8-
version: 0.0.239
8+
version: 0.0.240
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

pkg/git/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func verifyGitHubTokenScope(ctx context.Context, token string, tokenType TokenTy
9292
}
9393
}
9494

95-
log.G(ctx).Info("Token verified")
95+
log.G(ctx).Infof("%s verified", tokenType)
9696

9797
return nil
9898
}

0 commit comments

Comments
 (0)