Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Phelps <[email protected]>
  • Loading branch information
markphelps committed May 6, 2024
2 parents c210cff + b40bb0a commit 6713787
Show file tree
Hide file tree
Showing 30 changed files with 119 additions and 116 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine3.18 AS build
FROM golang:1.22-alpine3.19 AS build

WORKDIR /home/flipt

Expand All @@ -24,7 +24,7 @@ ENV CGO_ENABLED=1
RUN mage bootstrap && \
mage build

FROM alpine:3.16.2
FROM alpine:3.19

LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.name="flipt"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine3.18
FROM golang:1.22-alpine3.19

WORKDIR /server

Expand Down
4 changes: 2 additions & 2 deletions _tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tools

go 1.21
go 1.22

require (
github.com/bufbuild/buf v1.30.1
Expand All @@ -9,7 +9,7 @@ require (
github.com/rakyll/gotest v0.0.6
golang.org/x/tools v0.20.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf v1.33.0
google.golang.org/protobuf v1.34.0
)

require (
Expand Down
3 changes: 2 additions & 1 deletion _tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion build/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.flipt.io/flipt/build

go 1.21
go 1.22

require (
cloud.google.com/go/storage v1.39.1
Expand Down
4 changes: 2 additions & 2 deletions build/internal/flipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Base(ctx context.Context, client *dagger.Client, req FliptRequest) (*dagger
golang := client.Container(dagger.ContainerOpts{
Platform: dagger.Platform(platforms.Format(req.BuildTarget)),
}).
From("golang:1.21-alpine3.18").
From("golang:1.22-alpine3.19").
WithEnvVariable("GOCACHE", goBuildCachePath).
WithEnvVariable("GOMODCACHE", goModCachePath).
WithExec([]string{"apk", "add", "bash", "gcc", "binutils-gold", "build-base", "git"})
Expand Down Expand Up @@ -179,7 +179,7 @@ func Base(ctx context.Context, client *dagger.Client, req FliptRequest) (*dagger
// into a thinner alpine distribution.
func Package(ctx context.Context, client *dagger.Client, flipt *dagger.Container, req FliptRequest) (*dagger.Container, error) {
// build container with just Flipt + config
return client.Container().From("alpine:3.18").
return client.Container().From("alpine:3.19").
WithExec([]string{"apk", "add", "--no-cache", "postgresql-client", "openssl", "ca-certificates"}).
WithExec([]string{"mkdir", "-p", "/var/opt/flipt"}).
WithExec([]string{"mkdir", "-p", "/var/log/flipt"}).
Expand Down
17 changes: 11 additions & 6 deletions cmd/flipt/bundle.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"
"os"
"text/tabwriter"
Expand Down Expand Up @@ -54,7 +55,8 @@ func newBundleCommand() *cobra.Command {
}

func (c *bundleCommand) build(cmd *cobra.Command, args []string) error {
store, err := c.getStore()
ctx := cmd.Context()
store, err := c.getStore(ctx)
if err != nil {
return err
}
Expand All @@ -75,7 +77,8 @@ func (c *bundleCommand) build(cmd *cobra.Command, args []string) error {
}

func (c *bundleCommand) list(cmd *cobra.Command, args []string) error {
store, err := c.getStore()
ctx := cmd.Context()
store, err := c.getStore(ctx)
if err != nil {
return err
}
Expand All @@ -96,7 +99,8 @@ func (c *bundleCommand) list(cmd *cobra.Command, args []string) error {
}

func (c *bundleCommand) push(cmd *cobra.Command, args []string) error {
store, err := c.getStore()
ctx := cmd.Context()
store, err := c.getStore(ctx)
if err != nil {
return err
}
Expand All @@ -122,7 +126,8 @@ func (c *bundleCommand) push(cmd *cobra.Command, args []string) error {
}

func (c *bundleCommand) pull(cmd *cobra.Command, args []string) error {
store, err := c.getStore()
ctx := cmd.Context()
store, err := c.getStore(ctx)
if err != nil {
return err
}
Expand All @@ -148,8 +153,8 @@ func (c *bundleCommand) pull(cmd *cobra.Command, args []string) error {
return nil
}

func (c *bundleCommand) getStore() (*oci.Store, error) {
logger, cfg, err := buildConfig()
func (c *bundleCommand) getStore(ctx context.Context) (*oci.Store, error) {
logger, cfg, err := buildConfig(ctx)
if err != nil {
return nil, err
}
Expand Down
7 changes: 4 additions & 3 deletions cmd/flipt/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func newExportCommand() *cobra.Command {

func (c *exportCommand) run(cmd *cobra.Command, _ []string) error {
var (
ctx = cmd.Context()
// default to stdout
out io.Writer = os.Stdout
enc = ext.EncodingYML
Expand Down Expand Up @@ -114,11 +115,11 @@ func (c *exportCommand) run(cmd *cobra.Command, _ []string) error {
if err != nil {
return err
}
return c.export(cmd.Context(), enc, out, client)
return c.export(ctx, enc, out, client)
}

// Otherwise, go direct to the DB using Flipt configuration file.
logger, cfg, err := buildConfig()
logger, cfg, err := buildConfig(ctx)
if err != nil {
return err
}
Expand All @@ -134,7 +135,7 @@ func (c *exportCommand) run(cmd *cobra.Command, _ []string) error {

defer cleanup()

return c.export(cmd.Context(), enc, out, server)
return c.export(ctx, enc, out, server)
}

func (c *exportCommand) export(ctx context.Context, enc ext.Encoding, dst io.Writer, lister ext.Lister) error {
Expand Down
7 changes: 4 additions & 3 deletions cmd/flipt/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func newImportCommand() *cobra.Command {

func (c *importCommand) run(cmd *cobra.Command, args []string) error {
var (
ctx = cmd.Context()
in io.Reader = os.Stdin
enc = ext.EncodingYML
)
Expand Down Expand Up @@ -99,10 +100,10 @@ func (c *importCommand) run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
return ext.NewImporter(client).Import(cmd.Context(), enc, in)
return ext.NewImporter(client).Import(ctx, enc, in)
}

logger, cfg, err := buildConfig()
logger, cfg, err := buildConfig(ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -151,5 +152,5 @@ func (c *importCommand) run(cmd *cobra.Command, args []string) error {

return ext.NewImporter(
server,
).Import(cmd.Context(), enc, in)
).Import(ctx, enc, in)
}
9 changes: 5 additions & 4 deletions cmd/flipt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func exec() error {
`),
Version: version,
RunE: func(cmd *cobra.Command, _ []string) error {
logger, cfg, err := buildConfig()
ctx := cmd.Context()
logger, cfg, err := buildConfig(ctx)
if err != nil {
return err
}
Expand All @@ -112,7 +113,7 @@ func exec() error {
_ = logger.Sync()
}()

return run(cmd.Context(), logger, cfg)
return run(ctx, logger, cfg)
},
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
Expand Down Expand Up @@ -197,12 +198,12 @@ func determineConfig(configFile string) (string, bool) {
return "", false
}

func buildConfig() (*zap.Logger, *config.Config, error) {
func buildConfig(ctx context.Context) (*zap.Logger, *config.Config, error) {
path, found := determineConfig(providedConfigFile)

// read in config if it exists
// otherwise, use defaults
res, err := config.Load(path)
res, err := config.Load(ctx, path)
if err != nil {
return nil, nil, fmt.Errorf("loading configuration: %w", err)
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/flipt/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ func newMigrateCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate",
Short: "Run pending database migrations",
RunE: func(_ *cobra.Command, _ []string) error {
logger, cfg, err := buildConfig()
RunE: func(cmd *cobra.Command, _ []string) error {
ctx := cmd.Context()
logger, cfg, err := buildConfig(ctx)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/flipt/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func newValidateCommand() *cobra.Command {
}

func (v *validateCommand) run(cmd *cobra.Command, args []string) error {
logger, _, err := buildConfig()
ctx := cmd.Context()
logger, _, err := buildConfig(ctx)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion core/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.flipt.io/flipt/core

go 1.21
go 1.22

require (
cuelang.org/go v0.8.0
Expand Down
2 changes: 1 addition & 1 deletion errors/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.flipt.io/flipt/errors

go 1.21
go 1.22
18 changes: 7 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module go.flipt.io/flipt

go 1.21.4

toolchain go1.22.1
go 1.22

require (
cloud.google.com/go/storage v1.40.0
Expand All @@ -13,7 +11,7 @@ require (
github.com/MakeNowJust/heredoc v1.0.0
github.com/Masterminds/semver/v3 v3.2.1
github.com/Masterminds/squirrel v1.5.4
github.com/XSAM/otelsql v0.30.0
github.com/XSAM/otelsql v0.31.0
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1
Expand All @@ -31,7 +29,7 @@ require (
github.com/go-sql-driver/mysql v1.8.1
github.com/gobwas/glob v0.2.3
github.com/gofrs/uuid v4.4.0+incompatible
github.com/golang-migrate/migrate/v4 v4.17.0
github.com/golang-migrate/migrate/v4 v4.17.1
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v32 v32.1.0
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -78,7 +76,7 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0
go.opentelemetry.io/otel/exporters/prometheus v0.48.0
go.opentelemetry.io/otel/exporters/zipkin v1.24.0
go.opentelemetry.io/otel/exporters/zipkin v1.26.0
go.opentelemetry.io/otel/metric v1.26.0
go.opentelemetry.io/otel/sdk v1.26.0
go.opentelemetry.io/otel/sdk/metric v1.26.0
Expand All @@ -88,11 +86,11 @@ require (
golang.org/x/crypto v0.22.0
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
golang.org/x/net v0.24.0
golang.org/x/oauth2 v0.18.0
golang.org/x/oauth2 v0.20.0
golang.org/x/sync v0.7.0
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
google.golang.org/protobuf v1.34.0
gopkg.in/segmentio/analytics-go.v3 v3.1.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -101,8 +99,7 @@ require (

require (
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute v1.25.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.7 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
Expand Down Expand Up @@ -269,7 +266,6 @@ require (
golang.org/x/tools v0.20.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.170.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit 6713787

Please sign in to comment.