Skip to content

Commit 9161d8d

Browse files
Cr 15336 (#664)
* added warning message for network errors * reduced timeout for creating analytics reporter * reduced time to check for new cli version to 2s * bump * codegen * fix codegen for new year :)
1 parent ee115de commit 9161d8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+121
-92
lines changed

Makefile

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

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

cmd/commands/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/cluster_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -71,33 +71,33 @@ func Test_sanitizeClusterName(t *testing.T) {
7171
name string
7272
}
7373
tests := []struct {
74-
name string
75-
args args
76-
want string
74+
name string
75+
args args
76+
want string
7777
wantErr bool
7878
}{
7979
{
8080
name: "should return sanitized string",
8181
args: args{
8282
name: "^-.Test!@-:cluster&*`;')test.cluster(-12_3=+::±§.",
8383
},
84-
want: "test----cluster------test-cluster--12-3",
84+
want: "test----cluster------test-cluster--12-3",
8585
wantErr: false,
8686
},
8787
{
8888
name: "should return sanitized string",
8989
args: args{
9090
name: "^-.123test!@-:cluster&*`;')test.cluster(-12_3=+::±§.",
9191
},
92-
want: "test----cluster------test-cluster--12-3",
92+
want: "test----cluster------test-cluster--12-3",
9393
wantErr: false,
9494
},
9595
{
9696
name: "should return error of sanitization failed",
9797
args: args{
9898
name: "12345",
9999
},
100-
want: "",
100+
want: "",
101101
wantErr: true,
102102
},
103103
}

cmd/commands/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/component.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/git-source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/integrations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/runtime.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -576,7 +576,6 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
576576
cfConfig.GetCurrentContext().DefaultRuntime = ""
577577
}
578578

579-
580579
if !opts.Managed {
581580
err = runPostUninstallCleanup(ctx, opts.KubeFactory, opts.RuntimeName)
582581
if err != nil {
@@ -1138,6 +1137,9 @@ func createAnalyticsReporter(ctx context.Context, flow reporter.FlowType, disabl
11381137
return
11391138
}
11401139

1140+
ctx, cancel := context.WithTimeout(ctx, time.Second*5)
1141+
defer cancel()
1142+
11411143
user, err := cfConfig.GetCurrentContext().GetUser(ctx)
11421144
// If error, it will default to noop reporter
11431145
if err != nil {

cmd/commands/runtime_install.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -213,6 +213,8 @@ func NewRuntimeInstallCommand() *cobra.Command {
213213
return fmt.Errorf("installation canceled by user")
214214
}
215215

216+
util.CheckNetworkErr(err)
217+
216218
return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink)
217219
}
218220

@@ -315,6 +317,8 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
315317
opts.runtimeDef = runtime.GetRuntimeDefURL(opts.versionStr)
316318
}
317319

320+
log.G(ctx).Info("Downloading runtime definition file")
321+
318322
runtimeDef := getRuntimeDef(opts.runtimeDef, opts.versionStr)
319323
rt, err := runtime.Download(runtimeDef, opts.RuntimeName, opts.featuresToInstall)
320324
handleCliStep(reporter.InstallStepRunPreCheckDownloadRuntimeDefinition, "Downloading runtime definition", err, true, true)
@@ -629,6 +633,7 @@ func runRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
629633
rt, err := preInstallationChecks(ctx, opts)
630634
handleCliStep(reporter.InstallPhaseRunPreCheckFinish, "Pre run installation checks", err, true, true)
631635
if err != nil {
636+
util.CheckNetworkErr(err)
632637
return fmt.Errorf("pre installation checks failed: %w", err)
633638
}
634639

@@ -644,6 +649,7 @@ func runRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
644649
postInstallationHandler(ctx, opts, err, &opts.DisableRollback)
645650
}()
646651

