Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/aws-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: "1.24"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Cache go module
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version: '3.12'
- uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: "1.24"
- uses: pre-commit/action@v3.0.1
- uses: pre-commit/action@v3.0.1
name: Verify generated files are up-to-date
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: "1.24"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Cache go module
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/emailsender-central-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: "1.24"
- name: Cache go module
uses: actions/cache@v4
with:
Expand Down
31 changes: 16 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# golangci-lint configuration v2
version: 2

run:
skip-dirs:
- internal/central/pkg/api/public
- internal/central/pkg/api/private
- internal/central/pkg/api/admin/private
- pkg/client/redhatsso/api
- emailsender/pkg/client/openapi
skip-files:
- ".*_moq.go"
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m
go: "1.24.7"

issues:
exclude-use-default: false
exclude-files:
- ".*_moq.go"
exclude-dirs:
- "internal/central/pkg/api/public"
- "internal/central/pkg/api/private"
- "internal/central/pkg/api/admin/private"
- "pkg/client/redhatsso/api"
- "emailsender/pkg/client/openapi"
exclude-rules:
- path: _test\.go
linters:
Expand Down Expand Up @@ -39,6 +43,10 @@ issues:
text: "don't use leading k in Go names"

linters-settings:
staticcheck:
# Disable specific staticcheck rules that were excluded in v1 config
# staticcheck now includes both SA (staticcheck) and ST (stylecheck) rules
checks: ["all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-SA1019", "-SA4001", "-ST1016"]
gosec:
includes:
- G601
Expand Down Expand Up @@ -90,9 +98,6 @@ linters-settings:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
staticcheck:
go: "1.23"
checks: [ all,-ST1000,-ST1001,-ST1003,-ST1005,-SA1019,-SA4001,-ST1016 ]
wrapcheck: {}
# ignoreSigRegexps: uncomment to add ignore rules

Expand Down Expand Up @@ -120,13 +125,10 @@ linters:
# - godot
# - godox
# - goerr113
- gofmt
- goimports
- revive
# - gomnd
# - goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
# - interfacer
Expand All @@ -141,7 +143,6 @@ linters:
# - scopelint
- staticcheck
# - structcheck
# - stylecheck
# - testpackage
# - typecheck
# - unconvert
Expand Down
2 changes: 1 addition & 1 deletion .openshift-ci/e2e-runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

RUN dnf update -y --disablerepo=\* --enablerepo=baseos,appstream && dnf -y install procps make which git gettext jq gcc && dnf clean all && rm -rf /var/cache/dnf

COPY --from=registry.ci.openshift.org/openshift/release:golang-1.23 /usr/lib/golang /usr/lib/golang
COPY --from=registry.redhat.io/rhel9/go-toolset:1.24.6 /usr/lib/golang /usr/lib/golang
COPY --from=quay.io/openshift/origin-cli:4.20 /usr/bin/oc /usr/bin

ENV GOPATH=/go
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
- repo: https://github.com/golangci/golangci-lint
rev: v1.64.8
rev: v2.4.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

hooks:
- id: golangci-lint
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The codebase follows a dependency injection pattern using the `goava/di` framewo
## Development Workflow

### Environment Setup
1. Install prerequisites: Go 1.23+, Docker, Node.js, Java, OCM CLI
1. Install prerequisites: Go 1.24+, Docker, Node.js, Java, OCM CLI
2. Run `make setup/git/hooks` to install pre-commit hooks
3. Use `make deploy/bootstrap` to set up development cluster
4. Run `make deploy/dev` to start local development environment
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.23.6-4 AS build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.24.6-1756315360 AS build

USER root
RUN mkdir /src /rds_ca
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ACS fleet-manager repository for the ACS managed service.

#### Prerequisites

