mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
chore: add gofmt to golangci-lint in Makefile and .github/workflows/ci-build.yaml (#13729)
* fix: add gofmt to golangci-lint in Makefile and .github/workflows/ci-build.yaml Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> * fix go formatting issues using gofmt Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> * chore: simplify go code using gofmt Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com> --------- Signed-off-by: Denis Dupeyron <denis.dupeyron@gmail.com>
This commit is contained in:
2
.github/workflows/ci-build.yaml
vendored
2
.github/workflows/ci-build.yaml
vendored
@@ -79,7 +79,7 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
|
||||
with:
|
||||
version: v1.51.0
|
||||
args: --timeout 10m --exclude SA5011 --verbose
|
||||
args: --enable gofmt --timeout 10m --exclude SA5011 --verbose --max-issues-per-linter 0 --max-same-issues 0
|
||||
|
||||
test-go:
|
||||
name: Run unit tests for Go packages
|
||||
|
||||
4
Makefile
4
Makefile
@@ -352,7 +352,7 @@ lint-local:
|
||||
golangci-lint --version
|
||||
# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC
|
||||
# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
||||
GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --fix --verbose --timeout 3000s
|
||||
GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --enable gofmt --fix --verbose --timeout 3000s --max-issues-per-linter 0 --max-same-issues 0
|
||||
|
||||
.PHONY: lint-ui
|
||||
lint-ui: test-tools-image
|
||||
@@ -651,4 +651,4 @@ help:
|
||||
@echo 'codegen:'
|
||||
@echo ' codegen(-local) -- if using -local, run the following targets first'
|
||||
@echo ' install-codegen-tools-local -- run this to install the codegen tools'
|
||||
@echo ' install-go-tools-local -- run this to install go libraries for codegen'
|
||||
@echo ' install-go-tools-local -- run this to install go libraries for codegen'
|
||||
|
||||
@@ -82,7 +82,7 @@ func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appli
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error unmarshling decoded ElementsYaml %v", err)
|
||||
}
|
||||
res = append(res, yamlElements...)
|
||||
res = append(res, yamlElements...)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
|
||||
return pullrequest.NewFakeService(
|
||||
ctx,
|
||||
[]*pullrequest.PullRequest{
|
||||
&pullrequest.PullRequest{
|
||||
{
|
||||
Number: 1,
|
||||
Branch: "branch1",
|
||||
TargetBranch: "master",
|
||||
@@ -56,7 +56,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
|
||||
return pullrequest.NewFakeService(
|
||||
ctx,
|
||||
[]*pullrequest.PullRequest{
|
||||
&pullrequest.PullRequest{
|
||||
{
|
||||
Number: 2,
|
||||
Branch: "feat/areally+long_pull_request_name_to_test_argo_slugification_and_branch_name_shortening_feature",
|
||||
TargetBranch: "feat/anotherreally+long_pull_request_name_to_test_argo_slugification_and_branch_name_shortening_feature",
|
||||
@@ -85,7 +85,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
|
||||
return pullrequest.NewFakeService(
|
||||
ctx,
|
||||
[]*pullrequest.PullRequest{
|
||||
&pullrequest.PullRequest{
|
||||
{
|
||||
Number: 1,
|
||||
Branch: "a-very-short-sha",
|
||||
TargetBranch: "master",
|
||||
@@ -125,7 +125,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
|
||||
return pullrequest.NewFakeService(
|
||||
ctx,
|
||||
[]*pullrequest.PullRequest{
|
||||
&pullrequest.PullRequest{
|
||||
{
|
||||
Number: 1,
|
||||
Branch: "branch1",
|
||||
TargetBranch: "master",
|
||||
@@ -162,7 +162,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
|
||||
return pullrequest.NewFakeService(
|
||||
ctx,
|
||||
[]*pullrequest.PullRequest{
|
||||
&pullrequest.PullRequest{
|
||||
{
|
||||
Number: 1,
|
||||
Branch: "branch1",
|
||||
TargetBranch: "master",
|
||||
|
||||
@@ -108,26 +108,26 @@ func TestSCMProviderGenerateParams(t *testing.T) {
|
||||
},
|
||||
expected: []map[string]interface{}{
|
||||
{
|
||||
"organization": "myorg",
|
||||
"repository": "repo1",
|
||||
"url": "git@github.com:myorg/repo1.git",
|
||||
"branch": "main",
|
||||
"organization": "myorg",
|
||||
"repository": "repo1",
|
||||
"url": "git@github.com:myorg/repo1.git",
|
||||
"branch": "main",
|
||||
"branchNormalized": "main",
|
||||
"sha": "0bc57212c3cbbec69d20b34c507284bd300def5b",
|
||||
"short_sha": "0bc57212",
|
||||
"short_sha_7": "0bc5721",
|
||||
"labels": "prod,staging",
|
||||
"sha": "0bc57212c3cbbec69d20b34c507284bd300def5b",
|
||||
"short_sha": "0bc57212",
|
||||
"short_sha_7": "0bc5721",
|
||||
"labels": "prod,staging",
|
||||
},
|
||||
{
|
||||
"organization": "myorg",
|
||||
"repository": "repo2",
|
||||
"url": "git@github.com:myorg/repo2.git",
|
||||
"branch": "main",
|
||||
"organization": "myorg",
|
||||
"repository": "repo2",
|
||||
"url": "git@github.com:myorg/repo2.git",
|
||||
"branch": "main",
|
||||
"branchNormalized": "main",
|
||||
"sha": "59d0",
|
||||
"short_sha": "59d0",
|
||||
"short_sha_7": "59d0",
|
||||
"labels": "",
|
||||
"sha": "59d0",
|
||||
"short_sha": "59d0",
|
||||
"short_sha_7": "59d0",
|
||||
"labels": "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -269,9 +269,9 @@ func TestGetGiteaPRLabelNames(t *testing.T) {
|
||||
{
|
||||
Name: "PR has labels",
|
||||
PullLabels: []*gitea.Label{
|
||||
&gitea.Label{Name: "label1"},
|
||||
&gitea.Label{Name: "label2"},
|
||||
&gitea.Label{Name: "label3"},
|
||||
{Name: "label1"},
|
||||
{Name: "label2"},
|
||||
{Name: "label3"},
|
||||
},
|
||||
ExpectedResult: []string{"label1", "label2", "label3"},
|
||||
},
|
||||
|
||||
@@ -22,9 +22,9 @@ func TestContainLabels(t *testing.T) {
|
||||
Name: "Match labels",
|
||||
Labels: []string{"label1", "label2"},
|
||||
PullLabels: []*github.Label{
|
||||
&github.Label{Name: toPtr("label1")},
|
||||
&github.Label{Name: toPtr("label2")},
|
||||
&github.Label{Name: toPtr("label3")},
|
||||
{Name: toPtr("label1")},
|
||||
{Name: toPtr("label2")},
|
||||
{Name: toPtr("label3")},
|
||||
},
|
||||
Expect: true,
|
||||
},
|
||||
@@ -32,9 +32,9 @@ func TestContainLabels(t *testing.T) {
|
||||
Name: "Not match labels",
|
||||
Labels: []string{"label1", "label4"},
|
||||
PullLabels: []*github.Label{
|
||||
&github.Label{Name: toPtr("label1")},
|
||||
&github.Label{Name: toPtr("label2")},
|
||||
&github.Label{Name: toPtr("label3")},
|
||||
{Name: toPtr("label1")},
|
||||
{Name: toPtr("label2")},
|
||||
{Name: toPtr("label3")},
|
||||
},
|
||||
Expect: false,
|
||||
},
|
||||
@@ -42,9 +42,9 @@ func TestContainLabels(t *testing.T) {
|
||||
Name: "No specify",
|
||||
Labels: []string{},
|
||||
PullLabels: []*github.Label{
|
||||
&github.Label{Name: toPtr("label1")},
|
||||
&github.Label{Name: toPtr("label2")},
|
||||
&github.Label{Name: toPtr("label3")},
|
||||
{Name: toPtr("label1")},
|
||||
{Name: toPtr("label2")},
|
||||
{Name: toPtr("label3")},
|
||||
},
|
||||
Expect: true,
|
||||
},
|
||||
@@ -68,9 +68,9 @@ func TestGetGitHubPRLabelNames(t *testing.T) {
|
||||
{
|
||||
Name: "PR has labels",
|
||||
PullLabels: []*github.Label{
|
||||
&github.Label{Name: toPtr("label1")},
|
||||
&github.Label{Name: toPtr("label2")},
|
||||
&github.Label{Name: toPtr("label3")},
|
||||
{Name: toPtr("label1")},
|
||||
{Name: toPtr("label2")},
|
||||
{Name: toPtr("label3")},
|
||||
},
|
||||
ExpectedResult: []string{"label1", "label2", "label3"},
|
||||
},
|
||||
|
||||
@@ -3,5 +3,6 @@ package assets
|
||||
import "embed"
|
||||
|
||||
// Embedded contains embedded assets
|
||||
//
|
||||
//go:embed *
|
||||
var Embedded embed.FS
|
||||
|
||||
@@ -307,8 +307,8 @@ func Test_groupObjsByKey(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := map[kube.ResourceKey]*unstructured.Unstructured{
|
||||
kube.ResourceKey{Group: "", Kind: "Pod", Namespace: "default", Name: "pod-name"}: localObjs[0],
|
||||
kube.ResourceKey{Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition", Namespace: "", Name: "certificates.cert-manager.io"}: localObjs[1],
|
||||
{Group: "", Kind: "Pod", Namespace: "default", Name: "pod-name"}: localObjs[0],
|
||||
{Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition", Namespace: "", Name: "certificates.cert-manager.io"}: localObjs[1],
|
||||
}
|
||||
|
||||
objByKey := groupObjsByKey(localObjs, liveObjs, "default")
|
||||
|
||||
@@ -40,12 +40,12 @@ func TestPrintApplicationSetTable(t *testing.T) {
|
||||
},
|
||||
Spec: v1alpha1.ApplicationSetSpec{
|
||||
Generators: []v1alpha1.ApplicationSetGenerator{
|
||||
v1alpha1.ApplicationSetGenerator{
|
||||
{
|
||||
Git: &v1alpha1.GitGenerator{
|
||||
RepoURL: "https://github.com/argoproj/argo-cd.git",
|
||||
Revision: "head",
|
||||
Directories: []v1alpha1.GitDirectoryGeneratorItem{
|
||||
v1alpha1.GitDirectoryGeneratorItem{
|
||||
{
|
||||
Path: "applicationset/examples/git-generator-directory/cluster-addons/*",
|
||||
},
|
||||
},
|
||||
@@ -60,7 +60,7 @@ func TestPrintApplicationSetTable(t *testing.T) {
|
||||
},
|
||||
Status: v1alpha1.ApplicationSetStatus{
|
||||
Conditions: []v1alpha1.ApplicationSetCondition{
|
||||
v1alpha1.ApplicationSetCondition{
|
||||
{
|
||||
Status: v1alpha1.ApplicationSetConditionStatusTrue,
|
||||
Type: v1alpha1.ApplicationSetConditionResourcesUpToDate,
|
||||
},
|
||||
@@ -75,12 +75,12 @@ func TestPrintApplicationSetTable(t *testing.T) {
|
||||
},
|
||||
Spec: v1alpha1.ApplicationSetSpec{
|
||||
Generators: []v1alpha1.ApplicationSetGenerator{
|
||||
v1alpha1.ApplicationSetGenerator{
|
||||
{
|
||||
Git: &v1alpha1.GitGenerator{
|
||||
RepoURL: "https://github.com/argoproj/argo-cd.git",
|
||||
Revision: "head",
|
||||
Directories: []v1alpha1.GitDirectoryGeneratorItem{
|
||||
v1alpha1.GitDirectoryGeneratorItem{
|
||||
{
|
||||
Path: "applicationset/examples/git-generator-directory/cluster-addons/*",
|
||||
},
|
||||
},
|
||||
@@ -95,7 +95,7 @@ func TestPrintApplicationSetTable(t *testing.T) {
|
||||
},
|
||||
Status: v1alpha1.ApplicationSetStatus{
|
||||
Conditions: []v1alpha1.ApplicationSetCondition{
|
||||
v1alpha1.ApplicationSetCondition{
|
||||
{
|
||||
Status: v1alpha1.ApplicationSetConditionStatusTrue,
|
||||
Type: v1alpha1.ApplicationSetConditionResourcesUpToDate,
|
||||
},
|
||||
@@ -118,12 +118,12 @@ func TestPrintAppSetSummaryTable(t *testing.T) {
|
||||
},
|
||||
Spec: v1alpha1.ApplicationSetSpec{
|
||||
Generators: []v1alpha1.ApplicationSetGenerator{
|
||||
v1alpha1.ApplicationSetGenerator{
|
||||
{
|
||||
Git: &v1alpha1.GitGenerator{
|
||||
RepoURL: "https://github.com/argoproj/argo-cd.git",
|
||||
Revision: "head",
|
||||
Directories: []v1alpha1.GitDirectoryGeneratorItem{
|
||||
v1alpha1.GitDirectoryGeneratorItem{
|
||||
{
|
||||
Path: "applicationset/examples/git-generator-directory/cluster-addons/*",
|
||||
},
|
||||
},
|
||||
@@ -138,7 +138,7 @@ func TestPrintAppSetSummaryTable(t *testing.T) {
|
||||
},
|
||||
Status: v1alpha1.ApplicationSetStatus{
|
||||
Conditions: []v1alpha1.ApplicationSetCondition{
|
||||
v1alpha1.ApplicationSetCondition{
|
||||
{
|
||||
Status: v1alpha1.ApplicationSetConditionStatusTrue,
|
||||
Type: v1alpha1.ApplicationSetConditionResourcesUpToDate,
|
||||
},
|
||||
|
||||
@@ -5,5 +5,6 @@ import (
|
||||
)
|
||||
|
||||
// Embedded contains embedded resource customization
|
||||
//
|
||||
//go:embed *
|
||||
var Embedded embed.FS
|
||||
|
||||
@@ -18,12 +18,12 @@ import (
|
||||
"github.com/argoproj/argo-cd/v2/util/settings"
|
||||
)
|
||||
|
||||
//NewHandler creates handler serving to do api/badge endpoint
|
||||
// NewHandler creates handler serving to do api/badge endpoint
|
||||
func NewHandler(appClientset versioned.Interface, settingsMrg *settings.SettingsManager, namespace string) http.Handler {
|
||||
return &Handler{appClientset: appClientset, namespace: namespace, settingsMgr: settingsMrg}
|
||||
}
|
||||
|
||||
//Handler used to get application in order to access health/sync
|
||||
// Handler used to get application in order to access health/sync
|
||||
type Handler struct {
|
||||
namespace string
|
||||
appClientset versioned.Interface
|
||||
@@ -62,8 +62,8 @@ func replaceFirstGroupSubMatch(re *regexp.Regexp, str string, repl string) strin
|
||||
return result + str[lastIndex:]
|
||||
}
|
||||
|
||||
//ServeHTTP returns badge with health and sync status for application
|
||||
//(or an error badge if wrong query or application name is given)
|
||||
// ServeHTTP returns badge with health and sync status for application
|
||||
// (or an error badge if wrong query or application name is given)
|
||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
health := healthutil.HealthStatusUnknown
|
||||
status := appv1.SyncStatusCodeUnknown
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/argoproj/argo-cd/v2/util/settings"
|
||||
)
|
||||
|
||||
//NewHandler creates handler serving to do api/logout endpoint
|
||||
// NewHandler creates handler serving to do api/logout endpoint
|
||||
func NewHandler(appClientset versioned.Interface, settingsMrg *settings.SettingsManager, sessionMgr *session.SessionManager, rootPath, baseHRef, namespace string) *Handler {
|
||||
return &Handler{
|
||||
appClientset: appClientset,
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestJsonnetExtVarEnv(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
//Jsonnet file located in nested sub directory uses import
|
||||
// Jsonnet file located in nested sub directory uses import
|
||||
func TestJsonnetNestedDirWithImports(t *testing.T) {
|
||||
Given(t).
|
||||
Path("jsonnet-nested-dir-with-imports/apps").
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestNotificationsListServices(t *testing.T) {
|
||||
SetParamInNotificationConfigMap("service.webhook.test", "url: https://test.com").
|
||||
Then().Services(func(services *notification.ServiceList, err error) {
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []*notification.Service{¬ification.Service{Name: pointer.String("test")}}, services.Items)
|
||||
assert.Equal(t, []*notification.Service{{Name: pointer.String("test")}}, services.Items)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestNotificationsListTemplates(t *testing.T) {
|
||||
SetParamInNotificationConfigMap("template.app-created", "email:\n subject: Application {{.app.metadata.name}} has been created.\nmessage: Application {{.app.metadata.name}} has been created.\nteams:\n title: Application {{.app.metadata.name}} has been created.\n").
|
||||
Then().Templates(func(templates *notification.TemplateList, err error) {
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []*notification.Template{¬ification.Template{Name: pointer.String("app-created")}}, templates.Items)
|
||||
assert.Equal(t, []*notification.Template{{Name: pointer.String("app-created")}}, templates.Items)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ func TestNotificationsListTriggers(t *testing.T) {
|
||||
SetParamInNotificationConfigMap("trigger.on-created", "- description: Application is created.\n oncePer: app.metadata.name\n send:\n - app-created\n when: \"true\"\n").
|
||||
Then().Triggers(func(triggers *notification.TriggerList, err error) {
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []*notification.Trigger{¬ification.Trigger{Name: pointer.String("on-created")}}, triggers.Items)
|
||||
assert.Equal(t, []*notification.Trigger{{Name: pointer.String("on-created")}}, triggers.Items)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func TestSelectiveSyncWithoutNamespace(t *testing.T) {
|
||||
Expect(ResourceSyncStatusWithNamespaceIs("Deployment", "guestbook-ui", fixture.DeploymentNamespace(), SyncStatusCodeSynced))
|
||||
}
|
||||
|
||||
//In selectedResource to sync, namespace is provided
|
||||
// In selectedResource to sync, namespace is provided
|
||||
func TestSelectiveSyncWithNamespace(t *testing.T) {
|
||||
selectedResourceNamespace := getNewNamespace(t)
|
||||
defer func() {
|
||||
|
||||
@@ -3,5 +3,6 @@ package ui
|
||||
import "embed"
|
||||
|
||||
// Embedded contains embedded UI resources
|
||||
//
|
||||
//go:embed dist/app
|
||||
var Embedded embed.FS
|
||||
|
||||
@@ -52,10 +52,9 @@ type CertificateListSelector struct {
|
||||
// the certificates, and only returns the metadata including CertInfo field.
|
||||
//
|
||||
// The CertInfo field in the returned entries will contain the following data:
|
||||
// - For SSH keys, the SHA256 fingerprint of the key as string, prepended by
|
||||
// the string "SHA256:"
|
||||
// - For TLS certs, the Subject of the X509 cert as a string in DN notation
|
||||
//
|
||||
// - For SSH keys, the SHA256 fingerprint of the key as string, prepended by
|
||||
// the string "SHA256:"
|
||||
// - For TLS certs, the Subject of the X509 cert as a string in DN notation
|
||||
func (db *db) ListRepoCertificates(ctx context.Context, selector *CertificateListSelector) (*appsv1.RepositoryCertificateList, error) {
|
||||
|
||||
// selector may be given as nil, but we need at least an empty data structure
|
||||
|
||||
@@ -35,10 +35,10 @@ func (db *db) getHelmRepo(repoURL string, helmRepositories []settings.HelmRepoCr
|
||||
Name: repoInfo.Name,
|
||||
}
|
||||
err := db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*v1.SecretKeySelector{
|
||||
&SecretMaperValidation{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret,
|
||||
&SecretMaperValidation{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret,
|
||||
&SecretMaperValidation{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.CertSecret,
|
||||
&SecretMaperValidation{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.KeySecret,
|
||||
{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret,
|
||||
{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret,
|
||||
{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.CertSecret,
|
||||
{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.KeySecret,
|
||||
}, make(map[string]*v1.Secret))
|
||||
return repo, err
|
||||
}
|
||||
|
||||
@@ -387,13 +387,13 @@ func (l *legacyRepositoryBackend) credentialsToRepository(repoInfo settings.Repo
|
||||
Proxy: repoInfo.Proxy,
|
||||
}
|
||||
err := l.db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*apiv1.SecretKeySelector{
|
||||
&SecretMaperValidation{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret,
|
||||
&SecretMaperValidation{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret,
|
||||
&SecretMaperValidation{Dest: &repo.SSHPrivateKey, Transform: StripCRLFCharacter}: repoInfo.SSHPrivateKeySecret,
|
||||
&SecretMaperValidation{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertDataSecret,
|
||||
&SecretMaperValidation{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertKeySecret,
|
||||
&SecretMaperValidation{Dest: &repo.GithubAppPrivateKey, Transform: StripCRLFCharacter}: repoInfo.GithubAppPrivateKeySecret,
|
||||
&SecretMaperValidation{Dest: &repo.GCPServiceAccountKey, Transform: StripCRLFCharacter}: repoInfo.GCPServiceAccountKey,
|
||||
{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret,
|
||||
{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret,
|
||||
{Dest: &repo.SSHPrivateKey, Transform: StripCRLFCharacter}: repoInfo.SSHPrivateKeySecret,
|
||||
{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertDataSecret,
|
||||
{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertKeySecret,
|
||||
{Dest: &repo.GithubAppPrivateKey, Transform: StripCRLFCharacter}: repoInfo.GithubAppPrivateKeySecret,
|
||||
{Dest: &repo.GCPServiceAccountKey, Transform: StripCRLFCharacter}: repoInfo.GCPServiceAccountKey,
|
||||
}, make(map[string]*apiv1.Secret))
|
||||
return repo, err
|
||||
}
|
||||
@@ -407,13 +407,13 @@ func (l *legacyRepositoryBackend) credentialsToRepositoryCredentials(repoInfo se
|
||||
EnableOCI: repoInfo.EnableOCI,
|
||||
}
|
||||
err := l.db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*apiv1.SecretKeySelector{
|
||||
&SecretMaperValidation{Dest: &creds.Username}: repoInfo.UsernameSecret,
|
||||
&SecretMaperValidation{Dest: &creds.Password}: repoInfo.PasswordSecret,
|
||||
&SecretMaperValidation{Dest: &creds.SSHPrivateKey}: repoInfo.SSHPrivateKeySecret,
|
||||
&SecretMaperValidation{Dest: &creds.TLSClientCertData}: repoInfo.TLSClientCertDataSecret,
|
||||
&SecretMaperValidation{Dest: &creds.TLSClientCertKey}: repoInfo.TLSClientCertKeySecret,
|
||||
&SecretMaperValidation{Dest: &creds.GithubAppPrivateKey}: repoInfo.GithubAppPrivateKeySecret,
|
||||
&SecretMaperValidation{Dest: &creds.GCPServiceAccountKey}: repoInfo.GCPServiceAccountKey,
|
||||
{Dest: &creds.Username}: repoInfo.UsernameSecret,
|
||||
{Dest: &creds.Password}: repoInfo.PasswordSecret,
|
||||
{Dest: &creds.SSHPrivateKey}: repoInfo.SSHPrivateKeySecret,
|
||||
{Dest: &creds.TLSClientCertData}: repoInfo.TLSClientCertDataSecret,
|
||||
{Dest: &creds.TLSClientCertKey}: repoInfo.TLSClientCertKeySecret,
|
||||
{Dest: &creds.GithubAppPrivateKey}: repoInfo.GithubAppPrivateKeySecret,
|
||||
{Dest: &creds.GCPServiceAccountKey}: repoInfo.GCPServiceAccountKey,
|
||||
}, make(map[string]*apiv1.Secret))
|
||||
return creds, err
|
||||
}
|
||||
|
||||
@@ -302,8 +302,8 @@ func (c *nativeHelmChart) loadRepoIndex() ([]byte, error) {
|
||||
}
|
||||
|
||||
tr := &http.Transport{
|
||||
Proxy: proxy.GetCallback(c.proxy),
|
||||
TLSClientConfig: tlsConf,
|
||||
Proxy: proxy.GetCallback(c.proxy),
|
||||
TLSClientConfig: tlsConf,
|
||||
DisableKeepAlives: true,
|
||||
}
|
||||
client := http.Client{Transport: tr}
|
||||
@@ -411,8 +411,8 @@ func (c *nativeHelmChart) GetTags(chart string, noCache bool) (*TagsList, error)
|
||||
return nil, fmt.Errorf("failed setup tlsConfig: %v", err)
|
||||
}
|
||||
client := &http.Client{Transport: &http.Transport{
|
||||
Proxy: proxy.GetCallback(c.proxy),
|
||||
TLSClientConfig: tlsConf,
|
||||
Proxy: proxy.GetCallback(c.proxy),
|
||||
TLSClientConfig: tlsConf,
|
||||
DisableKeepAlives: true,
|
||||
}}
|
||||
repo.Client = &auth.Client{
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
var index = Index{
|
||||
Entries: map[string]Entries{
|
||||
"argo-cd": {
|
||||
"argo-cd": {
|
||||
{Version: "~0.7.3"},
|
||||
{Version: "0.7.2"},
|
||||
{Version: "0.7.1"},
|
||||
|
||||
@@ -20,19 +20,22 @@ var RelativeOutOfBoundErr = errors.New("full path does not contain base path")
|
||||
// does not match (example 2).
|
||||
//
|
||||
// Example 1:
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /home/test
|
||||
// return: app/readme.md
|
||||
//
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /home/test
|
||||
// return: app/readme.md
|
||||
//
|
||||
// Example 2:
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /somewhere/else
|
||||
// return: "", RelativeOutOfBoundErr
|
||||
//
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /somewhere/else
|
||||
// return: "", RelativeOutOfBoundErr
|
||||
//
|
||||
// Example 3:
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /home/test/app/readme.md
|
||||
// return: .
|
||||
//
|
||||
// fullPath: /home/test/app/readme.md
|
||||
// basePath: /home/test/app/readme.md
|
||||
// return: .
|
||||
func RelativePath(fullPath, basePath string) (string, error) {
|
||||
fp := filepath.Clean(fullPath)
|
||||
if !strings.HasPrefix(fp, filepath.Clean(basePath)) {
|
||||
|
||||
@@ -62,7 +62,6 @@ func (rf *ResourcesFilter) isExcludedResource(apiGroup, kind, cluster string) bo
|
||||
// +-------------+-------------+-------------+
|
||||
// | Present | Present | Not Allowed |
|
||||
// +-------------+-------------+-------------+
|
||||
//
|
||||
func (rf *ResourcesFilter) IsExcludedResource(apiGroup, kind, cluster string) bool {
|
||||
// if excluded, do not allow
|
||||
if rf.isExcludedResource(apiGroup, kind, cluster) {
|
||||
|
||||
Reference in New Issue
Block a user