Skip to content

Commit

Permalink
ci: bump ci to golang 1.20 (#2597)
Browse files Browse the repository at this point in the history
  • Loading branch information
sozercan authored Mar 24, 2023
1 parent df9a9d9 commit 852d1f4
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/license-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
permissions:
contents: read
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
create-release-pull-request:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Set release version and target branch for vNext
if: github.event_name == 'push'
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
permissions:
contents: read
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
Expand All @@ -50,7 +50,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.50.1
version: v1.51.2

test:
name: "Unit test"
Expand All @@ -59,10 +59,10 @@ jobs:
permissions:
contents: read
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
Expand All @@ -84,10 +84,10 @@ jobs:
permissions:
contents: read
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
Expand All @@ -114,10 +114,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Bootstrap e2e
run: |
Expand Down Expand Up @@ -199,10 +199,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Bootstrap e2e
run: |
Expand Down Expand Up @@ -326,10 +326,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: "1.20"

- name: Get tag
id: get_version
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.0
1.20.0
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linters-settings:
locale: US
staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19"
go: "1.20"

linters:
disable-all: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDPLATFORM="linux/amd64"
ARG BUILDERIMAGE="golang:1.19-bullseye"
ARG BUILDERIMAGE="golang:1.20-bullseye"
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
ARG BASEIMAGE="gcr.io/distroless/static:nonroot"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ GATEKEEPER_NAMESPACE ?= gatekeeper-system

# When updating this, make sure to update the corresponding action in
# workflow.yaml
GOLANGCI_LINT_VERSION := v1.50.1
GOLANGCI_LINT_VERSION := v1.51.2

# Detects the location of the user golangci-lint cache.
GOLANGCI_LINT_CACHE := $(shell pwd)/.tmp/golangci-lint
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if settings.get("trigger_mode", "auto").lower() == "manual":
LDFLAGS = "-X github.com/open-policy-agent/gatekeeper/pkg/version.Version=latest"

TILT_DOCKERFILE = """
FROM golang:1.19-bullseye as tilt-helper
FROM golang:1.20-bullseye as tilt-helper
# Support live reloading with Tilt
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/tilt-dev/rerun-process-wrapper/60eaa572cdf825c646008e1ea28b635f83cefb38/restart.sh && \
wget --output-document /start.sh --quiet https://raw.githubusercontent.com/tilt-dev/rerun-process-wrapper/60eaa572cdf825c646008e1ea28b635f83cefb38/start.sh && \
Expand Down
2 changes: 1 addition & 1 deletion build/tooling/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-bullseye
FROM golang:1.20-bullseye

RUN GO111MODULE=on go install sigs.k8s.io/controller-tools/cmd/[email protected]
RUN GO111MODULE=on go install k8s.io/code-generator/cmd/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion gator.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDPLATFORM="linux/amd64"
ARG BUILDERIMAGE="golang:1.19-bullseye"
ARG BUILDERIMAGE="golang:1.20-bullseye"
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
ARG BASEIMAGE="gcr.io/distroless/static:nonroot"
Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
"sigs.k8s.io/controller-runtime/pkg/healthz"
crzap "sigs.k8s.io/controller-runtime/pkg/log/zap"
// +kubebuilder:scaffold:imports
)

const (
Expand Down
12 changes: 6 additions & 6 deletions pkg/gator/reader/read_constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func ReadUnstructureds(bytes []byte) ([]*unstructured.Unstructured, error) {

u, err := readUnstructured([]byte(split))
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidYAML, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidYAML, err)
}

result = append(result, u)
Expand Down Expand Up @@ -91,7 +91,7 @@ func ReadTemplate(scheme *runtime.Scheme, f fs.FS, path string) (*templates.Cons

u, err := readUnstructured(bytes)
if err != nil {
return nil, fmt.Errorf("%w: parsing ConstraintTemplate YAML from %q: %v", gator.ErrAddingTemplate, path, err)
return nil, fmt.Errorf("%w: parsing ConstraintTemplate YAML from %q: %w", gator.ErrAddingTemplate, path, err)
}

template, err := ToTemplate(scheme, u)
Expand All @@ -115,7 +115,7 @@ func ToTemplate(scheme *runtime.Scheme, u *unstructured.Unstructured) (*template
t, err := scheme.New(gvk)
if err != nil {
// The type isn't registered in the scheme.
return nil, fmt.Errorf("%w: %v", gator.ErrAddingTemplate, err)
return nil, fmt.Errorf("%w: %w", gator.ErrAddingTemplate, err)
}

// YAML parsing doesn't properly handle ObjectMeta, so we must
Expand All @@ -128,7 +128,7 @@ func ToTemplate(scheme *runtime.Scheme, u *unstructured.Unstructured) (*template
}
err = json.Unmarshal(jsonBytes, t)
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrAddingTemplate, err)
return nil, fmt.Errorf("%w: %w", gator.ErrAddingTemplate, err)
}

v, isVersionless := t.(versionless)
Expand All @@ -140,7 +140,7 @@ func ToTemplate(scheme *runtime.Scheme, u *unstructured.Unstructured) (*template
if err != nil {
// This shouldn't happen unless there's a bug in the conversion functions.
// Most likely it means the conversion functions weren't generated.
return nil, fmt.Errorf("%w: %v", gator.ErrConvertingTemplate, err)
return nil, fmt.Errorf("%w: %w", gator.ErrConvertingTemplate, err)
}

return template, nil
Expand All @@ -157,7 +157,7 @@ func ReadObject(f fs.FS, path string) (*unstructured.Unstructured, error) {

u, err := readUnstructured(bytes)
if err != nil {
return nil, fmt.Errorf("%w: parsing Constraint from %q: %v", gator.ErrAddingConstraint, path, err)
return nil, fmt.Errorf("%w: parsing Constraint from %q: %w", gator.ErrAddingConstraint, path, err)
}

return u, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/gator/verify/assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (a *Assertion) getMsgRegex() (*regexp.Regexp, error) {
a.msgRegex, err = regexp.Compile(*a.Message)
})
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidRegex, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidRegex, err)
}

return a.msgRegex, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/gator/verify/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type orFilter struct {
func newOrFilter(filter string) (Filter, error) {
regex, err := regexp.Compile(filter)
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidFilter, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidFilter, err)
}

return &orFilter{regex: regex}, nil
Expand Down Expand Up @@ -123,12 +123,12 @@ var _ Filter = &andFilter{}
func newAndFilter(testFilter, caseFilter string) (Filter, error) {
testRegex, err := regexp.Compile(testFilter)
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidFilter, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidFilter, err)
}

caseRegex, err := regexp.Compile(caseFilter)
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidFilter, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidFilter, err)
}

return &andFilter{testRegex: testRegex, caseRegex: caseRegex}, nil
Expand Down
28 changes: 14 additions & 14 deletions pkg/gator/verify/printer_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ func (p PrinterGo) PrintSuite(w StringWriter, r *SuiteResult, verbose bool) erro
if r.IsFailure() {
_, err := w.WriteString(fmt.Sprintf("FAIL\t%s\t%v\n", r.Path, r.Runtime))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
if r.Error != nil {
_, err = w.WriteString(fmt.Sprintf(" %v\n", r.Error))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}
} else {
_, err := w.WriteString(fmt.Sprintf("ok\t%s\t%v\n", r.Path, r.Runtime))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}
return nil
Expand All @@ -75,39 +75,39 @@ func (p PrinterGo) PrintTest(w StringWriter, r *TestResult, verbose bool) error
if r.Skipped {
_, err := w.WriteString(fmt.Sprintf("=== SKIP %s\n", r.Name))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
return nil
}

_, err := w.WriteString(fmt.Sprintf("=== RUN %s\n", r.Name))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}

for i := range r.CaseResults {
err := p.PrintCase(w, &r.CaseResults[i], verbose)
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}

if r.IsFailure() {
_, err := w.WriteString(fmt.Sprintf("--- FAIL: %s\t(%v)\n", r.Name, r.Runtime))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
if r.Error != nil {
_, err = w.WriteString(fmt.Sprintf(" %v\n", r.Error))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}
} else if verbose {
_, err := w.WriteString(fmt.Sprintf("--- PASS: %s\t(%v)\n", r.Name, r.Runtime))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}
return nil
Expand All @@ -118,26 +118,26 @@ func (p PrinterGo) PrintCase(w StringWriter, r *CaseResult, verbose bool) error
if r.Skipped {
_, err := w.WriteString(fmt.Sprintf(" === SKIP %s\n", r.Name))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
return nil
}

_, err := w.WriteString(fmt.Sprintf(" === RUN %s\n", r.Name))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}

if r.Error != nil {
_, err := w.WriteString(fmt.Sprintf(" --- FAIL: %s\t(%v)\n %v\n", r.Name, r.Runtime, r.Error))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
} else if verbose {
_, err := w.WriteString(fmt.Sprintf(" --- PASS: %s\t(%v)\n", r.Name, r.Runtime))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}

Expand All @@ -149,7 +149,7 @@ func (p PrinterGo) PrintCase(w StringWriter, r *CaseResult, verbose bool) error
}
_, err := w.WriteString(fmt.Sprintf("%sTRACE: %s\t%s\n", prefix, r.Name, strings.ReplaceAll(*r.Trace, "\n", "\n"+prefix)))
if err != nil {
return fmt.Errorf("%w: %v", ErrWritingString, err)
return fmt.Errorf("%w: %w", ErrWritingString, err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/gator/verify/read_suites.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func readSuite(f fs.FS, path string) (*Suite, error) {
}
err = yaml.Unmarshal(bytes, u.Object)
if err != nil {
return nil, fmt.Errorf("%w: parsing yaml file %q: %v", gator.ErrInvalidYAML, path, err)
return nil, fmt.Errorf("%w: parsing yaml file %q: %w", gator.ErrInvalidYAML, path, err)
}
gvk := u.GroupVersionKind()
if gvk.Group != Group || gvk.Kind != Kind {
Expand All @@ -198,7 +198,7 @@ func readSuite(f fs.FS, path string) (*Suite, error) {

err = gator.ParseYaml(bytes, &suite)
if err != nil {
return nil, fmt.Errorf("%w: %v", gator.ErrInvalidYAML, err)
return nil, fmt.Errorf("%w: %w", gator.ErrInvalidYAML, err)
}

return &suite, nil
Expand Down
Loading

0 comments on commit 852d1f4

Please sign in to comment.