Skip to content

Commit 35fdcd6

Browse files
Cr 9208 - added cf context to summary lines (#242)
* added cf context to final params * wip * bump
1 parent 4ab82ff commit 35fdcd6

File tree

5 files changed

+44
-39
lines changed

5 files changed

+44
-39
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.221
1+
VERSION=v0.0.222
22

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

cmd/commands/common.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ import (
2929

3030
"github.com/argoproj-labs/argocd-autopilot/pkg/git"
3131
"github.com/codefresh-io/cli-v2/pkg/config"
32+
cfgit "github.com/codefresh-io/cli-v2/pkg/git"
3233
"github.com/codefresh-io/cli-v2/pkg/log"
3334
"github.com/codefresh-io/cli-v2/pkg/store"
3435
"github.com/codefresh-io/cli-v2/pkg/util"
35-
cfgit "github.com/codefresh-io/cli-v2/pkg/git"
3636

3737
"github.com/manifoldco/promptui"
3838
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -262,17 +262,19 @@ func inferProviderFromRepo(opts *git.CloneOptions) {
262262
}
263263
}
264264

265-
func ensureGitToken(cmd *cobra.Command, cloneOpts *git.CloneOptions) error {
265+
func ensureGitToken(cmd *cobra.Command, cloneOpts *git.CloneOptions, verify bool) error {
266266
if cloneOpts.Auth.Password == "" && !store.Get().Silent {
267267
err := getGitTokenFromUserInput(cmd)
268268
if err != nil {
269269
return err
270270
}
271271
}
272272

273-
err := cfgit.VerifyToken(cmd.Context(), cloneOpts.Provider, cloneOpts.Auth.Password)
274-
if err != nil {
275-
return fmt.Errorf("failed to verify git token: %w", err)
273+
if verify {
274+
err := cfgit.VerifyToken(cmd.Context(), cloneOpts.Provider, cloneOpts.Auth.Password)
275+
if err != nil {
276+
return fmt.Errorf("failed to verify git token: %w", err)
277+
}
276278
}
277279

278280
return nil
@@ -290,7 +292,7 @@ func ensureGitPAT(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
290292

291293
func getGitPATFromUserInput(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
292294
gitPATPrompt := promptui.Prompt{
293-
Label: "Enter your Personal Git Access Token (leave blank to use system token. Can be changed later)",
295+
Label: "Enter your Personal Git Access Token (leave blank to use runtime token. Can be changed later)",
294296
Mask: '*',
295297
}
296298

cmd/commands/runtime.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func NewRuntimeInstallCommand() *cobra.Command {
191191
}
192192

193193
finalParameters = map[string]string{
194+
"Codefresh context": cfConfig.CurrentContext,
194195
"Kube context": installationOpts.kubeContext,
195196
"Runtime name": installationOpts.RuntimeName,
196197
"Repository URL": installationOpts.InsCloneOpts.Repo,
@@ -289,7 +290,7 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
289290

290291
inferProviderFromRepo(opts.InsCloneOpts)
291292

292-
err = ensureGitToken(cmd, opts.InsCloneOpts)
293+
err = ensureGitToken(cmd, opts.InsCloneOpts, true)
293294
handleCliStep(reporter.InstallStepPreCheckEnsureGitToken, "Getting git token", err, false)
294295
if err != nil {
295296
return err
@@ -358,7 +359,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
358359
return fmt.Errorf("%w", err)
359360
}
360361

361-
err = ensureGitToken(cmd, opts.CloneOpts)
362+
err = ensureGitToken(cmd, opts.CloneOpts, false)
362363
handleCliStep(reporter.UninstallStepPreCheckEnsureGitToken, "Getting git token", err, false)
363364
if err != nil {
364365
return fmt.Errorf("%w", err)
@@ -382,7 +383,7 @@ func runtimeUpgradeCommandPreRunHandler(cmd *cobra.Command, args []string, opts
382383
return fmt.Errorf("%w", err)
383384
}
384385

385-
err = ensureGitToken(cmd, opts.CloneOpts)
386+
err = ensureGitToken(cmd, opts.CloneOpts, false)
386387
handleCliStep(reporter.UpgradeStepPreCheckEnsureGitToken, "Getting git token", err, false)
387388
if err != nil {
388389
return fmt.Errorf("%w", err)
@@ -999,9 +1000,10 @@ func NewRuntimeUninstallCommand() *cobra.Command {
9991000
}
10001001

10011002
finalParameters = map[string]string{
1002-
"Kube context": uninstallationOpts.kubeContext,
1003-
"Runtime name": uninstallationOpts.RuntimeName,
1004-
"Repository URL": uninstallationOpts.CloneOpts.Repo,
1003+
"Codefresh context": cfConfig.CurrentContext,
1004+
"Kube context": uninstallationOpts.kubeContext,
1005+
"Runtime name": uninstallationOpts.RuntimeName,
1006+
"Repository URL": uninstallationOpts.CloneOpts.Repo,
10051007
}
10061008

10071009
err = getApprovalFromUser(ctx, finalParameters, "runtime uninstall")
@@ -1136,8 +1138,9 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
11361138
}
11371139

11381140
finalParameters = map[string]string{
1139-
"Runtime name": opts.RuntimeName,
1140-
"Repository URL": opts.CloneOpts.Repo,
1141+
"Codefresh context": cfConfig.CurrentContext,
1142+
"Runtime name": opts.RuntimeName,
1143+
"Repository URL": opts.CloneOpts.Repo,
11411144
}
11421145

11431146
if versionStr != "" {

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.221/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.222/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.221/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.222/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: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
apiVersion: codefresh.io/v1alpha1
22
kind: Runtime
33
metadata:
4-
name: '{{ name }}'
5-
namespace: '{{ namespace }}'
4+
name: "{{ name }}"
5+
namespace: "{{ namespace }}"
66
spec:
7-
defVersion: 1.0.0
8-
version: 0.0.221
9-
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10-
components:
11-
- name: events
12-
type: kustomize
13-
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14-
wait: true
15-
- name: rollouts
16-
type: kustomize
17-
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18-
- name: workflows
19-
type: kustomize
20-
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21-
- name: argocd-agent
22-
type: kustomize
23-
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24-
- name: app-proxy
25-
type: kustomize
26-
url: github.com/codefresh-io/cli-v2/manifests/app-proxy
7+
defVersion: 1.0.0
8+
version: 0.0.222
9+
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10+
components:
11+
- name: events
12+
type: kustomize
13+
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14+
wait: true
15+
- name: rollouts
16+
type: kustomize
17+
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18+
- name: workflows
19+
type: kustomize
20+
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21+
- name: argocd-agent
22+
type: kustomize
23+
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24+
- name: app-proxy
25+
type: kustomize
26+
url: github.com/codefresh-io/cli-v2/manifests/app-proxy

0 commit comments

Comments
 (0)