Skip to content

Commit

Permalink
Upgrade dependencies (#81)
Browse files Browse the repository at this point in the history
* upgrade dependencies and fix lint bugs
* cleanup dockerfile

---------

Co-authored-by: Richard Hagen <[email protected]>
  • Loading branch information
Richard87 and Richard87 authored Jan 2, 2024
1 parent 7357b04 commit 81396e9
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 263 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

golangci:
name: lint
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
args: --timeout=5m --out-format=github-actions --fast
- name: Install dependencies
run: go mod download
- name: Install GolangCI Lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2

- name: golangci-lint
run: golangci-lint run --timeout=30m --max-same-issues=0 --out-format=github-actions

13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ ENV GO111MODULE=on
RUN apk update && \
apk add bash jq alpine-sdk sed gawk git ca-certificates curl mc && \
apk add --no-cache gcc musl-dev
RUN go install honnef.co/go/tools/cmd/[email protected] && \
go install github.com/rakyll/[email protected] && \
go install github.com/golang/mock/[email protected] && \
go install github.com/go-swagger/go-swagger/cmd/[email protected]

WORKDIR /app

Expand All @@ -19,17 +15,10 @@ RUN go mod download
# Copy project code
COPY . /app

# lint and unit tests
RUN staticcheck ./... && \
go vet ./... && \
CGO_ENABLED=0 GOOS=linux go test ./...

RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix

# Build
RUN swagger generate client -t ./generated-client -f https://api.radix.equinor.com/swaggerui/swagger.json -A radixapi && \
go mod tidy && \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx

## Run operator
FROM scratch
Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ENVIRONMENT ?= dev
VERSION ?= 0.0.1
RELEASE_NOTE ?= "First release"

.PHONY: generate-client
generate-client:
.PHONY: swagger
swagger: bootstrap
swagger generate client -t ./generated-client -f https://api.radix.equinor.com/swaggerui/swagger.json -A radixapi

.PHONY: push
Expand All @@ -12,5 +12,17 @@ push:
docker login ghcr.io/equinor
docker push ghcr.io/equinor/radix/rx:latest

staticcheck:
staticcheck ./...
.PHONY: lint
lint: bootstrap
golangci-lint run --max-same-issues 0

HAS_SWAGGER := $(shell command -v swagger;)
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;)

bootstrap:
ifndef HAS_SWAGGER
go install github.com/go-swagger/go-swagger/cmd/[email protected]
endif
ifndef HAS_GOLANGCI_LINT
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
endif
3 changes: 1 addition & 2 deletions cmd/createDeployPipelineJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/equinor/radix-cli/generated-client/client/application"
"github.com/equinor/radix-cli/generated-client/models"
"github.com/equinor/radix-cli/pkg/client"
commonErrors "github.com/equinor/radix-common/utils/errors"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -69,7 +68,7 @@ Examples:
errs = append(errs, err)
}
if len(errs) > 0 {
return commonErrors.Concat(errs)
return errors.Join(errs...)
}
if appName == nil || *appName == "" || targetEnvironment == "" {
return errors.New("application name and target environment are required")
Expand Down
5 changes: 4 additions & 1 deletion cmd/validateRadixConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@ func init() {

// Allow but hide token-env flag so radix-github-actions won't interfere
validateRadixConfigCmd.Flags().Bool(settings.TokenEnvironmentOption, false, fmt.Sprintf("Take the token from environment variable %s", client.TokenEnvironmentName))
validateRadixConfigCmd.Flags().MarkHidden(settings.TokenEnvironmentOption)
err := validateRadixConfigCmd.Flags().MarkHidden(settings.TokenEnvironmentOption)
if err != nil {
panic(err)
}
}
81 changes: 41 additions & 40 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ toolchain go1.21.0

require (
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0
github.com/equinor/radix-common v1.5.0
github.com/equinor/radix-operator v1.44.1
github.com/equinor/radix-operator v1.47.2
github.com/fatih/color v1.15.0
github.com/go-openapi/errors v0.20.4
github.com/go-openapi/runtime v0.26.0
Expand All @@ -16,79 +15,81 @@ require (
github.com/go-openapi/validate v0.22.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
k8s.io/utils v0.0.0-20230505201702-9f6742963106
sigs.k8s.io/yaml v1.3.0
github.com/spf13/cobra v1.8.0
k8s.io/utils v0.0.0-20231127182322-b307cd553661
sigs.k8s.io/yaml v1.4.0
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/equinor/radix-common v1.7.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/spec v0.20.8 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.1 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/client v0.64.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.70.0 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/client v0.70.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.6 // indirect
k8s.io/apiextensions-apiserver v0.27.6 // indirect
k8s.io/apimachinery v0.27.6 // indirect
k8s.io/client-go v0.27.6 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
sigs.k8s.io/controller-runtime v0.14.6 // indirect
k8s.io/api v0.29.0 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
k8s.io/apimachinery v0.29.0 // indirect
k8s.io/client-go v0.29.0 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a // indirect
sigs.k8s.io/controller-runtime v0.16.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/secrets-store-csi-driver v1.3.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/secrets-store-csi-driver v1.4.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Loading

0 comments on commit 81396e9

Please sign in to comment.