Skip to content
Open
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 .bingo/bingo.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require github.com/bwplotka/bingo v0.10.0
2 changes: 1 addition & 1 deletion .bingo/gci.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require github.com/daixiang0/gci v0.14.0
2 changes: 1 addition & 1 deletion .bingo/go-bindata.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require github.com/go-bindata/go-bindata v3.1.2+incompatible // go-bindata
2 changes: 1 addition & 1 deletion .bingo/golangci-lint.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require github.com/golangci/golangci-lint/v2 v2.12.2 // cmd/golangci-lint
2 changes: 1 addition & 1 deletion .bingo/goreleaser.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require (
al.essio.dev/pkg/shellescape v1.6.0 // indirect
Expand Down
4 changes: 3 additions & 1 deletion .bingo/mockgen.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.25.8
go 1.26.3

require go.uber.org/mock v0.4.0 // mockgen
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/go-toolset:1.25.8 AS builder
FROM registry.access.redhat.com/ubi9/go-toolset:1.26.3 AS builder
COPY --chown=1001:0 . .

ENV GOFLAGS=-buildvcs=false
Expand Down
31 changes: 25 additions & 6 deletions cmd/create/iamserviceaccount/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ func NewCreateIamServiceAccountCommand() *cobra.Command {

var Cmd = NewCreateIamServiceAccountCommand()

func CreateIamServiceAccountRunner(userOptions *iamServiceAccountOpts.CreateIamServiceAccountUserOptions) rosa.CommandRunner {
func CreateIamServiceAccountRunner(
userOptions *iamServiceAccountOpts.CreateIamServiceAccountUserOptions,
) rosa.CommandRunner {
return func(ctx context.Context, r *rosa.Runtime, cmd *cobra.Command, argv []string) error {
cluster := r.FetchCluster()

Expand Down Expand Up @@ -75,7 +77,11 @@ func CreateIamServiceAccountRunner(userOptions *iamServiceAccountOpts.CreateIamS
if len(userOptions.ServiceAccountNames) > 1 {
return fmt.Errorf("role name is required when specifying multiple service accounts")
}
roleName = iamserviceaccount.GenerateRoleName(cluster.Name(), userOptions.Namespace, userOptions.ServiceAccountNames[0])
roleName = iamserviceaccount.GenerateRoleName(
cluster.Name(),
userOptions.Namespace,
userOptions.ServiceAccountNames[0],
)
}

serviceAccounts := make([]iamserviceaccount.ServiceAccountIdentifier, len(userOptions.ServiceAccountNames))
Expand All @@ -92,10 +98,23 @@ func CreateIamServiceAccountRunner(userOptions *iamServiceAccountOpts.CreateIamS
}

trustPolicy := iamserviceaccount.GenerateTrustPolicyMultiple(oidcProviderARN, serviceAccounts)
tags := iamserviceaccount.GenerateDefaultTags(cluster.Name(), userOptions.Namespace, userOptions.ServiceAccountNames[0])
tags := iamserviceaccount.GenerateDefaultTags(
cluster.Name(),
userOptions.Namespace,
userOptions.ServiceAccountNames[0],
)

managedPolicies := false
roleARN, err := r.AWSClient.EnsureRole(r.Reporter, roleName, trustPolicy, userOptions.PermissionsBoundary, "", tags, userOptions.Path, managedPolicies)
roleARN, err := r.AWSClient.EnsureRole(
r.Reporter,
roleName,
trustPolicy,
userOptions.PermissionsBoundary,
"",
tags,
userOptions.Path,
managedPolicies,
)
if err != nil {
return fmt.Errorf("failed to create role: %s", err)
}
Expand All @@ -120,8 +139,8 @@ func CreateIamServiceAccountRunner(userOptions *iamServiceAccountOpts.CreateIamS
inlinePolicy := userOptions.InlinePolicy

// Process inline policy if it's a file reference
if strings.HasPrefix(inlinePolicy, "file://") {
policyPath := strings.TrimPrefix(inlinePolicy, "file://")
if after, ok := strings.CutPrefix(inlinePolicy, "file://"); ok {
policyPath := after
policyBytes, err := os.ReadFile(policyPath)
if err != nil {
return fmt.Errorf("failed to read policy file '%s': %s", policyPath, err)
Expand Down
10 changes: 5 additions & 5 deletions cmd/create/idp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,20 @@ func getIDPName(cmd *cobra.Command, idpName string, r *rosa.Runtime) string {
return strings.Trim(idpName, " \t")
}

func ValidateIdpName(idpName interface{}) error {
func ValidateIdpName(idpName any) error {

name, ok := idpName.(string)

if !ok {
return fmt.Errorf("Invalid type for identity provider name. Expected a string, got %T", idpName)
return fmt.Errorf("invalid type for identity provider name: expected a string, got %T", idpName)
}

if !idRE.MatchString(name) {
return fmt.Errorf("Invalid identifier '%s' for 'name'", idpName)
return fmt.Errorf("invalid identifier '%s' for 'name'", idpName)
}

if strings.EqualFold(name, "cluster-admin") {
return fmt.Errorf("The name \"cluster-admin\" is reserved for admin user IDP")
return fmt.Errorf("the name \"cluster-admin\" is reserved for admin user IDP")
}
Comment on lines +447 to 461

@coderabbitai coderabbitai Bot Jul 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if e2e tests were updated to match new error wording.
rg -n "reserved for admin user IDP|Expected a valid mapping method" tests/e2e/

Repository: openshift/rosa

Length of output: 450


Keep the IDP error strings aligned with the existing e2e assertions.
ValidateIdpName now returns the name "cluster-admin" is reserved for admin user IDP, and getMappingMethod now says expected a valid mapping method; options are %s. Existing e2e tests still look for The name "cluster-admin" is reserved for admin user IDP and Expected a valid mapping method. Options are [add claim generate lookup], so this wording change will break those checks unless the tests are updated too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/create/idp/cmd.go` around lines 447 - 461, The IDP validation messages in
ValidateIdpName and getMappingMethod no longer match the existing e2e
assertions, so align the returned error strings with the expected wording.
Update the cluster-admin reserve message in ValidateIdpName and the mapping
method validation message in getMappingMethod to use the same capitalization and
punctuation as the tests, or adjust the corresponding e2e assertions to match
the new strings.

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.

@olucasfreitas seems valid wdyt

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "reserved for admin user IDP|Expected a valid mapping method|expected a valid mapping method" -C2 --iglob '*.go' .

Length of output: 3759


Confirmed: tests/e2e/test_rosacli_idp.go (Lines 514 and 815) still asserts the old wording (Expected a valid mapping method. Options are [...] and The name "cluster-admin" is reserved for admin user IDP), which will break once cmd/create/idp/cmd.go emits the new lower-case strings. This needs to be fixed in one of these files before merging.

@amandahla Confirmed — the e2e tests still expect the old wording:

  • tests/e2e/test_rosacli_idp.go Line 514: "Failed to create IDP for cluster '%s': Expected a valid mapping method. Options are [add claim generate lookup]"
  • tests/e2e/test_rosacli_idp.go Line 815: Expect(textData).Should(ContainSubstring("The name \"cluster-admin\" is reserved for admin user IDP"))

Since cmd/create/idp/cmd.go now returns:

  • "expected a valid mapping method; options are %s" (Line 553)
  • "the name \"cluster-admin\" is reserved for admin user IDP" (Line 460)

these e2e assertions will fail unless updated. You'll need to update the two tests/e2e/test_rosacli_idp.go assertions to match the new lower-case wording (or revert the wording change in cmd.go if you prefer to keep the old strings for consistency with e2e expectations).


🧬 Code Graph Analysis Results

Possibly relevant snippet(s)

pkg/output/reporter.go (lines 39-45)

func (r *StructuredReporter) Errorf(format string, args ...any) error {
	err := fmt.Errorf(format, args...)
	if !PrintError(err) {
		return r.inner.Errorf(format, args...)
	}
	return err
}

pkg/output/reporter.go (lines 47-51)

func (r *StructuredReporter) Warnf(format string, args ...any) {
	if !PrintWarn(fmt.Errorf(format, args...)) {
		r.inner.Warnf(format, args...)
	}
}

pkg/output/reporter.go (lines 53-55)

func (r *StructuredReporter) Debugf(format string, args ...any) {
	r.inner.Debugf(format, args...)
}

pkg/output/reporter.go (lines 57-59)

func (r *StructuredReporter) Infof(format string, args ...any) {
	r.inner.Infof(format, args...)
}

pkg/reporter/reporter.go (lines 51-56)

func (r *Object) Debugf(format string, args ...any) {
	if !debug.Enabled() {
		return
	}
	r.Infof(format, args...)
}

pkg/reporter/reporter.go (lines 59-66)

func (r *Object) Infof(format string, args ...any) {
	message := fmt.Sprintf(format, args...)
	if color.UseColor() {
		_, _ = fmt.Fprintf(os.Stdout, "%s%s\n", infoColorPrefix, message)
	} else {
		_, _ = fmt.Fprintf(os.Stdout, "%s%s\n", infoPrefix, message)
	}
}

pkg/reporter/reporter.go (lines 69-76)

func (r *Object) Warnf(format string, args ...any) {
	message := fmt.Sprintf(format, args...)
	if color.UseColor() {
		_, _ = fmt.Fprintf(os.Stderr, "%s%s\n", warnColorPrefix, message)
	} else {
		_, _ = fmt.Fprintf(os.Stderr, "%s%s\n", warnPrefix, message)
	}
}

pkg/reporter/reporter.go (lines 83-91)

func (r *Object) Errorf(format string, args ...any) error {
	message := fmt.Sprintf(format, args...)
	if color.UseColor() {
		_, _ = fmt.Fprintf(os.Stderr, "%s%s\n", errorColorPrefix, message)
	} else {
		_, _ = fmt.Fprintf(os.Stderr, "%s%s\n", errorPrefix, message)
	}
	return errors.New(message)
}

return nil
}
Expand Down Expand Up @@ -550,7 +550,7 @@ func getMappingMethod(cmd *cobra.Command, mappingMethod string) (string, error)
}
}
if !isValidMappingMethod {
err = fmt.Errorf("Expected a valid mapping method. Options are %s", validMappingMethods)
err = fmt.Errorf("expected a valid mapping method; options are %s", validMappingMethods)
}
return mappingMethod, err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/create/idp/htpasswd.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func exitHTPasswdCreate(format, clusterKey string, err error, r *rosa.Runtime) {
os.Exit(1)
}

func UsernameValidator(val interface{}) error {
func UsernameValidator(val any) error {
if username, ok := val.(string); ok {
if strings.ContainsAny(username, "/:%") {
return fmt.Errorf("invalid username '%s': "+
Expand All @@ -267,7 +267,7 @@ func UsernameValidator(val interface{}) error {
return fmt.Errorf("can only validate strings, got '%v'", val)
}

func clusterAdminValidator(val interface{}) error {
func clusterAdminValidator(val any) error {
if username, ok := val.(string); ok {
if username == ClusterAdminUsername {
return fmt.Errorf("username '%s' is not allowed. It is preserved for cluster admin creation. "+
Expand Down Expand Up @@ -302,7 +302,7 @@ func parseHtpasswordFile(usersList *map[string]string, filePath string) error {
// split "user:password" at colon
username, password, found := strings.Cut(line, ":")
if !found || username == "" || password == "" {
return fmt.Errorf("Malformed line, Expected: validUsername:validPassword, Got: %s", line)
return fmt.Errorf("malformed line, expected validUsername:validPassword, got: %s", line)
}

(*usersList)[username] = password
Expand Down
20 changes: 8 additions & 12 deletions cmd/edit/ingress/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package ingress

import (
"fmt"
"slices"
"strings"

cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
"github.com/spf13/pflag"

"github.com/openshift/rosa/pkg/helper"
. "github.com/openshift/rosa/pkg/ingress"
pkgingress "github.com/openshift/rosa/pkg/ingress"
)

type stringTransformation func(source string) string
Expand Down Expand Up @@ -47,13 +48,7 @@ var expectedParameters = []string{
}

func IsIngressV2SetViaCLI(flags *pflag.FlagSet) bool {
for _, parameter := range exclusivelyIngressV2Flags {
if flags.Changed(parameter) {
return true
}
}

return false
return slices.ContainsFunc(exclusivelyIngressV2Flags, flags.Changed)
}

func addIngressV2Flags(flags *pflag.FlagSet) {
Expand All @@ -70,15 +65,15 @@ func addIngressV2Flags(flags *pflag.FlagSet) {
wildcardPolicyFlag,
"",
fmt.Sprintf("Wildcard Policy for ingress. Options are %s. Default is '%s'.",
strings.Join(ValidWildcardPolicies, ","), DefaultWildcardPolicy),
strings.Join(pkgingress.ValidWildcardPolicies, ","), pkgingress.DefaultWildcardPolicy),
)

flags.StringVar(
&args.namespaceOwnershipPolicy,
namespaceOwnershipPolicyFlag,
"",
fmt.Sprintf("Namespace Ownership Policy for ingress. Options are %s. Default is '%s'.",
strings.Join(ValidNamespaceOwnershipPolicies, ","), DefaultNamespaceOwnershipPolicy),
strings.Join(pkgingress.ValidNamespaceOwnershipPolicies, ","), pkgingress.DefaultNamespaceOwnershipPolicy),
)

flags.StringVar(
Expand Down Expand Up @@ -158,9 +153,10 @@ func parseComponentRoutes(input string) (map[string]*cmv1.ComponentRouteBuilder,
parameterValue = t(parameterValue)
}
// TODO: use reflection, couldn't get it to work
if parameterName == hostnameParameter {
switch parameterName {
case hostnameParameter:
componentRouteBuilder.Hostname(parameterValue)
} else if parameterName == tlsSecretRefParameter {
case tlsSecretRefParameter:
componentRouteBuilder.TlsSecretRef(parameterValue)
}
}
Expand Down
8 changes: 5 additions & 3 deletions cmd/list/accessrequests/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"
"text/tabwriter"
"time"

Expand Down Expand Up @@ -85,7 +86,8 @@ func ListAccessRequestsRunner() rosa.CommandRunner {
}

func getAccessRequestsOutput(clusterId string, accessRequests []*v1.AccessRequest) (string, bool, string) {
output := "STATE\tID\tCLUSTER ID\tUPDATED AT\n"
var output strings.Builder
output.WriteString("STATE\tID\tCLUSTER ID\tUPDATED AT\n")
hasPending := false
id := "<ID>"
for _, accessRequest := range accessRequests {
Expand All @@ -95,12 +97,12 @@ func getAccessRequestsOutput(clusterId string, accessRequests []*v1.AccessReques
id = accessRequest.ID()
}
}
output += fmt.Sprintf("%s\t%s\t%s\t%s\n",
fmt.Fprintf(&output, "%s\t%s\t%s\t%s\n",
accessRequest.Status().State(),
accessRequest.ID(),
accessRequest.ClusterId(),
accessRequest.UpdatedAt().Format(time.UnixDate))
}

return output, hasPending, id
return output.String(), hasPending, id
}
11 changes: 6 additions & 5 deletions cmd/list/imagemirrors/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"strings"
"text/tabwriter"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -71,7 +72,7 @@ func ListImageMirrorsRunner(options *ListImageMirrorsOptions) rosa.CommandRunner
}
imageMirrors, err := runtime.OCMClient.ListImageMirrors(cluster.ID())
if err != nil {
return fmt.Errorf("Failed to list image mirrors: %v", err)
return fmt.Errorf("failed to list image mirrors: %v", err)
}

if output.HasFlag() {
Expand All @@ -88,21 +89,21 @@ func ListImageMirrorsRunner(options *ListImageMirrorsOptions) rosa.CommandRunner
fmt.Fprintf(writer, "ID\tTYPE\tSOURCE\tMIRRORS\n")

for _, mirror := range imageMirrors {
mirrors := ""
var mirrors strings.Builder
if len(mirror.Mirrors()) > 0 {
for i, m := range mirror.Mirrors() {
if i > 0 {
mirrors += ", "
mirrors.WriteString(", ")
}
mirrors += m
mirrors.WriteString(m)
}
}

fmt.Fprintf(writer, "%s\t%s\t%s\t%s\n",
mirror.ID(),
mirror.Type(),
mirror.Source(),
mirrors,
mirrors.String(),
)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/list/imagemirrors/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var _ = Describe("List image mirrors", func() {
Expect(err).ToNot(HaveOccurred())
err = runner(context.Background(), t.RosaRuntime, cmd, []string{})
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Failed to list image mirrors"))
Expect(err.Error()).To(ContainSubstring("failed to list image mirrors"))
})
})

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/openshift/rosa

go 1.25.8
go 1.26.3

require (
github.com/AlecAivazis/survey/v2 v2.3.7
Expand Down
6 changes: 3 additions & 3 deletions images/Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The image is for Prow CI steps to manage the ROSA cluster lifecycle and testing
FROM registry.access.redhat.com/ubi9/go-toolset:1.25.8 as builder
FROM registry.access.redhat.com/ubi9/go-toolset:1.26.3 as builder
WORKDIR /rosa
USER root
ENV GOBIN=/go/bin
Expand All @@ -13,13 +13,13 @@ RUN go test -c -o /go/bin/rosatest ./tests/e2e
RUN rosa verify openshift-client
RUN rosatest --ginkgo.no-color --ginkgo.label-filter "e2e-commit"

FROM registry.access.redhat.com/ubi9/go-toolset:1.25.8 AS rosa-support
FROM registry.access.redhat.com/ubi9/go-toolset:1.26.3 AS rosa-support
WORKDIR /opt/app-root/src/rosa-support
RUN go install github.com/openshift-online/rosa-support@latest

FROM registry.ci.openshift.org/ci/cli-ocm:latest as ocmcli

FROM registry.access.redhat.com/ubi9/go-toolset:1.25.8
FROM registry.access.redhat.com/ubi9/go-toolset:1.26.3
USER root
COPY --from=builder /go/bin/rosa* /usr/bin
COPY --from=builder /rosa/tests/ci/data /rosa/tests/ci/data
Expand Down
2 changes: 1 addition & 1 deletion images/Dockerfile.konflux
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/go-toolset:1.25.8 AS builder
FROM registry.access.redhat.com/ubi9/go-toolset:1.26.3 AS builder
WORKDIR /rosa
USER root
COPY . .
Expand Down
Loading