Compare commits

..

2 Commits

Author SHA1 Message Date
Papapetrou Patroklos
e2527f6dec Merge branch 'master' into dependabot/pip/docs/pygments-2.20.0 2026-04-02 19:29:59 +03:00
dependabot[bot]
342a177a5b chore(deps): bump pygments from 2.19.2 to 2.20.0 in /docs
Bumps [pygments](https://github.com/pygments/pygments) from 2.19.2 to 2.20.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.19.2...2.20.0)

---
updated-dependencies:
- dependency-name: pygments
  dependency-version: 2.20.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 17:20:12 +00:00
19 changed files with 113 additions and 98 deletions

View File

@@ -423,7 +423,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: SonarSource/sonarqube-scan-action@299e4b793aaa83bf2aba7c9c14bedbb485688ec4 # v7.1.0
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
if: env.sonar_secret != ''
test-e2e:
name: Run end-to-end tests

View File

@@ -662,7 +662,8 @@ func TestAutoSync(t *testing.T) {
func TestAutoSyncEnabledSetToTrue(t *testing.T) {
app := newFakeApp()
app.Spec.SyncPolicy.Automated = &v1alpha1.SyncPolicyAutomated{Enabled: new(true)}
enable := true
app.Spec.SyncPolicy.Automated = &v1alpha1.SyncPolicyAutomated{Enabled: &enable}
ctrl := newFakeController(t.Context(), &fakeData{apps: []runtime.Object{app}}, nil)
syncStatus := v1alpha1.SyncStatus{
Status: v1alpha1.SyncStatusCodeOutOfSync,
@@ -788,7 +789,8 @@ func TestSkipAutoSync(t *testing.T) {
// Verify we skip when auto-sync is disabled
t.Run("AutoSyncEnableFieldIsSetFalse", func(t *testing.T) {
app := newFakeApp()
app.Spec.SyncPolicy.Automated = &v1alpha1.SyncPolicyAutomated{Enabled: new(false)}
enable := false
app.Spec.SyncPolicy.Automated = &v1alpha1.SyncPolicyAutomated{Enabled: &enable}
ctrl := newFakeController(t.Context(), &fakeData{apps: []runtime.Object{app}}, nil)
syncStatus := v1alpha1.SyncStatus{
Status: v1alpha1.SyncStatusCodeOutOfSync,

View File

@@ -1,8 +1,7 @@
# Submitting PRs
## Prerequisites
1. [Development Environment](development-environment.md)
1. [Development Environment](development-environment.md)
2. [Toolchain Guide](toolchain-guide.md)
3. [Development Cycle](development-cycle.md)
@@ -22,10 +21,10 @@ If you need guidance with submitting a PR, or have any other questions regarding
## Before Submitting a PR
1. Rebase your branch against upstream master:
1. Rebase your branch against upstream main:
```shell
git fetch upstream
git rebase upstream/master
git rebase upstream/main
```
2. Run pre-commit checks:

View File

@@ -4,7 +4,7 @@ mkdocs-github-admonitions-plugin==0.1.1
# Thus pointing to the older version of mkdocs-material.
mkdocs-material==7.1.8
markdown_include==0.8.1
pygments==2.19.2
pygments==2.20.0
jinja2==3.1.6
markdown==3.10
pymdown-extensions==10.17.1

4
go.mod
View File

@@ -161,7 +161,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.30.14 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.18 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10
github.com/aws/smithy-go v1.24.3
github.com/aws/smithy-go v1.24.2
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -187,7 +187,7 @@ require (
github.com/go-fed/httpsig v1.1.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect
github.com/go-jose/go-jose/v3 v3.0.5 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.24.3 // indirect
github.com/go-openapi/errors v0.22.7 // indirect

9
go.sum
View File

@@ -156,8 +156,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.18 h1:mP49nTpfKtpXLt5SLn8Uv8z
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.18/go.mod h1:YO8TrYtFdl5w/4vmjL8zaBSsiNp3w0L1FfKVKenZT7w=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 h1:p8ogvvLugcR/zLBXTXrTkj0RYBUdErbMnAFFp12Lm/U=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10/go.mod h1:60dv0eZJfeVXfbT1tFJinbHrDfSJ2GZl4Q//OSSNAVw=
github.com/aws/smithy-go v1.24.3 h1:XgOAaUgx+HhVBoP4v8n6HCQoTRDhoMghKqw4LNHsDNg=
github.com/aws/smithy-go v1.24.3/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng=
github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
@@ -311,8 +311,8 @@ github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@@ -1004,6 +1004,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=

View File

@@ -14,7 +14,7 @@ FROM docker.io/library/registry:3.0@sha256:6c5666b861f3505b116bb9aa9b25175e71210
FROM docker.io/bitnamilegacy/kubectl:1.32@sha256:9524faf8e3cefb47fa28244a5d15f95ec21a73d963273798e593e61f80712333 AS kubectl
FROM docker.io/library/ubuntu:26.04@sha256:730382b4a53a3c4a1498b7a36f11a62117f133fe6e73b01bb91303ed2ad87cdd
FROM docker.io/library/ubuntu:26.04@sha256:91832dcd7bc5e44c098ecefc0a251a5c5d596dae494b33fb248e01b6840f8ce0
ENV DEBIAN_FRONTEND=noninteractive

View File

@@ -24,7 +24,8 @@ func TestNSAutoSyncSelfHealDisabled(t *testing.T) {
When().
// app should be auto-synced once created
CreateFromFile(func(app *Application) {
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: new(false)}}
selfHeal := false
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal}}
}).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
@@ -52,8 +53,9 @@ func TestNSAutoSyncSelfHealEnabled(t *testing.T) {
When().
// app should be auto-synced once created
CreateFromFile(func(app *Application) {
selfHeal := true
app.Spec.SyncPolicy = &SyncPolicy{
Automated: &SyncPolicyAutomated{SelfHeal: new(true)},
Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal},
Retry: &RetryStrategy{Limit: 0},
}
}).

View File

@@ -23,7 +23,8 @@ func TestAutoSyncSelfHealDisabled(t *testing.T) {
When().
// app should be auto-synced once created
CreateFromFile(func(app *Application) {
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: new(false)}}
selfHeal := false
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal}}
}).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
@@ -50,8 +51,9 @@ func TestAutoSyncSelfHealEnabled(t *testing.T) {
When().
// app should be auto-synced once created
CreateFromFile(func(app *Application) {
selfHeal := true
app.Spec.SyncPolicy = &SyncPolicy{
Automated: &SyncPolicyAutomated{SelfHeal: new(true)},
Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal},
Retry: &RetryStrategy{Limit: 0},
}
}).
@@ -192,8 +194,9 @@ func TestAutoSyncAllowEmptyCanBeDisabled(t *testing.T) {
Path(guestbookPath).
When().
CreateFromFile(func(app *Application) {
allowEmpty := true
app.Spec.SyncPolicy = &SyncPolicy{
Automated: &SyncPolicyAutomated{AllowEmpty: new(true)},
Automated: &SyncPolicyAutomated{AllowEmpty: &allowEmpty},
}
}).
Then().

View File

@@ -615,6 +615,26 @@ func TestTemplatePatch(t *testing.T) {
},
}
templatePatch := `{
"metadata": {
"annotations": {
{{- range $k, $v := .annotations }}
"{{ $k }}": "{{ $v }}"
{{- end }}
}
},
{{- if .createNamespace }}
"spec": {
"syncPolicy": {
"syncOptions": [
"CreateNamespace=true"
]
}
}
{{- end }}
}
`
var expectedAppNewNamespace *v1alpha1.Application
var expectedAppNewMetadata *v1alpha1.Application
@@ -638,25 +658,7 @@ func TestTemplatePatch(t *testing.T) {
},
},
},
TemplatePatch: new(`{
"metadata": {
"annotations": {
{{- range $k, $v := .annotations }}
"{{ $k }}": "{{ $v }}"
{{- end }}
}
},
{{- if .createNamespace }}
"spec": {
"syncPolicy": {
"syncOptions": [
"CreateNamespace=true"
]
}
}
{{- end }}
}
`),
TemplatePatch: &templatePatch,
Generators: []v1alpha1.ApplicationSetGenerator{
{
List: &v1alpha1.ListGenerator{
@@ -876,8 +878,9 @@ func TestSyncPolicyCreateUpdate(t *testing.T) {
appset.Spec.Template.Labels = map[string]string{
"label-key": "label-value",
}
applicationsSyncPolicy := v1alpha1.ApplicationsSyncPolicyCreateUpdate
appset.Spec.SyncPolicy = &v1alpha1.ApplicationSetSyncPolicy{
ApplicationsSync: new(v1alpha1.ApplicationsSyncPolicyCreateUpdate),
ApplicationsSync: &applicationsSyncPolicy,
}
}).Then().Expect(ApplicationsExist([]v1alpha1.Application{*expectedAppNewMetadata})).
@@ -973,8 +976,9 @@ func TestSyncPolicyCreateDelete(t *testing.T) {
Update(func(appset *v1alpha1.ApplicationSet) {
appset.Spec.Template.Annotations = map[string]string{"annotation-key": "annotation-value"}
appset.Spec.Template.Labels = map[string]string{"label-key": "label-value"}
applicationsSyncPolicy := v1alpha1.ApplicationsSyncPolicyCreateDelete
appset.Spec.SyncPolicy = &v1alpha1.ApplicationSetSyncPolicy{
ApplicationsSync: new(v1alpha1.ApplicationsSyncPolicyCreateDelete),
ApplicationsSync: &applicationsSyncPolicy,
}
}).Then().Expect(ApplicationsExist([]v1alpha1.Application{*expectedAppNewNamespace})).
@@ -1071,8 +1075,9 @@ func TestSyncPolicyCreateOnly(t *testing.T) {
Update(func(appset *v1alpha1.ApplicationSet) {
appset.Spec.Template.Annotations = map[string]string{"annotation-key": "annotation-value"}
appset.Spec.Template.Labels = map[string]string{"label-key": "label-value"}
applicationsSyncPolicy := v1alpha1.ApplicationsSyncPolicyCreateOnly
appset.Spec.SyncPolicy = &v1alpha1.ApplicationSetSyncPolicy{
ApplicationsSync: new(v1alpha1.ApplicationsSyncPolicyCreateOnly),
ApplicationsSync: &applicationsSyncPolicy,
}
}).Then().Expect(ApplicationsExist([]v1alpha1.Application{*expectedAppNewNamespace})).
@@ -1329,6 +1334,9 @@ func TestSimpleSCMProviderGenerator(t *testing.T) {
},
}
// Because you can't &"".
repoMatch := "argo-cd"
Given(t).
// Create an SCMProviderGenerator-based ApplicationSet
When().Create(v1alpha1.ApplicationSet{
@@ -1357,7 +1365,7 @@ func TestSimpleSCMProviderGenerator(t *testing.T) {
},
Filters: []v1alpha1.SCMProviderGeneratorFilter{
{
RepositoryMatch: new("argo-cd"),
RepositoryMatch: &repoMatch,
},
},
},
@@ -1398,6 +1406,9 @@ func TestSimpleSCMProviderGeneratorGoTemplate(t *testing.T) {
},
}
// Because you can't &"".
repoMatch := "argo-cd"
Given(t).
// Create an SCMProviderGenerator-based ApplicationSet
When().Create(v1alpha1.ApplicationSet{
@@ -1427,7 +1438,7 @@ func TestSimpleSCMProviderGeneratorGoTemplate(t *testing.T) {
},
Filters: []v1alpha1.SCMProviderGeneratorFilter{
{
RepositoryMatch: new("argo-cd"),
RepositoryMatch: &repoMatch,
},
},
},
@@ -1462,6 +1473,9 @@ func TestSCMProviderGeneratorSCMProviderNotAllowed(t *testing.T) {
},
}
// Because you can't &"".
repoMatch := "argo-cd"
ctx := Given(t)
// Create an SCMProviderGenerator-based ApplicationSet
ctx.When().Create(v1alpha1.ApplicationSet{
@@ -1491,7 +1505,7 @@ func TestSCMProviderGeneratorSCMProviderNotAllowed(t *testing.T) {
},
Filters: []v1alpha1.SCMProviderGeneratorFilter{
{
RepositoryMatch: new("argo-cd"),
RepositoryMatch: &repoMatch,
},
},
},
@@ -1707,6 +1721,9 @@ func TestSimpleSCMProviderGeneratorTokenRefStrictOk(t *testing.T) {
},
}
// Because you can't &"".
repoMatch := "argo-cd"
Given(t).
And(func() {
_, err := utils.GetE2EFixtureK8sClient(t).KubeClientset.CoreV1().Secrets(fixture.TestNamespace()).Create(t.Context(), &corev1.Secret{
@@ -1755,7 +1772,7 @@ func TestSimpleSCMProviderGeneratorTokenRefStrictOk(t *testing.T) {
},
Filters: []v1alpha1.SCMProviderGeneratorFilter{
{
RepositoryMatch: new("argo-cd"),
RepositoryMatch: &repoMatch,
},
},
},
@@ -1806,6 +1823,9 @@ func TestSimpleSCMProviderGeneratorTokenRefStrictKo(t *testing.T) {
},
}
// Because you can't &"".
repoMatch := "argo-cd"
ctx := Given(t)
ctx.And(func() {
_, err := utils.GetE2EFixtureK8sClient(t).KubeClientset.CoreV1().Secrets(fixture.TestNamespace()).Create(t.Context(), &corev1.Secret{
@@ -1855,7 +1875,7 @@ func TestSimpleSCMProviderGeneratorTokenRefStrictKo(t *testing.T) {
},
Filters: []v1alpha1.SCMProviderGeneratorFilter{
{
RepositoryMatch: new("argo-cd"),
RepositoryMatch: &repoMatch,
},
},
},

View File

@@ -14,6 +14,8 @@ import (
"github.com/argoproj/argo-cd/v3/pkg/apis/application"
)
var tenSec = int64(10)
func TestSimpleClusterDecisionResourceGeneratorExternalNamespace(t *testing.T) {
externalNamespace := string(utils.ArgoCDExternalNamespace)
@@ -294,7 +296,7 @@ func TestSimpleClusterDecisionResourceGeneratorAddingCluster(t *testing.T) {
ClusterDecisionResource: &v1alpha1.DuckTypeGenerator{
ConfigMapRef: "my-configmap",
Name: "my-placementdecision",
RequeueAfterSeconds: new(int64(10)),
RequeueAfterSeconds: &tenSec,
},
},
},
@@ -387,7 +389,7 @@ func TestSimpleClusterDecisionResourceGeneratorDeletingClusterSecret(t *testing.
ClusterDecisionResource: &v1alpha1.DuckTypeGenerator{
ConfigMapRef: "my-configmap",
Name: "my-placementdecision",
RequeueAfterSeconds: new(int64(10)),
RequeueAfterSeconds: &tenSec,
},
},
},
@@ -488,7 +490,7 @@ func TestSimpleClusterDecisionResourceGeneratorDeletingClusterFromResource(t *te
ClusterDecisionResource: &v1alpha1.DuckTypeGenerator{
ConfigMapRef: "my-configmap",
Name: "my-placementdecision",
RequeueAfterSeconds: new(int64(10)),
RequeueAfterSeconds: &tenSec,
},
},
},

View File

@@ -199,7 +199,7 @@ func (a *Actions) CreateMultiSourceAppFromFile(flags ...string) *Actions {
},
SyncPolicy: &v1alpha1.SyncPolicy{
Automated: &v1alpha1.SyncPolicyAutomated{
SelfHeal: new(true),
SelfHeal: func() *bool { b := true; return &b }(),
},
},
},

View File

@@ -129,7 +129,8 @@ func TestAnnotatedTagInStatusSyncRevision(t *testing.T) {
// Create Application targeting annotated-tag, with automatedSync: true
CreateFromFile(func(app *Application) {
app.Spec.Source.TargetRevision = "annotated-tag"
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: new(true), SelfHeal: new(false)}}
prune, selfHeal := true, false
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: &prune, SelfHeal: &selfHeal}}
}).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
@@ -164,7 +165,8 @@ func TestAutomatedSelfHealingAgainstAnnotatedTag(t *testing.T) {
// App should be auto-synced once created
CreateFromFile(func(app *Application) {
app.Spec.Source.TargetRevision = "annotated-tag"
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: new(true), SelfHeal: new(false)}}
prune, selfHeal := true, false
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: &prune, SelfHeal: &selfHeal}}
}).
Then().
ExpectConsistently(SyncStatusIs(SyncStatusCodeSynced), WaitDuration, time.Second*10).
@@ -216,7 +218,8 @@ func TestAutomatedSelfHealingAgainstLightweightTag(t *testing.T) {
// App should be auto-synced once created
CreateFromFile(func(app *Application) {
app.Spec.Source.TargetRevision = "annotated-tag"
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: new(true), SelfHeal: new(false)}}
prune, selfHeal := true, false
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: &prune, SelfHeal: &selfHeal}}
}).
Then().
ExpectConsistently(SyncStatusIs(SyncStatusCodeSynced), WaitDuration, time.Second*10).