* [Golang 1.23+](https://golang.org/dl/)
* [Golang 1.24+](https://golang.org/dl/)
* [Docker](https://docs.docker.com/get-docker/) - to create database
* [ocm cli](https://github.com/openshift-online/ocm-cli/releases) - ocm command line tool
* [Node.js v12.20+](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
Expand Down
2 changes: 1 addition & 1 deletion emailsender/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi8/go-toolset:1.23.6-4 AS build
FROM registry.access.redhat.com/ubi8/go-toolset:1.24.6-1756315360 AS build
USER root
ENV GOFLAGS="-mod=mod"

Expand Down
2 changes: 1 addition & 1 deletion fleetshard-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN microdnf install gzip tar && \
ARG IMAGE_TAG=latest
RUN yq -i ".global.image.tag = strenv(IMAGE_TAG)" rhacs-terraform/values.yaml

FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.23.6-4 AS build-go
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.24.6-1756315360 AS build-go
USER root

RUN mkdir /src
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/stackrox/acs-fleet-manager

go 1.23.0
go 1.24.6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to specify the lowest possible Go version, to be able to run on the lower patch versions, unless you rely on a bug fix that is introduced in 1.24.6

Suggested change
go 1.24.6
go 1.24.0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, 1.24.6 is the lowest possible.The argo-cd dep requires it:

$ go mod tidy
go: github.com/argoproj/argo-cd/v2@v2.14.16 requires go >= 1.24.6; switching to go1.24.7


require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/antihax/optional v1.0.0
github.com/argoproj-labs/argocd-operator v0.14.0
github.com/argoproj/argo-cd/v2 v2.14.13
github.com/argoproj/argo-cd/v2 v2.14.17
github.com/aws/aws-sdk-go-v2 v1.36.5
github.com/aws/aws-sdk-go-v2/config v1.29.17
github.com/aws/aws-sdk-go-v2/credentials v1.17.70
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwc
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/argoproj-labs/argocd-operator v0.14.0 h1:ksHsdV5hC8u275PWU746EXB/c09g7UzdJPdkIqDQwjU=
github.com/argoproj-labs/argocd-operator v0.14.0/go.mod h1:UHe70eXnnCEfzp7EWRofMU+BFnPgZiT5OSqpuInEARA=
github.com/argoproj/argo-cd/v2 v2.14.13 h1:oSLPHV9Gon6mEqVkyBOuLJ7T16ShZv6xSjkCiquzEDM=
github.com/argoproj/argo-cd/v2 v2.14.13/go.mod h1:P72XxcRigWQpQsuAgaXyHPFYkSPE4sdACA5g/s3Si1I=
github.com/argoproj/argo-cd/v2 v2.14.17 h1:r/CkYKzHoPjGgJ/4/fdubUVpG+LBj6AtOigbitNHgy4=
github.com/argoproj/argo-cd/v2 v2.14.17/go.mod h1:CF9GX0CjKiszpAnvYNCLV5tLSVqgfOgn/tcOt2VHTQo=
github.com/argoproj/gitops-engine v0.7.1-0.20250521000818-c08b0a72c1f1 h1:Ze4U6kV49vSzlUBhH10HkO52bYKAIXS4tHr/MlNDfdU=
github.com/argoproj/gitops-engine v0.7.1-0.20250521000818-c08b0a72c1f1/go.mod h1:WsnykM8idYRUnneeT31cM/Fq/ZsjkefCbjiD8ioCJkU=
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1 h1:qsHwwOJ21K2Ao0xPju1sNuqphyMnMYkyB3ZLoLtxWpo=
Expand Down
3 changes: 1 addition & 2 deletions internal/central/pkg/handlers/admin_central.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package handlers

import (
"encoding/json"
"fmt"
"io"
"net/http"
"regexp"
Expand Down Expand Up @@ -376,7 +375,7 @@ func (h adminCentralHandler) GetTrait(w http.ResponseWriter, r *http.Request) {
return nil, svcErr
}
if !arrays.Contains(cr.Traits, trait) {
return nil, errors.NotFound(fmt.Sprintf("Trait %q not found", trait))
return nil, errors.NotFound("Trait %q not found", trait)
}
return nil, nil
},
Expand Down
6 changes: 3 additions & 3 deletions internal/central/pkg/services/central.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (k *centralService) RegisterCentralJob(ctx context.Context, centralRequest
} else if !hasCapacity {
errorMsg := fmt.Sprintf("Cluster capacity(%d) exhausted in %s region", int64(k.dataplaneClusterConfig.ClusterConfig.GetCapacityForRegion(centralRequest.Region)), centralRequest.Region)
logger.Logger.Warningf(errorMsg)
return errors.TooManyCentralInstancesReached(errorMsg)
return errors.TooManyCentralInstancesReached("%s", errorMsg)
}

instanceType := k.DetectInstanceType(centralRequest)
Expand All @@ -298,7 +298,7 @@ func (k *centralService) RegisterCentralJob(ctx context.Context, centralRequest
if e != nil || cluster == nil {
msg := fmt.Sprintf("No available cluster found for '%s' central instance in region: '%s'", centralRequest.InstanceType, centralRequest.Region)
logger.Logger.Errorf(msg)
return errors.TooManyCentralInstancesReached(fmt.Sprintf("Region %s cannot accept instance type: %s at this moment", centralRequest.Region, centralRequest.InstanceType))
return errors.TooManyCentralInstancesReached("Region %s cannot accept instance type: %s at this moment", centralRequest.Region, centralRequest.InstanceType)
}
centralRequest.ClusterID = cluster.ClusterID
subscriptionID, err := k.reserveQuota(ctx, centralRequest, "", "")
Expand Down Expand Up @@ -747,7 +747,7 @@ func (k *centralService) VerifyAndUpdateCentralAdmin(ctx context.Context, centra
return errors.NewWithCause(errors.ErrorGeneral, svcErr, "Unable to find cluster associated with central request: %s", centralRequest.ID)
}
if cluster == nil {
return errors.New(errors.ErrorValidation, fmt.Sprintf("Unable to get cluster for central %s", centralRequest.ID))
return errors.New(errors.ErrorValidation, "Unable to get cluster for central %s", centralRequest.ID)
}

return k.UpdateIgnoreNils(centralRequest)
Expand Down
5 changes: 2 additions & 3 deletions internal/central/pkg/services/quota/ams_quota_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package quota

import (
"context"
"fmt"
"net/http"
"time"

Expand Down Expand Up @@ -50,9 +49,9 @@ func (q amsQuotaService) HasQuotaAllowance(central *dbapi.CentralRequest, instan
quotaType := instanceType.GetQuotaType()
quotaCosts, err := q.amsClient.GetQuotaCostsForProduct(org.ID(), quotaType.GetResourceName(), quotaType.GetProduct())
if err != nil {
return false, errors.NewWithCause(errors.ErrorGeneral, err, fmt.Sprintf(
return false, errors.NewWithCause(errors.ErrorGeneral, err,
"failed to get assigned quota of type %q for organization with external id %q and id %q",
quotaType, central.OrganisationID, org.ID()))
quotaType, central.OrganisationID, org.ID())
}

quotaCostsByModel, unsupportedModels := mapAllowedQuotaCosts(quotaCosts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ func (q QuotaManagementListService) ReserveQuota(_ context.Context, central *dba
if quotaManagementListItem.IsInstanceCountWithinLimit(totalInstanceCount) {
return "", nil
}
return "", errors.MaximumAllowedInstanceReached(message)
return "", errors.MaximumAllowedInstanceReached("%s", message)
}

if instanceType == types.EVAL && quotaManagementListItem == nil {
if totalInstanceCount >= quotamanagement.GetDefaultMaxAllowedInstances() {
return "", errors.MaximumAllowedInstanceReached(message)
return "", errors.MaximumAllowedInstanceReached("%s", message)
}
return "", nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/central/test/integration/centrals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestCentral_Delete(t *testing.T) {
ocmServerBuilder := mocks.NewMockConfigurableServerBuilder()
mockedGetClusterResponse, err := mockedClusterWithMetricsInfo(mocks.MockClusterComputeNodes)
if err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
ocmServerBuilder.SetClusterGetResponse(mockedGetClusterResponse, nil)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestDataPlaneClusterStatus(t *testing.T) {
ocmServerBuilder := mocks.NewMockConfigurableServerBuilder()
mockedGetClusterResponse, err := mockedClusterWithMetricsInfo(mocks.MockClusterComputeNodes)
if err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}

ocmServerBuilder.SetClusterGetResponse(mockedGetClusterResponse, nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func termsRequiredSetup(termsRequired bool, t *testing.T) TestEnv {
ocmServerBuilder := mocks.NewMockConfigurableServerBuilder()
termsReviewResponse, err := mocks.GetMockTermsReviewBuilder(nil).TermsRequired(termsRequired).Build()
if err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
ocmServerBuilder.SetTermsReviewPostResponse(termsReviewResponse, nil)
ocmServer := ocmServerBuilder.Build()
Expand Down
11 changes: 3 additions & 8 deletions pkg/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ func SendNotFound(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")

// Prepare the body:
reason := fmt.Sprintf(
"The requested resource '%s' doesn't exist",
r.URL.Path,
)
apiError := errors.NotFound(reason).AsOpenapiError("", r.RequestURI)
apiError := errors.NotFound("The requested resource '%s' doesn't exist", r.URL.Path).AsOpenapiError("", r.RequestURI)
data, err := json.Marshal(apiError)
if err != nil {
SendPanic(w, r)
Expand All @@ -41,8 +37,7 @@ func SendNotFound(w http.ResponseWriter, r *http.Request) {

// SendMethodNotAllowed response
func SendMethodNotAllowed(w http.ResponseWriter, r *http.Request) {
reason := fmt.Sprintf("Method: %s is not allowed or not yet implemented for %s", r.Method, r.URL.Path)
apiError := errors.NotImplemented(reason).AsOpenapiError("", r.RequestURI)
apiError := errors.NotImplemented("Method: %s is not allowed or not yet implemented for %s", r.Method, r.URL.Path).AsOpenapiError("", r.RequestURI)
jsonPayload, err := json.Marshal(apiError)
if err != nil {
SendPanic(w, r)
Expand Down Expand Up @@ -87,7 +82,7 @@ func SendServiceUnavailable(w http.ResponseWriter, r *http.Request, reason strin
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusServiceUnavailable)

apiError := errors.GeneralError(reason).AsOpenapiError("", r.RequestURI)
apiError := errors.GeneralError("%s", reason).AsOpenapiError("", r.RequestURI)
jsonPayload, err := json.Marshal(apiError)
if err != nil {
SendPanic(w, r)
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/resource_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestResourceIDGeneration(t *testing.T) {
errors := validation.IsDNS1123Label(id)
if len(errors) > 0 {
for _, e := range errors {
t.Fatalf(e)
t.Fatalf("%s", e)
}
}
}
2 changes: 1 addition & 1 deletion pkg/client/ocm/impl/client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *client) CreateCluster(cluster *clustersmgmtv1.Cluster) (*clustersmgmtv1
clusterResource := c.connection.ClustersMgmt().V1().Clusters()
response, err := clusterResource.Add().Body(cluster).Send()
if err != nil {
return &clustersmgmtv1.Cluster{}, serviceErrors.New(serviceErrors.ErrorGeneral, err.Error())
return &clustersmgmtv1.Cluster{}, serviceErrors.New(serviceErrors.ErrorGeneral, "%s", err.Error())
}
createdCluster := response.Body()

Expand Down
6 changes: 3 additions & 3 deletions pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func ToServiceError(err error) *ServiceError {
case *ServiceError:
return convertedErr
default:
return GeneralError(convertedErr.Error())
return GeneralError("%s", convertedErr.Error())
}
}

Expand Down Expand Up @@ -398,7 +398,7 @@ func (e *ServiceError) AsError() error {
if e == nil {
return nil
}
return fmt.Errorf(e.Error())
return fmt.Errorf("%s", e.Error())
}

// Is404 ...
Expand Down Expand Up @@ -693,5 +693,5 @@ func FailedClusterAuthorization(err error) *ServiceError {
if svcErr.IsForbidden() {
reason += " - please contact your administrator to ensure that your Red Hat account has the RedhatManagedCluster permission."
}
return NewWithCause(svcErr.Code, svcErr, reason)
return NewWithCause(svcErr.Code, svcErr, "%s", reason)
}
3 changes: 1 addition & 2 deletions probe/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.23.9-2.1749483526 AS build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:1.24.6-1756315360 AS build
USER root
ENV GOFLAGS="-mod=mod"

RUN mkdir /src
WORKDIR /src
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@v1.23.1
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a debugging leftover

COPY go.* ./
RUN go mod download
COPY . ./
Expand Down
Loading
Loading