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

build: Upgrade to go-1.23, Linter1.61.0 and Alpine 3.20 #4931

Merged
merged 1 commit into from
Oct 3, 2024
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
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ linters:
disable:
enable:
- gosec
linters-settings:
gosec:
excludes:
# G115: integer overflow conversion
# exclude the rule since it tends to be false positive
- G115
6 changes: 6 additions & 0 deletions Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,3 +481,9 @@ https://github.com/jonboulle/clockwork/blob/master/LICENSE

robfig/cron (MIT) - https://github.com/robfig/cron/v3
https://github.com/robfig/cron/blob/master/LICENSE

github.com/openziti/channel/v3 (Apache 2.0) - github.com/openziti/channel/v3
https://github.com/openziti/channel/blob/main/LICENSE

gopkg.in/go-jose/go-jose.v2 (Apache 2.0) - https://github.com/go-jose/go-jose
https://github.com/go-jose/go-jose/blob/v2.6.3/LICENSE
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ lint:
@if [ "z${ARCH}" = "zx86_64" ] && which golangci-lint >/dev/null ; then echo "running golangci-lint"; golangci-lint version; go version; golangci-lint cache clean; golangci-lint run --verbose --config .golangci.yml ; else echo "WARNING: Linting skipped (not on x86_64 or linter not installed)"; fi

install-lint:
sudo curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.54.2
sudo curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.61.0

test: unittest hadolint lint
$(GO) vet ./...
Expand Down
4 changes: 2 additions & 2 deletions cmd/core-command/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -32,7 +32,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/core-command/core-command

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache dumb-init
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/core-common-config-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# ----------------------------------------------------------------------------------

# Docker image for Golang Core common config bootstrapper service
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -33,7 +33,7 @@ COPY . .
RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/core-common-config-bootstrapper/core-common-config-bootstrapper

#Next image - Copy built Go binary into new workspace
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2023: Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/core-data/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# ----------------------------------------------------------------------------------

# Docker image for Golang Core Data micro service
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -34,7 +34,7 @@ COPY . .
RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/core-data/core-data

#Next image - Copy built Go binary into new workspace
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2023: Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/core-keeper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ----------------------------------------------------------------------------------

# Docker image for Golang Core Keeper micro service
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

WORKDIR /edgex-go
Expand All @@ -35,7 +35,7 @@ COPY . .
RUN make cmd/core-keeper/core-keeper

#Next image - Copy built Go binary into new workspace
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2024: IOTech'
Expand Down
4 changes: 2 additions & 2 deletions cmd/core-metadata/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -33,7 +33,7 @@ COPY . .
RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/core-metadata/core-metadata

#Next image - Copy built Go binary into new workspace
FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache dumb-init
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

WORKDIR /edgex-go
Expand All @@ -30,7 +30,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make cmd/security-bootstrapper/security-bootstrapper

FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2023 Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-proxy-auth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# ----------------------------------------------------------------------------------

# Docker image for Golang Core common config bootstrapper service
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -33,7 +33,7 @@ COPY . .
RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/security-proxy-auth/security-proxy-auth

#Next image - Copy built Go binary into new workspace
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2023: Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-proxy-setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

WORKDIR /edgex-go
Expand All @@ -29,7 +29,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make cmd/secrets-config/secrets-config

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache dumb-init su-exec openssl yq
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-secretstore-setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

WORKDIR /edgex-go
Expand All @@ -30,7 +30,7 @@ COPY . .
RUN make cmd/security-file-token-provider/security-file-token-provider \
cmd/security-secretstore-setup/security-secretstore-setup

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache ca-certificates dumb-init su-exec yq
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-spiffe-token-provider/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ----------------------------------------------------------------------------------

# Build utility container
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

WORKDIR /edgex-go
Expand All @@ -30,7 +30,7 @@ COPY . .
RUN make cmd/security-spiffe-token-provider/security-spiffe-token-provider

# Deployment image
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2023 Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-spire-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
# ----------------------------------------------------------------------------------

# Build utility container
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

FROM ghcr.io/spiffe/spire-server:1.9.6 as spire_server
FROM ghcr.io/spiffe/spire-agent:1.9.6 as spire_agent

# Deployment image
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2022 Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-spire-config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
# ----------------------------------------------------------------------------------

# Build utility container
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

FROM ghcr.io/spiffe/spire-server:1.9.6 as spire_server

# Deployment image
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2022 Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-spire-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
# ----------------------------------------------------------------------------------

# Build utility container
ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

FROM ghcr.io/spiffe/spire-server:1.9.6 as spire_server

# Deployment image
FROM alpine:3.18
FROM alpine:3.20

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2022 Intel Corporation'
Expand Down
4 changes: 2 additions & 2 deletions cmd/support-cron-scheduler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -30,7 +30,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make cmd/support-cron-scheduler/support-cron-scheduler

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache ca-certificates dumb-init tzdata
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/support-notifications/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -31,7 +31,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make cmd/support-notifications/support-notifications

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache ca-certificates dumb-init
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
4 changes: 2 additions & 2 deletions cmd/support-scheduler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# ----------------------------------------------------------------------------------

ARG BUILDER_BASE=golang:1.21-alpine3.18
ARG BUILDER_BASE=golang:1.23-alpine3.20
FROM ${BUILDER_BASE} AS builder

ARG ADD_BUILD_TAGS=""
Expand All @@ -32,7 +32,7 @@ RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
COPY . .
RUN make cmd/support-scheduler/support-scheduler

FROM alpine:3.18
FROM alpine:3.20

RUN apk add --update --no-cache dumb-init
# Ensure using latest versions of all installed packages to avoid any recent CVEs
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/edgexfoundry/edgex-go

go 1.21
go 1.23

require (
github.com/eclipse/paho.mqtt.golang v1.5.0
Expand Down
2 changes: 1 addition & 1 deletion internal/support/cronscheduler/infrastructure/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (m *manager) ValidateUpdatingScheduleJob(job models.ScheduleJob) errors.Edg
if job.Definition == nil {
return errors.NewCommonEdgeX(errors.KindContractInvalid, "definition field is required", nil)
}
if job.Actions == nil || len(job.Actions) == 0 {
if len(job.Actions) == 0 {
return errors.NewCommonEdgeX(errors.KindContractInvalid, "actions field is required", nil)
}

Expand Down
Loading