View File

@@ -131,7 +131,8 @@ func TestSyncWithStatusIgnored(t *testing.T) {
}))
}).
CreateFromFile(func(app *Application) {
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: new(true)}}
selfHeal := true
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal}}
}).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
@@ -180,7 +181,8 @@ func TestSyncWithSkipHook(t *testing.T) {
Path(guestbookPath).
When().
CreateFromFile(func(app *Application) {
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: new(true)}}
selfHeal := true
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: &selfHeal}}
}).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).

View File

@@ -28,7 +28,7 @@
"js-yaml": "^4.1.1",
"json-merge-patch": "^0.2.3",
"lodash-es": "^4.17.21",
"minimatch": "^3.1.4",
"minimatch": "^3.1.3",
"moment": "^2.29.4",
"monaco-editor": "^0.33.0",
"path": "^0.12.7",

View File

@@ -4643,9 +4643,9 @@ flat-cache@^4.0.0:
keyv "^4.5.4"
flatted@^3.2.9:
version "3.4.2"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.4.2.tgz#f5c23c107f0f37de8dbdf24f13722b3b98d52726"
integrity sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==
version "3.3.1"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
follow-redirects@^1.0.0:
version "1.15.6"
@@ -6644,10 +6644,10 @@ minimatch@5.1.6, minimatch@^5.0.1:
dependencies:
brace-expansion "^2.0.1"
minimatch@^3.0.4, minimatch@^3.1.2, minimatch@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.4.tgz#89d910ea3970a77ac8edfd30340ccd038b758079"
integrity sha512-twmL+S8+7yIsE9wsqgzU3E8/LumN3M3QELrBZ20OdmQ9jB2JvW5oZtBEmft84k/Gs5CG9mqtWc6Y9vW+JEzGxw==
minimatch@^3.0.4, minimatch@^3.1.2, minimatch@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.3.tgz#6a5cba9b31f503887018f579c89f81f61162e624"
integrity sha512-M2GCs7Vk83NxkUyQV1bkABc4yxgz9kILhHImZiBPAZ9ybuvCb0/H7lEl5XvIg3g+9d4eNotkZA5IWwYl0tibaA==
dependencies:
brace-expansion "^1.1.7"
@@ -7260,10 +7260,15 @@ picocolors@^1.1.1:
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1:
version "2.3.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601"
integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
picomatch@^2.2.3:
version "2.3.0"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
pify@^4.0.1:
version "4.0.1"

