Skip to content

Commit e7eb5ef

Browse files
CR-6176-list-with-version-and-cluster (#79)
* added label, error instead of panic * typo * retries at beginning of interval func * fix runtime list command * updated version to 0.0.84 Co-authored-by: Noam Gal <noam.gal@codefresh.io>
1 parent d7c0ad7 commit e7eb5ef

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
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.83
1+
VERSION=v0.0.84
22
OUT_DIR=dist
33
YEAR?=$(shell date +"%Y")
44

cmd/commands/runtime.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
296296
var wg sync.WaitGroup
297297

298298
wg.Add(1)
299-
go intervalCheckIsRuntimePersisted(15000, ctx, opts.RuntimeName, &wg)
299+
err = intervalCheckIsRuntimePersisted(15000, ctx, opts.RuntimeName, &wg)
300+
if err != nil {
301+
return fmt.Errorf("failed to complete installation. Error: %w", err)
302+
}
300303
wg.Wait()
301304

302305
log.G(ctx).Infof("done installing runtime '%s'", opts.RuntimeName)
@@ -372,12 +375,13 @@ func checkExistingRuntimes(ctx context.Context, runtime string) error {
372375
return nil
373376
}
374377

375-
func intervalCheckIsRuntimePersisted(milliseconds int, ctx context.Context, runtimeName string, wg *sync.WaitGroup) {
378+
func intervalCheckIsRuntimePersisted(milliseconds int, ctx context.Context, runtimeName string, wg *sync.WaitGroup) error {
376379
interval := time.Duration(milliseconds) * time.Millisecond
377380
ticker := time.NewTicker(interval)
378381
var err error
379382

380383
for retries := 20; retries > 0; <-ticker.C {
384+
retries--
381385
fmt.Println("waiting for the runtime installation to complete...")
382386
var runtimes []model.Runtime
383387
runtimes, err = cfConfig.NewClient().V2().Runtime().List(ctx)
@@ -389,14 +393,13 @@ func intervalCheckIsRuntimePersisted(milliseconds int, ctx context.Context, runt
389393
if rt.Metadata.Name == runtimeName {
390394
wg.Done()
391395
ticker.Stop()
392-
return
396+
return nil
393397
}
394398
}
395399

396-
retries--
397400
}
398401

399-
panic(fmt.Errorf("failed to complete the runtime installation due to error: %w", err))
402+
return fmt.Errorf("failed to complete the runtime installation due to timeout. Error: %w", err)
400403
}
401404

402405
func NewRuntimeListCommand() *cobra.Command {
@@ -432,7 +435,7 @@ func RunRuntimeList(ctx context.Context) error {
432435
status := "N/A"
433436
namespace := "N/A"
434437
cluster := "N/A"
435-
name := "N/A"
438+
name := rt.Metadata.Name
436439
version := "N/A"
437440

438441
if rt.Self.HealthMessage != nil {
@@ -447,10 +450,6 @@ func RunRuntimeList(ctx context.Context) error {
447450
cluster = *rt.Cluster
448451
}
449452

450-
if rt.Metadata.Name != "" {
451-
name = rt.Metadata.Name
452-
}
453-
454453
if rt.RuntimeVersion != nil {
455454
version = *rt.RuntimeVersion
456455
}

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cf version
2020
### Linux
2121
```bash
2222
# download and extract the binary
23-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.83/cf-linux-amd64.tar.gz | tar zx
23+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.84/cf-linux-amd64.tar.gz | tar zx
2424

2525
# move the binary to your $PATH
2626
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -32,7 +32,7 @@ cf version
3232
### Mac
3333
```bash
3434
# download and extract the binary
35-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.83/cf-darwin-amd64.tar.gz | tar zx
35+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.84/cf-darwin-amd64.tar.gz | tar zx
3636

3737
# move the binary to your $PATH
3838
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.0
8-
version: 0.0.83
8+
version: 0.0.84
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

pkg/runtime/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (r *Runtime) Save(fs fs.FS, filename string, config *CommonConfig) error {
153153
Name: store.Get().CodefreshCM,
154154
Namespace: r.Namespace,
155155
Labels: map[string]string{
156-
apstore.Default.LabelKeyAppManagedBy: store.Get().BinaryName,
156+
apstore.Default.LabelKeyAppManagedBy: store.Get().Codefresh,
157157
store.Get().LabelKeyCFType: store.Get().CFRuntimeDefType,
158158
},
159159
},

pkg/store/store.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type Store struct {
4949
ArgoWFServiceName string
5050
ArgoWFServicePort int32
5151
BinaryName string
52+
Codefresh string
5253
CFComponentType string
5354
CFGitSourceType string
5455
CFRuntimeDefType string
@@ -91,6 +92,7 @@ func init() {
9192
s.ArgoWFServiceName = "argo-server"
9293
s.ArgoWFServicePort = 2746
9394
s.BinaryName = binaryName
95+
s.Codefresh = "codefresh"
9496
s.CFComponentType = "component"
9597
s.CFGitSourceType = "git-source"
9698
s.CFRuntimeDefType = "runtimeDef"

0 commit comments

Comments
 (0)