From 872390214ed10fa017455e3a05f1d7d675bb8736 Mon Sep 17 00:00:00 2001 From: "Senan Zedan (EXT-Nokia)" Date: Fri, 3 Jan 2025 13:25:07 +0200 Subject: [PATCH] Fix the formatting of the files and change misleading test name --- .../kind-cluster-custom-resources.yaml | 7 +++--- cmd/webhook/main.go | 14 +++++------ .../github.com/hashicorp/go-cleanhttp/doc.go | 1 - .../go-secure-stdlib/strutil/strutil.go | 10 ++++---- .../hashicorp/go-sockaddr/ifaddr.go | 12 +++++----- .../hashicorp/go-sockaddr/ifaddrs.go | 4 ++-- .../hashicorp/go-sockaddr/ipv4addr.go | 24 +++++++++---------- .../hashicorp/go-sockaddr/ipv6addr.go | 24 +++++++++---------- .../hashicorp/hcl/hcl/printer/nodes.go | 7 +++--- 9 files changed, 51 insertions(+), 52 deletions(-) diff --git a/.github/workflows/kind-cluster-custom-resources.yaml b/.github/workflows/kind-cluster-custom-resources.yaml index dcdfd59c6..ca660b68d 100644 --- a/.github/workflows/kind-cluster-custom-resources.yaml +++ b/.github/workflows/kind-cluster-custom-resources.yaml @@ -16,7 +16,7 @@ name: Test policy-controller with custom resource on: pull_request: - branches: [ 'main', 'release-*' ] + branches: ["main", "release-*"] defaults: run: @@ -96,7 +96,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: - go-version-file: './go.mod' + go-version-file: "./go.mod" check-latest: true # will use the latest release available for ko @@ -122,7 +122,7 @@ jobs: k8s-version: ${{ matrix.k8s-version}} version: ${{ env.SCAFFOLDING_RELEASE_VERSION }} - - name: Install policy-controller-with-only-pod-resource + - name: Install policy-controller-with-replicasets-daemonsets-resource env: GIT_HASH: ${{ github.sha }} GIT_VERSION: ci @@ -141,6 +141,7 @@ jobs: - name: Run Custom resources Tests timeout-minutes: 5 run: | + chmod +x ./test/e2e_test_policy_custom_resource.sh ./test/e2e_test_policy_custom_resource.sh - name: Collect diagnostics diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 6e583e2ab..9ab58975a 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -80,11 +80,11 @@ var ( disableTUF = flag.Bool("disable-tuf", false, "Disable TUF support.") // Validate specific resources. - // https://github.com/sigstore/policy-controller/issues/1388 - resourcesNames = flag.String("resource-name", "replicasets, deployments, pods, cronjobs, jobs, statefulsets, daemonsets", "Comma-separated list of resources") - // Split the input string into a slice of strings - listResources []string - types map[schema.GroupVersionKind]resourcesemantics.GenericCRD + // https://github.com/sigstore/policy-controller/issues/1388 + resourcesNames = flag.String("resource-name", "replicasets, deployments, pods, cronjobs, jobs, statefulsets, daemonsets", "Comma-separated list of resources") + // Split the input string into a slice of strings + listResources []string + types map[schema.GroupVersionKind]resourcesemantics.GenericCRD // mutatingCIPWebhookName holds the name of the mutating webhook configuration // resource dispatching admission requests to policy-webhook. @@ -125,7 +125,7 @@ func main() { flag.Parse() resourcesNamesList := strings.Split(*resourcesNames, ",") - listResources = append(listResources, resourcesNamesList...) + listResources = append(listResources, resourcesNamesList...) // If TUF has been disabled do not try to set it up. if !*disableTUF { @@ -300,7 +300,7 @@ func NewMutatingAdmissionController(ctx context.Context, _ configmap.Watcher) *c } ctx = webhook.WithOptions(ctx, *woptions) validator := cwebhook.NewValidator(ctx) - types = createTypesMap(listResources) + types = createTypesMap(listResources) return defaulting.NewAdmissionController(ctx, // Name of the resource webhook. *webhookName, diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/doc.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/doc.go index 05841092a..905859c7f 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/doc.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/doc.go @@ -16,5 +16,4 @@ // connecting to the same hosts repeatedly from the same client, you can use // DefaultPooledClient to receive a client that has connection pooling // semantics similar to http.DefaultClient. -// package cleanhttp diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-secure-stdlib/strutil/strutil.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-secure-stdlib/strutil/strutil.go index 102462dc6..b342b5062 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-secure-stdlib/strutil/strutil.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-secure-stdlib/strutil/strutil.go @@ -110,11 +110,11 @@ func ParseKeyValues(input string, out map[string]string, sep string) error { // ParseArbitraryKeyValues parses arbitrary tuples. The input // can be one of the following: -// * JSON string -// * Base64 encoded JSON string -// * Comma separated list of `=` pairs -// * Base64 encoded string containing comma separated list of -// `=` pairs +// - JSON string +// - Base64 encoded JSON string +// - Comma separated list of `=` pairs +// - Base64 encoded string containing comma separated list of +// `=` pairs // // Input will be parsed into the output parameter, which should // be a non-nil map[string]string. diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddr.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddr.go index 0811b2759..277678871 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddr.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddr.go @@ -17,7 +17,7 @@ func init() { // // ``` // $ sockaddr eval -r '{{GetPrivateInterfaces | attr "address"}}' -/// ``` +// / ``` func GetPrivateIP() (string, error) { privateIfs, err := GetPrivateInterfaces() if err != nil { @@ -39,7 +39,7 @@ func GetPrivateIP() (string, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | include "RFC" "6890" | join "address" " "}}' -/// ``` +// / ``` func GetPrivateIPs() (string, error) { ifAddrs, err := GetAllInterfaces() if err != nil { @@ -86,7 +86,7 @@ func GetPrivateIPs() (string, error) { // // ``` // $ sockaddr eval -r '{{GetPublicInterfaces | attr "address"}}' -/// ``` +// / ``` func GetPublicIP() (string, error) { publicIfs, err := GetPublicInterfaces() if err != nil { @@ -108,7 +108,7 @@ func GetPublicIP() (string, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | exclude "RFC" "6890" | join "address" " "}}' -/// ``` +// / ``` func GetPublicIPs() (string, error) { ifAddrs, err := GetAllInterfaces() if err != nil { @@ -147,7 +147,7 @@ func GetPublicIPs() (string, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | include "name" <> | sort "type,size" | include "flag" "forwardable" | attr "address" }}' -/// ``` +// / ``` func GetInterfaceIP(namedIfRE string) (string, error) { ifAddrs, err := GetAllInterfaces() if err != nil { @@ -188,7 +188,7 @@ func GetInterfaceIP(namedIfRE string) (string, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | include "name" <> | sort "type,size" | join "address" " "}}' -/// ``` +// / ``` func GetInterfaceIPs(namedIfRE string) (string, error) { ifAddrs, err := GetAllInterfaces() if err != nil { diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddrs.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddrs.go index d2713afbf..8f51fc1b3 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddrs.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ifaddrs.go @@ -303,7 +303,7 @@ func GetDefaultInterfaces() (IfAddrs, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | include "type" "ip" | include "flags" "forwardable" | include "flags" "up" | sort "default,type,size" | include "RFC" "6890" }}' -/// ``` +// / ``` func GetPrivateInterfaces() (IfAddrs, error) { privateIfs, err := GetAllInterfaces() if err != nil { @@ -351,7 +351,7 @@ func GetPrivateInterfaces() (IfAddrs, error) { // // ``` // $ sockaddr eval -r '{{GetAllInterfaces | include "type" "ip" | include "flags" "forwardable" | include "flags" "up" | sort "default,type,size" | exclude "RFC" "6890" }}' -/// ``` +// / ``` func GetPublicInterfaces() (IfAddrs, error) { publicIfs, err := GetAllInterfaces() if err != nil { diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv4addr.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv4addr.go index 4d395dc95..356eb8563 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv4addr.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv4addr.go @@ -165,10 +165,10 @@ func (ipv4 IPv4Addr) BroadcastAddress() IPv4Network { // CmpAddress follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because its address is lower than arg -// - 0 if the SockAddr arg is equal to the receiving IPv4Addr or the argument is -// of a different type. -// - 1 If the argument should sort first. +// - -1 If the receiver should sort first because its address is lower than arg +// - 0 if the SockAddr arg is equal to the receiving IPv4Addr or the argument is +// of a different type. +// - 1 If the argument should sort first. func (ipv4 IPv4Addr) CmpAddress(sa SockAddr) int { ipv4b, ok := sa.(IPv4Addr) if !ok { @@ -187,10 +187,10 @@ func (ipv4 IPv4Addr) CmpAddress(sa SockAddr) int { // CmpPort follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because its port is lower than arg -// - 0 if the SockAddr arg's port number is equal to the receiving IPv4Addr, -// regardless of type. -// - 1 If the argument should sort first. +// - -1 If the receiver should sort first because its port is lower than arg +// - 0 if the SockAddr arg's port number is equal to the receiving IPv4Addr, +// regardless of type. +// - 1 If the argument should sort first. func (ipv4 IPv4Addr) CmpPort(sa SockAddr) int { var saPort IPPort switch v := sa.(type) { @@ -214,10 +214,10 @@ func (ipv4 IPv4Addr) CmpPort(sa SockAddr) int { // CmpRFC follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because it belongs to the RFC and its -// arg does not -// - 0 if the receiver and arg both belong to the same RFC or neither do. -// - 1 If the arg belongs to the RFC but receiver does not. +// - -1 If the receiver should sort first because it belongs to the RFC and its +// arg does not +// - 0 if the receiver and arg both belong to the same RFC or neither do. +// - 1 If the arg belongs to the RFC but receiver does not. func (ipv4 IPv4Addr) CmpRFC(rfcNum uint, sa SockAddr) int { recvInRFC := IsRFC(rfcNum, ipv4) ipv4b, ok := sa.(IPv4Addr) diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv6addr.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv6addr.go index d7f412111..bd49fb7a0 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv6addr.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/go-sockaddr/ipv6addr.go @@ -173,10 +173,10 @@ func (ipv6 IPv6Addr) AddressHexString() string { // CmpAddress follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because its address is lower than arg -// - 0 if the SockAddr arg equal to the receiving IPv6Addr or the argument is of a -// different type. -// - 1 If the argument should sort first. +// - -1 If the receiver should sort first because its address is lower than arg +// - 0 if the SockAddr arg equal to the receiving IPv6Addr or the argument is of a +// different type. +// - 1 If the argument should sort first. func (ipv6 IPv6Addr) CmpAddress(sa SockAddr) int { ipv6b, ok := sa.(IPv6Addr) if !ok { @@ -193,10 +193,10 @@ func (ipv6 IPv6Addr) CmpAddress(sa SockAddr) int { // CmpPort follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because its port is lower than arg -// - 0 if the SockAddr arg's port number is equal to the receiving IPv6Addr, -// regardless of type. -// - 1 If the argument should sort first. +// - -1 If the receiver should sort first because its port is lower than arg +// - 0 if the SockAddr arg's port number is equal to the receiving IPv6Addr, +// regardless of type. +// - 1 If the argument should sort first. func (ipv6 IPv6Addr) CmpPort(sa SockAddr) int { var saPort IPPort switch v := sa.(type) { @@ -220,10 +220,10 @@ func (ipv6 IPv6Addr) CmpPort(sa SockAddr) int { // CmpRFC follows the Cmp() standard protocol and returns: // -// - -1 If the receiver should sort first because it belongs to the RFC and its -// arg does not -// - 0 if the receiver and arg both belong to the same RFC or neither do. -// - 1 If the arg belongs to the RFC but receiver does not. +// - -1 If the receiver should sort first because it belongs to the RFC and its +// arg does not +// - 0 if the receiver and arg both belong to the same RFC or neither do. +// - 1 If the arg belongs to the RFC but receiver does not. func (ipv6 IPv6Addr) CmpRFC(rfcNum uint, sa SockAddr) int { recvInRFC := IsRFC(rfcNum, ipv6) ipv6b, ok := sa.(IPv6Addr) diff --git a/third_party/VENDOR-LICENSE/github.com/hashicorp/hcl/hcl/printer/nodes.go b/third_party/VENDOR-LICENSE/github.com/hashicorp/hcl/hcl/printer/nodes.go index 7c038d12a..f207bf92d 100644 --- a/third_party/VENDOR-LICENSE/github.com/hashicorp/hcl/hcl/printer/nodes.go +++ b/third_party/VENDOR-LICENSE/github.com/hashicorp/hcl/hcl/printer/nodes.go @@ -721,10 +721,9 @@ func (p *printer) heredocIndent(buf []byte) []byte { // // A single line object: // -// * has no lead comments (hence multi-line) -// * has no assignment -// * has no values in the stanza (within {}) -// +// - has no lead comments (hence multi-line) +// - has no assignment +// - has no values in the stanza (within {}) func (p *printer) isSingleLineObject(val *ast.ObjectItem) bool { // If there is a lead comment, can't be one line if val.LeadComment != nil {