View File

@@ -1009,8 +1009,8 @@ func TestExecuteResourceActionWithParams(t *testing.T) {
params := []*applicationpkg.ResourceActionParameters{
{
Name: new("replicas"),
Value: new("3"),
Name: func() *string { s := "replicas"; return &s }(),
Value: func() *string { s := "3"; return &s }(),
},
}

View File

@@ -11,29 +11,20 @@ import (
// filename of ReDoc script in UI's assets/scripts path
const redocScriptName = "redoc.standalone.js"
// withFrameOptions wraps an http.Handler to set headers that prevent iframe embedding (clickjacking protection).
func withFrameOptions(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Frame-Options", "DENY")
w.Header().Set("Content-Security-Policy", "frame-ancestors 'none'")
h.ServeHTTP(w, r)
})
}
// ServeSwaggerUI serves the Swagger UI and JSON spec.
func ServeSwaggerUI(mux *http.ServeMux, swaggerJSON string, uiPath string, rootPath string) {
prefix := path.Dir(uiPath)
swaggerPath := path.Join(prefix, "swagger.json")
mux.Handle(swaggerPath, withFrameOptions(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
mux.HandleFunc(swaggerPath, func(w http.ResponseWriter, _ *http.Request) {
_, _ = fmt.Fprint(w, swaggerJSON)
})))
})
specURL := path.Join(prefix, rootPath, "swagger.json")
scriptURL := path.Join(prefix, rootPath, "assets", "scripts", redocScriptName)
mux.Handle(uiPath, withFrameOptions(middleware.Redoc(middleware.RedocOpts{
mux.Handle(uiPath, middleware.Redoc(middleware.RedocOpts{
BasePath: prefix,
SpecURL: specURL,
Path: path.Base(uiPath),
RedocURL: scriptURL,
}, http.NotFoundHandler())))
}, http.NotFoundHandler()))
}

View File

@@ -52,19 +52,4 @@ func TestSwaggerUI(t *testing.T) {
require.NoError(t, err)
require.Equalf(t, http.StatusOK, resp.StatusCode, "Was expecting status code 200 from swagger-ui, but got %d instead", resp.StatusCode)
require.NoError(t, resp.Body.Close())
// Verify clickjacking protection headers on swagger.json
require.Equal(t, "DENY", resp.Header.Get("X-Frame-Options"))
require.Equal(t, "frame-ancestors 'none'", resp.Header.Get("Content-Security-Policy"))
// Verify clickjacking protection headers on swagger-ui
uiReq, err := http.NewRequestWithContext(t.Context(), http.MethodGet, server+"/swagger-ui", http.NoBody)
require.NoError(t, err)
uiResp, err := http.DefaultClient.Do(uiReq)
require.NoError(t, err)
require.Equalf(t, http.StatusOK, uiResp.StatusCode, "Was expecting status code 200 from swagger-ui, but got %d instead", uiResp.StatusCode)
require.Equal(t, "DENY", uiResp.Header.Get("X-Frame-Options"))
require.Equal(t, "frame-ancestors 'none'", uiResp.Header.Get("Content-Security-Policy"))
require.NoError(t, uiResp.Body.Close())
}