diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b2a0368872..63666ea5bf 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -102,12 +102,12 @@ jobs: with: version: latest args: test:integration - workdir: hack/build + workdir: build - name: Upload Flipt Service Logs uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: Flipt Service Logs - path: hack/build/logs + path: build/logs retention-days: 5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a4f1063cd..04953ec052 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -92,7 +92,7 @@ jobs: env: TAG: ${{ github.ref_name }} run: | - cd hack/build + cd build if [[ $TAG == $(mage release:latest go.flipt.io/flipt) ]]; then docker pull flipt/flipt:$TAG diff --git a/hack/build/README.md b/build/README.md similarity index 100% rename from hack/build/README.md rename to build/README.md diff --git a/hack/build/go.mod b/build/go.mod similarity index 92% rename from hack/build/go.mod rename to build/go.mod index 808f58b4b5..73f80496df 100644 --- a/hack/build/go.mod +++ b/build/go.mod @@ -3,7 +3,7 @@ module go.flipt.io/flipt/build go 1.20 require ( - dagger.io/dagger v0.5.2 + dagger.io/dagger v0.6.0 github.com/containerd/containerd v1.6.18 github.com/docker/docker v23.0.3+incompatible github.com/go-git/go-git/v5 v5.6.1 @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.2 go.flipt.io/flipt v1.19.1 go.flipt.io/flipt/sdk/go v0.0.0-00010101000000-000000000000 - golang.org/x/mod v0.9.0 + golang.org/x/mod v0.10.0 golang.org/x/sync v0.1.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 @@ -65,11 +65,11 @@ require ( github.com/vektah/gqlparser/v2 v2.5.1 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/crypto v0.7.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect golang.org/x/time v0.1.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/tools v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -78,4 +78,4 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace go.flipt.io/flipt/sdk/go => ../../sdk/go +replace go.flipt.io/flipt/sdk/go => ../sdk/go diff --git a/hack/build/go.sum b/build/go.sum similarity index 97% rename from hack/build/go.sum rename to build/go.sum index f094cbb327..b1bac8a742 100644 --- a/hack/build/go.sum +++ b/build/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -dagger.io/dagger v0.5.2 h1:xNMUnLWqcsb5UrvqOgJx4MJVfe7xDb50kBMXdC63Cjs= -dagger.io/dagger v0.5.2/go.mod h1:1nbGnLdIfoBV2ahbQjheI//SNGz+b5q1jqf0A+pJ+Oc= +dagger.io/dagger v0.6.0 h1:3cN0QxS/re2RKyHW3BGyk/Hz7Ux46EfvB4zbZLA/X6o= +dagger.io/dagger v0.6.0/go.mod h1:/sSGPh+1LInVuHzTkkr1pZ5N0BAEDoqJ94eM2Xoh/iE= github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -234,8 +234,8 @@ golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -255,8 +255,8 @@ golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -299,22 +299,22 @@ golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -331,8 +331,8 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/hack/build/internal/flipt.go b/build/internal/flipt.go similarity index 98% rename from hack/build/internal/flipt.go rename to build/internal/flipt.go index f885586617..5ee8d84092 100644 --- a/hack/build/internal/flipt.go +++ b/build/internal/flipt.go @@ -158,7 +158,9 @@ func Base(ctx context.Context, client *dagger.Client, req FliptRequest) (*dagger // fetch and add ui/embed.go on its own embed := client.Host().Directory(".", dagger.HostDirectoryOpts{ Include: []string{ + "./ui/dev.go", "./ui/embed.go", + "./ui/index.dev.html", }, }) @@ -173,7 +175,7 @@ func Base(ctx context.Context, client *dagger.Client, req FliptRequest) (*dagger // build the Flipt target binary return golang. - WithMountedFile("./ui/embed.go", embed.File("./ui/embed.go")). + WithMountedDirectory("./ui", embed.Directory("./ui")). WithMountedDirectory("./ui/dist", req.ui). WithExec([]string{"mkdir", "-p", req.binary()}). WithExec([]string{"sh", "-c", goBuildCmd}), nil diff --git a/hack/build/internal/publish/publish.go b/build/internal/publish/publish.go similarity index 100% rename from hack/build/internal/publish/publish.go rename to build/internal/publish/publish.go diff --git a/hack/build/internal/ui.go b/build/internal/ui.go similarity index 100% rename from hack/build/internal/ui.go rename to build/internal/ui.go diff --git a/hack/build/magefile.go b/build/magefile.go similarity index 99% rename from hack/build/magefile.go rename to build/magefile.go index a157a69991..db5f7e35e1 100644 --- a/hack/build/magefile.go +++ b/build/magefile.go @@ -261,7 +261,7 @@ func workDir() string { } if modfile.ModulePath(mod) == "go.flipt.io/flipt/build" { - return "../.." + return ".." } return "." diff --git a/hack/build/release/changelog.go b/build/release/changelog.go similarity index 100% rename from hack/build/release/changelog.go rename to build/release/changelog.go diff --git a/hack/build/release/release.go b/build/release/release.go similarity index 98% rename from hack/build/release/release.go rename to build/release/release.go index ea98e38562..74635d95d3 100644 --- a/hack/build/release/release.go +++ b/build/release/release.go @@ -250,11 +250,11 @@ func chdirRoot() func() { } if modfile.ModulePath(mod) == path.Join(rootModule, "build") { - if err := os.Chdir("../.."); err != nil { + if err := os.Chdir(".."); err != nil { panic(err) } - return func() { _ = os.Chdir("hack/build") } + return func() { _ = os.Chdir("build") } } return func() {} diff --git a/hack/build/testing/integration.go b/build/testing/integration.go similarity index 96% rename from hack/build/testing/integration.go rename to build/testing/integration.go index b96ce31f60..c408b8d796 100644 --- a/hack/build/testing/integration.go +++ b/build/testing/integration.go @@ -105,7 +105,7 @@ func Integration(ctx context.Context, client *dagger.Client, base, flipt *dagger if _, lerr := client.Container().From("alpine:3.16"). WithMountedCache("/logs", logs). WithExec([]string{"cp", "-r", "/logs", "/out"}). - Directory("/out").Export(ctx, "hack/build/logs"); lerr != nil { + Directory("/out").Export(ctx, "build/logs"); lerr != nil { log.Println("Error copying logs", lerr) } @@ -150,7 +150,7 @@ func importExport(ctx context.Context, base, flipt *dagger.Container, conf testC WithExec(nil) importCmd = append([]string{"/bin/flipt", "import"}, append(flags, "--create-namespace", "import.yaml")...) - seed = base.File("hack/build/testing/integration/readonly/testdata/seed.yaml") + seed = base.File("build/testing/integration/readonly/testdata/seed.yaml") ) // use target flipt binary to invoke import _, err := flipt. @@ -215,7 +215,7 @@ func suite(ctx context.Context, dir string, base, flipt *dagger.Container, conf _, err := base. WithServiceBinding("flipt", flipt). - WithWorkdir(path.Join("hack/build/testing/integration", dir)). + WithWorkdir(path.Join("build/testing/integration", dir)). WithEnvVariable("UNIQUE", uuid.New().String()). WithExec(append([]string{"go", "test", "-v", "-race"}, append(flags, ".")...)). ExitCode(ctx) diff --git a/hack/build/testing/integration/api/api.go b/build/testing/integration/api/api.go similarity index 100% rename from hack/build/testing/integration/api/api.go rename to build/testing/integration/api/api.go diff --git a/hack/build/testing/integration/api/api_test.go b/build/testing/integration/api/api_test.go similarity index 100% rename from hack/build/testing/integration/api/api_test.go rename to build/testing/integration/api/api_test.go diff --git a/hack/build/testing/integration/api/authenticated.go b/build/testing/integration/api/authenticated.go similarity index 100% rename from hack/build/testing/integration/api/authenticated.go rename to build/testing/integration/api/authenticated.go diff --git a/hack/build/testing/integration/integration.go b/build/testing/integration/integration.go similarity index 100% rename from hack/build/testing/integration/integration.go rename to build/testing/integration/integration.go diff --git a/hack/build/testing/integration/readonly/readonly_test.go b/build/testing/integration/readonly/readonly_test.go similarity index 100% rename from hack/build/testing/integration/readonly/readonly_test.go rename to build/testing/integration/readonly/readonly_test.go diff --git a/hack/build/testing/integration/readonly/testdata/seed.yaml b/build/testing/integration/readonly/testdata/seed.yaml similarity index 100% rename from hack/build/testing/integration/readonly/testdata/seed.yaml rename to build/testing/integration/readonly/testdata/seed.yaml diff --git a/hack/build/testing/test.go b/build/testing/test.go similarity index 100% rename from hack/build/testing/test.go rename to build/testing/test.go diff --git a/go.work b/go.work index 3c14a62938..f6809823f5 100644 --- a/go.work +++ b/go.work @@ -4,7 +4,7 @@ use ( . ./_tools ./errors - ./hack/build + ./build ./internal/cmd/protoc-gen-go-flipt-sdk ./rpc/flipt ./sdk/go