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

Allow setting OBS_USERNAME for a specific user #3273

Merged
merged 1 commit into from
Sep 14, 2023
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
4 changes: 4 additions & 0 deletions pkg/obs/obs.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ const (
// OBSPasswordKey is name of the environment variable with password for
// Kubernetes Release Bot account.
OBSPasswordKey = "OBS_PASSWORD"

// OBSUsernameKey is name of the environment variable containing the
// username for the OBS account. If empty, obsK8sUsername will be used.
OBSUsernameKey = "OBS_USERNAME"
)

// Options are settings which will be used by `StageOptions` as well as
Expand Down
7 changes: 6 additions & 1 deletion pkg/obs/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ func (d *DefaultRelease) InitOBSRoot() error {
return fmt.Errorf("%s environment variable not set", OBSPasswordKey)
}

if err := d.impl.CreateOBSConfigFile(obsK8sUsername, password); err != nil {
username := os.Getenv(OBSUsernameKey)
if username == "" {
username = obsK8sUsername
}

if err := d.impl.CreateOBSConfigFile(username, password); err != nil {
return fmt.Errorf("creating obs config file: %w", err)
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/obs/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ func (d *DefaultStage) InitOBSRoot() error {
return fmt.Errorf("%s environment variable not set", OBSPasswordKey)
}

if err := d.impl.CreateOBSConfigFile(obsK8sUsername, password); err != nil {
username := os.Getenv(OBSUsernameKey)
if username == "" {
username = obsK8sUsername
}

if err := d.impl.CreateOBSConfigFile(username, password); err != nil {
return fmt.Errorf("creating obs config file: %w", err)
}

Expand Down