Skip to content
Draft
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
7 changes: 7 additions & 0 deletions cmd/vela-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ func main() {
Aliases: []string{"rt"},
Usage: "refresh access token used for communication with the Vela server",
},
&cli.BoolFlag{
Sources: cli.EnvVars("VELA_PERFORM_REFRESH_TOKEN", "CONFIG_PERFORM_REFRESH_TOKEN", "SERVER_PERFORM_REFRESH_TOKEN"),
Name: internal.FlagAPIPerformTokenRefresh,
Aliases: []string{"prt"},
Usage: "whether the cli should attempt to refresh the credentials",
Value: true,
},
&cli.StringFlag{
Sources: cli.EnvVars("VELA_API_VERSION", "CONFIG_API_VERSION", "API_VERSION"),
Name: internal.FlagAPIVersion,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/go-vela/cli

replace github.com/go-vela/sdk-go => github.com/go-vela/sdk-go v0.28.1-0.20260526194207-83df9236b666

Check failure on line 3 in go.mod

View workflow job for this annotation

GitHub Actions / golangci

[golangci] go.mod#L3

replacement are not allowed: github.com/go-vela/sdk-go (gomoddirectives)
Raw output
go.mod:3:1: replacement are not allowed: github.com/go-vela/sdk-go (gomoddirectives)
replace github.com/go-vela/sdk-go => github.com/go-vela/sdk-go v0.28.1-0.20260526194207-83df9236b666
^
51 issues:
* goconst: 50
* gomoddirectives: 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
replacement are not allowed: github.com/go-vela/sdk-go (gomoddirectives)


go 1.26.1

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy0
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-vela/sdk-go v0.28.0 h1:nao4xxk+JyDy2ftN3J1EhA27KTfXgjS6mA+fm6HP+Nc=
github.com/go-vela/sdk-go v0.28.0/go.mod h1:43aQiVr6BAl7ensvpCytHjFaG0TI3Hq3wD4aUcAeZE4=
github.com/go-vela/sdk-go v0.28.1-0.20260526194207-83df9236b666 h1:t0AF5dykZmy3wuAthuSYMXh2YoI5z9IKnQN+cadtad8=
github.com/go-vela/sdk-go v0.28.1-0.20260526194207-83df9236b666/go.mod h1:43aQiVr6BAl7ensvpCytHjFaG0TI3Hq3wD4aUcAeZE4=
github.com/go-vela/server v0.28.0 h1:vuJNQFTJ0lle/sCH1SZqup1ukfdwbTm/ejw8jhRz8j8=
github.com/go-vela/server v0.28.0/go.mod h1:R0GLaoCrY4OsnynoiN1MIdRo67kqzY5sTavxrn3bcfc=
github.com/go-vela/worker v0.28.0 h1:RQAzJT/YDp/H69PVZmgGu8hfvqCAzWRkfdEo4iaeTgs=
Expand Down
5 changes: 5 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func Parse(c *cli.Command) (*vela.Client, error) {
// capture the refresh token from the context
refreshToken := c.String(internal.FlagAPIRefreshToken)

// capture the perform token refresh from the context
performTokenRefresh := c.Bool(internal.FlagAPIPerformTokenRefresh)

// validate the provided configuration
err := validate(address, token, velaGitToken, accessToken, refreshToken)
if err != nil {
Expand Down Expand Up @@ -66,6 +69,8 @@ func Parse(c *cli.Command) (*vela.Client, error) {
client.Authentication.SetAccessAndRefreshAuth(accessToken, refreshToken)
}

client.Authentication.SetPerformTokenRefresh(performTokenRefresh)

// pass the token to the client instance, overrides previous methods
if len(token) > 0 {
client.Authentication.SetPersonalAccessTokenAuth(token)
Expand Down
2 changes: 2 additions & 0 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
//nolint:gosec // false negative - not a real token
FlagAPIRefreshToken = "api.token.refresh"

FlagAPIPerformTokenRefresh = "api.token.perform-refresh"

// FlagAPIVersion defines the key for the
// flag when setting the API version.
FlagAPIVersion = "api.version"
Expand Down
Loading