Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated backport of #1012: Use golangci-lint for header checks #993: Drop the leading spaces before the ASL URL #1027: Bump to Fedora 37 #1223: Bump to Fedora 38 #1534

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ jobs:
- name: Run golangci-lint
run: make golangci-lint

headers:
name: License Headers
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Check License Headers
uses: kt3k/license_checker@d12a6d90c58e30fefed09f2c4d03ba57f4c673a8

markdown-link-check:
name: Markdown Links (modified files)
runs-on: ubuntu-latest
Expand Down
27 changes: 23 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ linters-settings:
- unnamedResult
gocyclo:
min-complexity: 15
goheader:
template: |-
SPDX-License-Identifier: Apache-2.0

Copyright Contributors to the Submariner project.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
govet:
enable:
- fieldalignment
Expand All @@ -27,7 +44,6 @@ linters:
- bodyclose
- contextcheck
# - cyclop # This is equivalent to gocyclo
- deadcode
- depguard
- dogsled
- dupl
Expand All @@ -54,7 +70,7 @@ linters:
# - godox # Let's not forbid inline TODOs, FIXMEs et al
- gofmt
- gofumpt
# - goheader # We do license header linting another way
- goheader
- goimports
# - golint # Deprecated since v1.41.0
# - gomnd # It doesn't seem useful in general to enforce constants for all numeric values
Expand Down Expand Up @@ -90,7 +106,6 @@ linters:
# - scopelint # Deprecated since v1.39.0
# - sqlclosecheck # We don't use SQL
- staticcheck
- structcheck
- stylecheck
# - tagliatelle # Inconsistent with stylecheck and not as good
# - tenv # Not relevant for our Ginkgo UTs
Expand All @@ -101,7 +116,6 @@ linters:
- unconvert
- unparam
- unused
- varcheck
# - varnamelen # It doesn't seem necessary to enforce a minimum variable name length
- wastedassign
- whitespace
Expand Down Expand Up @@ -142,3 +156,8 @@ issues:
- gochecknoinits
- goerr113
- wrapcheck

# Ignore header linting for files copied from Kubernetes
- path: test/e2e/framework/ginkgowrapper/wrapper.go
linters:
- goheader
31 changes: 0 additions & 31 deletions .licenserc.json

This file was deleted.

8 changes: 5 additions & 3 deletions package/Dockerfile.shipyard-dapper-base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:36
FROM fedora:38

# Unless specified otherwise, compress to a medium level which gives (from experemintation) a
# good balance between compression time and resulting image size.
Expand All @@ -14,6 +14,7 @@ ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/root/.l
# Component | Usage
# -------------------------------------------------------------
# curl | download other tools
# file | file identification (in compile/test.sh)
# findutils | make unit (find unit test dirs)
# gcc | needed by `go test -race` (https://github.com/golang/go/issues/27089)
# gh | backport, releases
Expand All @@ -33,6 +34,7 @@ ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/root/.l
# python3-setuptools | Needed by j2cli
# qemu-user-static | Emulation (for multiarch builds)
# skopeo | container image manipulation
# unzip | ZIP extraction
# upx | binary compression
# yq | YAML processing (OCM deploy tool)

Expand All @@ -45,7 +47,7 @@ ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} PATH=/go/bin:/root/.l
RUN dnf -y install --nodocs --setopt=install_weak_deps=False \
gcc git-core curl moby-engine make golang kubernetes-client \
findutils moreutils upx jq gitlint python3-setuptools \
qemu-user-static python3-pip skopeo && \
qemu-user-static python3-pip skopeo file unzip && \
pip install j2cli[yaml] --user && \
rpm -e --nodeps containerd python3-pip && \
rpm -qa "selinux*" | xargs -r rpm -e --nodeps && \
Expand All @@ -56,7 +58,7 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=False \
find /usr/bin /usr/lib/golang /usr/libexec -type f -executable -newercc /proc -size +1M ! -name hyperkube \( -execdir upx ${UPX_LEVEL} {} \; -o -true \) && \
ln -f /usr/bin/kubectl /usr/bin/hyperkube

ENV LINT_VERSION=v1.47.3 \
ENV LINT_VERSION=v1.50.1 \
HELM_VERSION=v3.9.0 \
KIND_VERSION=v0.15.0 \
BUILDX_VERSION=v0.8.2 \
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dataplane/tcp_connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/api_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/framework/clusterglobalegressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -47,7 +47,7 @@ func AwaitAllocatedEgressIPs(client dynamic.ResourceInterface, name string) []st
func() (interface{}, error) {
resGip, err := client.Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return resGip, err
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/framework/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -98,7 +98,7 @@ func (d *Docker) RunCommandUntil(command ...string) (string, string) {
stdout, stderr, cmdErr = d.runCommand(command...)
if cmdErr != nil {
Logf("Error attempting to run %v: %v", append([]string{}, command...), cmdErr)
return false, nil // nolint:nilerr // Returning nil value is intentional
return false, nil //nolint:nilerr // Returning nil value is intentional
}
return true, nil
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -284,7 +284,7 @@ func DetectGlobalnet() {
AwaitUntil("find Clusters to detect if Globalnet is enabled", func() (interface{}, error) {
clusters, err := clusters.List(context.TODO(), metav1.ListOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return clusters, err
}, func(result interface{}) (bool, string, error) {
Expand Down Expand Up @@ -338,7 +338,7 @@ func fetchClusterIDs() {
daemonSet := AwaitUntil(fmt.Sprintf("find %s DaemonSet for %q", name, TestContext.ClusterIDs[i]), func() (interface{}, error) {
ds, err := KubeClients[i].AppsV1().DaemonSets(TestContext.SubmarinerNamespace).Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return ds, err
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/framework/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -45,7 +45,7 @@ func (f *Framework) AwaitGatewayWithStatus(cluster ClusterIndex, name, status st
func() (interface{}, error) {
resGw, err := gwClient.Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return resGw, err
},
Expand Down Expand Up @@ -112,7 +112,7 @@ func (f *Framework) AwaitGatewayFullyConnected(cluster ClusterIndex, name string
func() (interface{}, error) {
resGw, err := gwClient.Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return resGw, err
},
Expand Down Expand Up @@ -177,7 +177,7 @@ func (f *Framework) DeleteGateway(cluster ClusterIndex, name string) {
AwaitUntil("delete gateway", func() (interface{}, error) {
err := gatewayClient(cluster).Delete(context.TODO(), name, metav1.DeleteOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return nil, err
}, NoopCheckResult)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/ginkgo_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/ginkgowrapper/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/globalegressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/framework/globalingressips.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -42,7 +42,7 @@ func (f *Framework) AwaitGlobalIngressIP(cluster ClusterIndex, name, namespace s
func() (interface{}, error) {
resGip, err := gipClient.Get(context.TODO(), name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return nil, nil // nolint:nilnil // We want to repeat but let the checker known that nothing was found.
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}
return resGip, err
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Loading
Loading