Skip to content

Commit

Permalink
Merge pull request #256 from SovereignCloudStack/tg/upgrade-of-go-ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
guettli authored Sep 4, 2024
2 parents e982769 + e142055 commit 44b4f81
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .builder-image-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.19
1.1.20
1 change: 1 addition & 0 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ runs:
- name: Install go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: "1.22"
go-version-file: "go.mod"
cache: true
cache-dependency-path: go.sum
Expand Down
2 changes: 1 addition & 1 deletion .github/renovate/golang.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
// https://docs.renovatebot.com/configuration-options/#constraints
"constraints": {
"go": "1.21"
"go": "1.22"
},
packageRules: [
{
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
container:
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.19
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.20
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand All @@ -31,6 +31,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./.github/actions/setup-go

- name: Fixup git permissions
# https://github.com/actions/checkout/issues/766
shell: bash
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,8 @@ jobs:
with:
fetch-depth: 0

- name: Install go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
cache: true
cache-dependency-path: go.sum

- uses: ./.github/actions/setup-go

- name: install kustomize
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule-scan-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Trivy
runs-on: ubuntu-latest
container:
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.19
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.20
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ main
*.tgz.yaml
*.build.yaml
.release

# .config/go/telemetry/local/
.config
20 changes: 4 additions & 16 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters:
- errname
- errorlint
- exhaustive
- exportloopref
- copyloopvar
- forcetypeassert
- gci
- goconst
Expand Down Expand Up @@ -86,10 +86,7 @@ linters-settings:
allow-unused: false
allow-leading-space: false
require-specific: true
staticcheck:
go: "1.21"
stylecheck:
go: "1.21"
checks: ["all", "-ST1006"]
dot-import-whitelist:
- "github.com/onsi/gomega"
Expand Down Expand Up @@ -223,8 +220,6 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: true
unused:
go: "1.21"
usestdlibvars:
# Suggest the use of http.MethodXX.
# Default: true
Expand All @@ -247,9 +242,6 @@ linters-settings:
# Suggest the use of rpc.DefaultXXPath.
# Default: false
default-rpc-path: true
# Suggest the use of os.DevNull.
# Default: false
os-dev-null: true
# Suggest the use of sql.LevelXX.String().
# Default: false
sql-isolation-level: true
Expand All @@ -259,9 +251,6 @@ linters-settings:
# Suggest the use of constant.Kind.String().
# Default: false
constant-kind: true
# Suggest the use of syslog.Priority.
# Default: false
syslog-priority: true
wrapcheck:
ignoreSigs:
- status.Error(
Expand All @@ -285,11 +274,10 @@ issues:
- linters:
- wrapcheck
path: _test\.go
exclude-dirs:
- vendor$
run:
timeout: 10m
go: "1.21"
go: "1.22"
allow-parallel-runners: true
modules-download-mode: vendor
skip-dirs:
- vendor$
- test/vendor$
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ MGT_CLUSTER_KUBECONFIG ?= ".mgt-cluster-kubeconfig.yaml"

# Kubebuilder.
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.29.3
# versions
# versions
CTLPTL_VERSION := 0.8.25

##@ Binaries
Expand Down Expand Up @@ -445,7 +445,7 @@ ifeq ($(BUILD_IN_CONTAINER),true)
else
go version
golangci-lint version
GO111MODULE=on golangci-lint run -v --out-format=github-actions
GO111MODULE=on golangci-lint run -v --out-format=colored-line-number
endif

.PHONY: lint-yaml
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/SovereignCloudStack/cluster-stack-operator

go 1.21
go 1.22

require (
github.com/go-logr/logr v1.4.2
Expand Down
28 changes: 14 additions & 14 deletions images/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# If you make changes to this Dockerfile run `make builder-image-push`.

# Install Lychee
FROM docker.io/library/alpine:3.20.0@sha256:216266c86fc4dcef5619930bd394245824c2af52fd21ba7c6fa0e618657d4c3b as lychee
FROM docker.io/library/alpine:3.20.2 AS lychee
# update: datasource=github-tags depName=lycheeverse/lychee versioning=semver
ENV LYCHEE_VERSION="v0.15.1"
# hadolint ignore=DL3018
Expand All @@ -29,22 +29,22 @@ RUN apk add --no-cache curl && \
mv /tmp/lychee /usr/bin/lychee && \
rm -rf /tmp/linux-amd64 /tmp/lychee-${LYCHEE_VERSION}.tgz

FROM cgr.dev/chainguard/wolfi-base:latest as wolfi
FROM cgr.dev/chainguard/wolfi-base:latest AS wolfi

# update: datasource=github-tags depName=kubernetes-sigs/cluster-api
ARG CLUSTERCTL_VERSION="v1.6.2"
ARG CLUSTERCTL_VERSION="v1.8.1"
# update: datasource=github-tags depName=helm/helm
ENV HELM_VERSION="v3.14.1"
# update: datasource=github-tags depName=kubernetes-sigs/kind
ARG KIND_VERSION="v0.20.0"
ARG KIND_VERSION="v0.24.0"
# update: datasource=github-tags depName=kubernetes/kubernetes
ARG KUBECTL_VERSION="v1.27.3"
ARG KUBECTL_VERSION="v1.30.4"
# update: datasource=github-tags depName=kubernetes-sigs/kustomize extractVersion=^kustomize\/v(?<version>.+)$
ARG KUSTOMIZE_VERSION="v5.3.0"
ARG KUSTOMIZE_VERSION="v5.4.3"
# update: datasource=github-tags depName=aquasecurity/trivy
ARG TRIVY_VERSION="v0.48.3"
ARG TRIVY_VERSION="v0.54.1"
# update: datasource=github-tags depName=kubernetes-sigs/controller-tools
ARG CONTROLLER_GEN_VERSION="v0.14.0"
ARG CONTROLLER_GEN_VERSION="v0.16.1"

# hadolint ignore=DL3018
RUN apk add -U --no-cache \
Expand All @@ -55,27 +55,27 @@ RUN apk add -U --no-cache \
kind=~${KIND_VERSION#v} \
kubectl=~${KUBECTL_VERSION#v} \
kustomize=~${KUSTOMIZE_VERSION#v} \
trivy=~${TRIVY_VERSION#v}
trivy=~${TRIVY_VERSION#v}

# Install Golang CI Lint
FROM docker.io/library/alpine:3.20.0@sha256:216266c86fc4dcef5619930bd394245824c2af52fd21ba7c6fa0e618657d4c3b as golangci
FROM docker.io/library/alpine:3.20.2 AS golangci
# update: datasource=github-tags depName=golangci/golangci-lint versioning=semver
ENV GOLANGCI_VERSION="v1.59.0"
ENV GOLANGCI_VERSION="v1.60.3"
WORKDIR /
# hadolint ignore=DL3018,DL4006
RUN apk add --no-cache curl && \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s ${GOLANGCI_VERSION}

# Install Hadolint
FROM docker.io/hadolint/hadolint:v2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 as hadolint
FROM docker.io/hadolint/hadolint:v2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 AS hadolint

# Install Trivy
FROM docker.io/aquasec/trivy:0.51.4@sha256:20a7c9cd02841a3d8d2a2506b93502a944adc57a3db9adf75b59266023b2af1e as trivy
FROM docker.io/aquasec/trivy:0.54.1 AS trivy

############################
# CSO Build Image Base #
############################
FROM docker.io/library/golang:1.21.6-bullseye
FROM docker.io/library/golang:1.23.0-bullseye

# update: datasource=github-tags depName=adrienverge/yamllint versioning=semver
ENV YAMLLINT_VERSION="v1.35.1"
Expand Down
2 changes: 1 addition & 1 deletion images/cso/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
FROM --platform=${BUILDPLATFORM} docker.io/alpine/helm:3.15.1 as helm

# Build the manager binary
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.6-bullseye as build
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.23.0-bullseye as build
ARG TARGETOS TARGETARCH

COPY . /src/cluster-stack-operator
Expand Down
19 changes: 11 additions & 8 deletions internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re

releaseAsset, download, err := release.New(release.ConvertFromClusterClassToClusterStackFormat(cluster.Spec.Topology.Class), r.ReleaseDirectory)
if err != nil {
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, err.Error())
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, "%s", err.Error())
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
if download {
Expand All @@ -204,9 +204,9 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError,
msg,
"%s", msg,
)
record.Warnf(clusterAddon, "ValidateHelmChartFailed", msg)
record.Warn(clusterAddon, "ValidateHelmChartFailed", msg)
return reconcile.Result{}, nil
}

Expand Down Expand Up @@ -947,9 +947,9 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
csov1alpha1.AssetsClientAPIAvailableCondition,
csov1alpha1.FailedCreateAssetsClientReason,
clusterv1.ConditionSeverityError,
err.Error(),
"%s", err.Error(),
)
record.Warnf(clusterAddon, "FailedCreateAssetsClient", err.Error())
record.Warn(clusterAddon, "FailedCreateAssetsClient", err.Error())

// give the assets client a second change
if isSet {
Expand All @@ -963,7 +963,10 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
// check if old cluster stack release is present or not.
releaseAsset, download, err := release.New(release.ConvertFromClusterClassToClusterStackFormat(clusterAddon.Spec.ClusterStack), r.ReleaseDirectory)
if err != nil {
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, err.Error())
conditions.MarkFalse(clusterAddon,
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError, "%s", err.Error())
return nil, true, nil
}
if download {
Expand Down Expand Up @@ -991,9 +994,9 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError,
msg,
"%s", msg,
)
record.Warnf(clusterAddon, "ValidateHelmChartFailed", msg)
record.Warn(clusterAddon, "ValidateHelmChartFailed", msg)
return nil, false, nil
}

Expand Down
12 changes: 6 additions & 6 deletions internal/controller/clusterstack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.AssetsClientAPIAvailableCondition,
csov1alpha1.FailedCreateAssetsClientReason,
clusterv1.ConditionSeverityError,
err.Error(),
"%s", err.Error(),
)
record.Warnf(clusterStack, "FailedCreateAssetsClient", err.Error())
record.Warn(clusterStack, "FailedCreateAssetsClient", err.Error())

// give the assets client a second change
if isSet {
Expand All @@ -140,7 +140,7 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.ReleasesSyncedCondition,
csov1alpha1.FailedToSyncReason,
clusterv1.ConditionSeverityWarning,
err.Error(),
"%s", err.Error(),
)
logger.Error(err, "failed to get latest release from remote repository")
}
Expand All @@ -165,7 +165,7 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
if err := r.Delete(ctx, toDelete[i]); err != nil && !apierrors.IsNotFound(err) {
// ignore not found errors when deleting
reterr := fmt.Errorf("failed to delete cluster stack release %s: %w", csr.Name, err)
record.Eventf(clusterStack, "FailedToDeleteClusterStackRelease", reterr.Error())
record.Event(clusterStack, "FailedToDeleteClusterStackRelease", reterr.Error())
return reconcile.Result{}, reterr
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.ProviderClusterStackReleasesSyncedCondition,
csov1alpha1.FailedToCreateOrUpdateReason,
clusterv1.ConditionSeverityWarning,
err.Error(),
"%s", err.Error(),
)
}
return reconcile.Result{}, fmt.Errorf("failed to create or update provider specific ClusterStackRelease %s/%s: %w", req.Namespace, csr.Name, err)
Expand All @@ -210,7 +210,7 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.ClusterStackReleasesSyncedCondition,
csov1alpha1.FailedToCreateOrUpdateReason,
clusterv1.ConditionSeverityWarning,
err.Error(),
"%s", err.Error(),
)
return reconcile.Result{}, fmt.Errorf("failed to get or create ClusterStackRelease %s/%s: %w", req.Namespace, csr.Name, err)
}
Expand Down
9 changes: 6 additions & 3 deletions internal/controller/clusterstackrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon

