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
4 changes: 1 addition & 3 deletions api/types/settings/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"fmt"

"github.com/urfave/cli/v3"

"github.com/go-vela/server/util"
)

// Platform is the API representation of platform settingps.
Expand Down Expand Up @@ -37,7 +35,7 @@ func FromCLICommand(c *cli.Command) *Platform {
ps.SetScheduleAllowlist(c.StringSlice("vela-schedule-allowlist"))

// set max repos per dashboard
ps.SetMaxDashboardRepos(util.Int32FromInt64(c.Int("max-dashboard-repos")))
ps.SetMaxDashboardRepos(c.Int32("max-dashboard-repos"))

return ps
}
Expand Down
22 changes: 11 additions & 11 deletions cmd/vela-server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,43 +133,43 @@ var Flags = []cli.Flag{
Sources: cli.EnvVars("VELA_ENABLE_SECURE_COOKIE"),
Value: true,
},
&cli.IntFlag{
&cli.Int32Flag{
Name: "default-build-limit",
Usage: "override default build limit",
Sources: cli.EnvVars("VELA_DEFAULT_BUILD_LIMIT"),
Value: constants.BuildLimitDefault,
Action: func(_ context.Context, _ *cli.Command, v int64) error {
Action: func(_ context.Context, _ *cli.Command, v int32) error {
if v <= 0 {
return fmt.Errorf("default-build-limit (VELA_DEFAULT_BUILD_LIMIT) flag must be greater than 0")
}

return nil
},
},
&cli.IntFlag{
&cli.Int32Flag{
Name: "max-build-limit",
Usage: "override max build limit",
Sources: cli.EnvVars("VELA_MAX_BUILD_LIMIT"),
Value: constants.BuildLimitMax,
Action: func(_ context.Context, cmd *cli.Command, v int64) error {
Action: func(_ context.Context, cmd *cli.Command, v int32) error {
if v <= 0 {
return fmt.Errorf("max-build-limit (VELA_MAX_BUILD_LIMIT) flag must be greater than 0")
}

if cmd.Int("default-build-limit") > v {
if cmd.Int32("default-build-limit") > v {
return fmt.Errorf("max-build-limit (VELA_MAX_BUILD_LIMIT) must be greater than default-build-limit (VELA_DEFAULT_BUILD_LIMIT)")
}

return nil
},
},
&cli.IntFlag{
&cli.Int32Flag{
Name: "default-build-timeout",
Usage: "override default build timeout (minutes)",
Sources: cli.EnvVars("VELA_DEFAULT_BUILD_TIMEOUT"),
Value: constants.BuildTimeoutDefault,
},
&cli.IntFlag{
&cli.Int32Flag{
Name: "default-approval-timeout",
Usage: "override default approval timeout (days)",
Sources: cli.EnvVars("VELA_DEFAULT_APPROVAL_TIMEOUT"),
Expand All @@ -196,7 +196,7 @@ var Flags = []cli.Flag{
return nil
},
},
&cli.IntFlag{
&cli.Int64Flag{
Name: "default-repo-events-mask",
Usage: "set default event mask for newly activated repositories",
Sources: cli.EnvVars("VELA_DEFAULT_REPO_EVENTS_MASK"),
Expand All @@ -217,7 +217,7 @@ var Flags = []cli.Flag{
return nil
},
},
&cli.IntFlag{
&cli.Int32Flag{
Name: "max-dashboard-repos",
Usage: "set the maximum amount of repos that can belong to a dashboard",
Sources: cli.EnvVars("VELA_MAX_DASHBOARD_REPOS"),
Expand Down Expand Up @@ -316,7 +316,7 @@ var Flags = []cli.Flag{
Usage: "github token, used by compiler, for pulling registry templates",
Sources: cli.EnvVars("VELA_COMPILER_GITHUB_TOKEN", "COMPILER_GITHUB_TOKEN"),
},
&cli.IntFlag{
&cli.Int64Flag{
Name: "compiler-starlark-exec-limit",
Usage: "set the starlark execution step limit for compiling starlark pipelines",
Sources: cli.EnvVars("VELA_COMPILER_STARLARK_EXEC_LIMIT", "COMPILER_STARLARK_EXEC_LIMIT"),
Expand Down Expand Up @@ -349,7 +349,7 @@ var Flags = []cli.Flag{
Usage: "max template depth, used by compiler, maximum number of templates that can be called in a template chain",
Sources: cli.EnvVars("VELA_MAX_TEMPLATE_DEPTH", "MAX_TEMPLATE_DEPTH"),
Value: 3,
Action: func(_ context.Context, _ *cli.Command, v int64) error {
Action: func(_ context.Context, _ *cli.Command, v int) error {
if v < 1 {
return fmt.Errorf("max-template-depth (VELA_MAX_TEMPLATE_DEPTH) or (MAX_TEMPLATE_DEPTH) flag must be greater than 0")
}
Expand Down
6 changes: 6 additions & 0 deletions cmd/vela-server/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ func TestDatabase_Flags(t *testing.T) {
case *cli.StringFlag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.Int64Flag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.Int32Flag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.IntFlag:
copyFlag := *f
copiedFlags[i] = &copyFlag
Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-server/scm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func setupSCM(ctx context.Context, c *cli.Command, tc *tracing.Client) (scm.Serv
Address: c.String("scm.addr"),
ClientID: c.String("scm.client"),
ClientSecret: c.String("scm.secret"),
AppID: c.Int("scm.app.id"),
AppID: c.Int64("scm.app.id"),
AppPrivateKey: c.String("scm.app.private-key"),
AppPrivateKeyPath: c.String("scm.app.private-key.path"),
AppPermissions: c.StringSlice("scm.app.permissions"),
Expand Down
11 changes: 5 additions & 6 deletions cmd/vela-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/go-vela/server/router"
"github.com/go-vela/server/router/middleware"
"github.com/go-vela/server/tracing"
"github.com/go-vela/server/util"
)

//nolint:funlen,gocyclo // ignore function length and cyclomatic complexity
Expand Down Expand Up @@ -194,15 +193,15 @@ func server(ctx context.Context, cmd *cli.Command) error {
middleware.QueueSigningPrivateKey(cmd.String("queue.private-key")),
middleware.QueueSigningPublicKey(cmd.String("queue.public-key")),
middleware.QueueAddress(cmd.String("queue.addr")),
middleware.DefaultBuildLimit(util.Int32FromInt64(cmd.Int("default-build-limit"))),
middleware.DefaultTimeout(util.Int32FromInt64(cmd.Int("default-build-timeout"))),
middleware.DefaultApprovalTimeout(util.Int32FromInt64(cmd.Int("default-approval-timeout"))),
middleware.MaxBuildLimit(util.Int32FromInt64(cmd.Int("max-build-limit"))),
middleware.DefaultBuildLimit(cmd.Int32("default-build-limit")),
middleware.DefaultTimeout(cmd.Int32("default-build-timeout")),
middleware.DefaultApprovalTimeout(cmd.Int32("default-approval-timeout")),
middleware.MaxBuildLimit(cmd.Int32("max-build-limit")),
middleware.WebhookValidation(!cmd.Bool("vela-disable-webhook-validation")),
middleware.SecureCookie(cmd.Bool("vela-enable-secure-cookie")),
middleware.Worker(cmd.Duration("worker-active-interval")),
middleware.DefaultRepoEvents(cmd.StringSlice("default-repo-events")),
middleware.DefaultRepoEventsMask(cmd.Int("default-repo-events-mask")),
middleware.DefaultRepoEventsMask(cmd.Int64("default-repo-events-mask")),
middleware.DefaultRepoApproveBuild(cmd.String("default-repo-approve-build")),
middleware.ScheduleFrequency(cmd.Duration("schedule-minimum-frequency")),
middleware.TracingClient(tc),
Expand Down
6 changes: 3 additions & 3 deletions compiler/native/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func FromCLICommand(ctx context.Context, cmd *cli.Command) (*Client, error) {
Timeout: cmd.Duration("modification-timeout"),
Endpoint: cmd.String("modification-addr"),
Secret: cmd.String("modification-secret"),
Retries: int(cmd.Int("modification-retries")),
Retries: cmd.Int("modification-retries"),
}
}

Expand All @@ -90,10 +90,10 @@ func FromCLICommand(ctx context.Context, cmd *cli.Command) (*Client, error) {
c.SetCloneImage(cloneImage)

// set the template depth to use for nested templates
c.SetTemplateDepth(int(cmd.Int("max-template-depth")))
c.SetTemplateDepth(cmd.Int("max-template-depth"))

// set the starlark execution step limit for compiling starlark pipelines
c.SetStarlarkExecLimit(cmd.Int("compiler-starlark-exec-limit"))
c.SetStarlarkExecLimit(cmd.Int64("compiler-starlark-exec-limit"))

if cmd.Bool("github-driver") {
logrus.Tracef("setting up Private GitHub Client for %s", cmd.String("github-url"))
Expand Down
6 changes: 3 additions & 3 deletions database/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func FromCLICommand(c *cli.Command, tc *tracing.Client) (Interface, error) {

return New(
WithAddress(c.String("database.addr")),
WithCompressionLevel(int(c.Int("database.compression.level"))),
WithCompressionLevel(c.Int("database.compression.level")),
WithConnectionLife(c.Duration("database.connection.life")),
WithConnectionIdle(int(c.Int("database.connection.idle"))),
WithConnectionOpen(int(c.Int("database.connection.open"))),
WithConnectionIdle(c.Int("database.connection.idle")),
WithConnectionOpen(c.Int("database.connection.open")),
WithDriver(c.String("database.driver")),
WithEncryptionKey(c.String("database.encryption.key")),
WithLogLevel(c.String("database.log.level")),
Expand Down
2 changes: 1 addition & 1 deletion database/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var Flags = []cli.Flag{
),
Value: 30 * time.Minute,
},
&cli.IntFlag{
&cli.Int64Flag{
Name: "database.compression.level",
Usage: "level of compression for logs stored in the database",
Sources: cli.NewValueSourceChain(
Expand Down
6 changes: 6 additions & 0 deletions database/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ func TestDatabase_Flags(t *testing.T) {
case *cli.StringFlag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.Int64Flag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.Int32Flag:
copyFlag := *f
copiedFlags[i] = &copyFlag
case *cli.IntFlag:
copyFlag := *f
copiedFlags[i] = &copyFlag
Expand Down
87 changes: 43 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/Masterminds/semver/v3 v3.3.1
github.com/Masterminds/sprig/v3 v3.3.0
github.com/adhocore/gronx v1.19.5
github.com/adhocore/gronx v1.19.6
github.com/alicebob/miniredis/v2 v2.34.0
github.com/aws/aws-sdk-go v1.55.6
github.com/aws/aws-sdk-go v1.55.7
github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3
github.com/distribution/reference v0.6.0
github.com/drone/envsubst v1.0.3
Expand All @@ -28,16 +28,16 @@ require (
github.com/hashicorp/vault/api v1.16.0
github.com/invopop/jsonschema v0.13.0
github.com/joho/godotenv v1.5.1
github.com/lestrrat-go/jwx/v3 v3.0.0
github.com/lestrrat-go/jwx/v3 v3.0.1
github.com/lib/pq v1.10.9
github.com/microcosm-cc/bluemonday v1.0.27
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.22.0
github.com/redis/go-redis/v9 v9.7.3
github.com/redis/go-redis/v9 v9.8.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.14.0
github.com/uptrace/opentelemetry-go-extra/otelgorm v0.3.2
github.com/urfave/cli/v3 v3.1.1
github.com/urfave/cli/v3 v3.3.2
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.60.0
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0
Expand All @@ -46,76 +46,74 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0
go.opentelemetry.io/otel/sdk v1.35.0
go.opentelemetry.io/otel/trace v1.35.0
go.starlark.net v0.0.0-20250318223901-d9371fef63fe
go.starlark.net v0.0.0-20250417143717-f57e51f710eb
golang.org/x/crypto v0.37.0
golang.org/x/oauth2 v0.29.0
golang.org/x/sync v0.13.0
golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.14.0
golang.org/x/time v0.11.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/postgres v1.5.11
gorm.io/driver/sqlite v1.5.7
gorm.io/gorm v1.25.12
k8s.io/apimachinery v0.32.3
gorm.io/gorm v1.26.0
k8s.io/apimachinery v0.33.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.12.10 // indirect
github.com/bytedance/sonic/loader v0.2.3 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/gin-contrib/sse v1.0.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.25.0 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.5.5 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.4 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/blackmagic v1.0.3 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc/v3 v3.0.0-beta1 // indirect
github.com/lestrrat-go/httprc/v3 v3.0.0-beta2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mattn/go-sqlite3 v1.14.28 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -124,14 +122,14 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/cast v1.8.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2 // indirect
Expand All @@ -140,16 +138,17 @@ require (
github.com/yuin/gopher-lua v1.1.1 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
golang.org/x/arch v0.14.0 // indirect
golang.org/x/net v0.36.0 // indirect
golang.org/x/sys v0.32.0 // indirect
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
golang.org/x/arch v0.17.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.24.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/grpc v1.71.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/grpc v1.72.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
)
Loading
Loading