652+
log.G(ctx).Infof("Creating runtime: \"%s\"", opts.RuntimeName)
647653
token, iv, err := createRuntimeOnPlatform(ctx, opts, rt)
648654
handleCliStep(reporter.InstallStepCreateRuntimeOnPlatform, "Creating runtime on platform", err, false, true)
649655
if err != nil {
@@ -2057,8 +2063,8 @@ func getRuntimeDataFromCodefreshCM(_ context.Context, repofs fs.FS, runtimeName
20572063
func postInstallationHandler(ctx context.Context, opts *RuntimeInstallOptions, err error, disableRollback *bool) {
20582064
if err != nil && !*disableRollback {
20592065
summaryArr = append(summaryArr, summaryLog{"----------Uninstalling runtime----------", Info})
2060-
log.G(ctx).Errorf("installation failed due to error : %s, performing installation rollback", err.Error())
2061-
2066+
log.G(ctx).Errorf("installation failed due to error: %s, performing installation rollback", err.Error())
2067+
util.CheckNetworkErr(err)
20622068
err := runRuntimeUninstall(ctx, &RuntimeUninstallOptions{
20632069
RuntimeName: opts.RuntimeName,
20642070
Timeout: store.Get().WaitTimeout,

cmd/commands/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/commands/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/Masterminds/semver/v3 v3.1.1
7-
github.com/argoproj-labs/argocd-autopilot v0.4.8
7+
github.com/argoproj-labs/argocd-autopilot v0.4.9
88
github.com/argoproj/argo-cd/v2 v2.5.2
99
github.com/argoproj/argo-events v0.17.1-0.20220327045437-70eaafe9afec
1010
github.com/argoproj/argo-workflows/v3 v3.3.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ github.com/antonmedv/expr v1.9.0/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmH
179179
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
180180
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
181181
github.com/appscode/go v0.0.0-20190808133642-1d4ef1f1c1e0/go.mod h1:iy07dV61Z7QQdCKJCIvUoDL21u6AIceRhZzyleh2ymc=
182-
github.com/argoproj-labs/argocd-autopilot v0.4.8 h1:zKqFKDJWxzHiNSjH3mHXV78xKeTQ7iMght7Oy7+bAh8=
183-
github.com/argoproj-labs/argocd-autopilot v0.4.8/go.mod h1:iR9JosRv7UBOQBSDR64Rrg1qs1DURhR+kx8zK2GEap4=
182+
github.com/argoproj-labs/argocd-autopilot v0.4.9 h1:mXptimJTxZhpgq2lRZTQLO4OHyGyNZpsIxYPdWmdnOY=
183+
github.com/argoproj-labs/argocd-autopilot v0.4.9/go.mod h1:iR9JosRv7UBOQBSDR64Rrg1qs1DURhR+kx8zK2GEap4=
184184
github.com/argoproj/argo-cd/v2 v2.5.2 h1:hyPi8NFXW3tG2yURslIMI20GfCdTN1/BDnt4+v5lpoA=
185185
github.com/argoproj/argo-cd/v2 v2.5.2/go.mod h1:3ToENm286PFVlZKNMutBzOwNyhevz4fw9dcgyiq3FIY=
186186
github.com/argoproj/argo-events v0.17.1-0.20220327045437-70eaafe9afec h1:95S2LPUUdPO2jYxuR5z1uk1GL2m/u+ud2iFAr5gK6VI=

hack/cmd-docs/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

hack/license.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/mocks/roundTripper.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/git/provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ func GetProvider(providerType ProviderType, baseURL, certFile string) (Provider,
9494
return nil, fmt.Errorf("failed getting provider for clone url %s", baseURL)
9595
}
9696

97-
func getGitProviderFromUserSelect(baseURL string, client *http.Client) (Provider) {
97+
func getGitProviderFromUserSelect(baseURL string, client *http.Client) Provider {
9898
var providers = map[string]func(string, *http.Client) (Provider, error){
9999
"Bitbucket": NewBitbucketServerProvider,
100100
"GitHub": NewGithubProvider,

pkg/git/provider_bitbucket-server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_bitbucket-server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_bitbucket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_bitbucket_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_github_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_gitlab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/git/provider_gitlab_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/log/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/log/logrus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/reporter/reporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/runtime/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/store/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/util/aputil/aputil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/util/cd/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

pkg/util/cli/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ import (
3838
// we don't want to slow down the cli so it is noticable
3939
// so you get 2 seconds to check the version, which should
4040
// be enough for most configurations
41-
var getVersionTimeout = time.Second * 30
41+
var getVersionTimeout = time.Second * 2
4242

4343
const (
4444
color = "\u001b[38;5;220m"

pkg/util/events/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 The Codefresh Authors.
1+
// Copyright 2023 The Codefresh Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)