releaseAssets, download, err := release.New(releaseTag, r.ReleaseDirectory)
if err != nil {
conditions.MarkFalse(clusterStackRelease, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, err.Error())
conditions.MarkFalse(clusterStackRelease,
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError, "%s", err.Error())
return reconcile.Result{RequeueAfter: 1 * time.Minute}, fmt.Errorf("failed to create release: %w", err)
}

Expand All @@ -127,9 +130,9 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
csov1alpha1.AssetsClientAPIAvailableCondition,
csov1alpha1.FailedCreateAssetsClientReason,
clusterv1.ConditionSeverityError,
err.Error(),
"%s", err.Error(),
)
record.Warnf(clusterStackRelease, "FailedCreateAssetsClient", err.Error())
record.Warn(clusterStackRelease, "FailedCreateAssetsClient", err.Error())

// give the assets client a second change
if isSet {
Expand Down
2 changes: 1 addition & 1 deletion pkg/assetsclient/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *realGhClient) ListRelease(ctx context.Context) ([]string, error) {
return nil, fmt.Errorf("failed to list releases: %w", err)
}

if response != nil && response.StatusCode != 200 {
if response != nil && response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("got unexpected status from call to remote repository: %s", response.Status)
}

Expand Down

0 comments on commit 44b4f81

Please sign in to comment.