diff --git a/Dockerfile b/Dockerfile index 390716c7f..9b093607f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,80 +1,38 @@ -# Crafted with ❤ at Breu, Inc. , Copyright © 2022, 2024. -# -# Functional Source License, Version 1.1, Apache 2.0 Future License -# -# We hereby irrevocably grant you an additional license to use the Software under the Apache License, Version 2.0 that -# is effective on the second anniversary of the date we make the Software available. On or after that date, you may use -# the Software under the Apache License, Version 2.0, in which case the following will apply: -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with -# the License. -# -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on -# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. +FROM cgr.dev/chainguard/wolfi-base AS builder -FROM cgr.dev/chainguard/go:latest AS base WORKDIR /src + +# Install build dependencies - go build toolchain, and git2go build dependencies (libgit2) +RUN apk update && \ + apk add --no-cache \ + go \ + build-base \ + cmake \ + pkgconf \ + openssl-dev \ + pcre2-dev \ + zlib-dev \ + libssh2-dev \ + libgit2-dev=1.7.2-r0 + +# Copy source code COPY go.mod go.sum ./ RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ go mod download -FROM base AS src - -WORKDIR /src COPY . . - -# migrate -FROM src AS build-migrate -LABEL io.quantm.artifacts.app="quantm" -LABEL io.quantm.artifacts.component="migrate" - -RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ - --mount=type=cache,target=/root/.cache/go-build,sharing=locked \ - go build -o ./build/migrate ./cmd/jobs/migrate - -FROM cgr.dev/chainguard/git:latest-glibc AS migrate - -COPY --from=build-migrate /src/build/migrate /bin/migrate - -ENTRYPOINT [ ] -CMD ["/bin/migrate"] - - -# mothership -FROM src AS build-mothership -LABEL io.quantm.artifacts.app="quantm" -LABEL io.quantm.artifacts.component="mothership" - -RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ - --mount=type=cache,target=/root/.cache/go-build,sharing=locked \ - go build -o ./build/mothership ./cmd/workers/mothership - -FROM cgr.dev/chainguard/git:latest-glibc AS mothership - -COPY --from=build-mothership /src/build/mothership /bin/ - -ENTRYPOINT [ ] -CMD ["/bin/mothership"] - - -# api -FROM src AS build-api -LABEL io.quantm.artifacts.app="quantm" -LABEL io.quantm.artifacts.component="api" - +# Build the quantm binary with static linking RUN --mount=type=cache,target=/root/go/pkg/mod,sharing=locked \ --mount=type=cache,target=/root/.cache/go-build,sharing=locked \ - go build -o ./build/api ./cmd/api + go build -tags static,system_libgit2 \ + -o /build/quantm \ + ./cmd/quantm -FROM cgr.dev/chainguard/git:latest-glibc AS api +# Runtime Stage (Static base) +FROM cgr.dev/chainguard/static AS quantm -COPY --from=build-api /src/build/api /bin/api +COPY --from=builder /build/quantm /bin/quantm -ENTRYPOINT [ ] -CMD ["/bin/api"] +ENTRYPOINT ["/bin/quantm"] +CMD [] diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index f63722383..73062c573 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -31,7 +31,7 @@ cp .env.example .env Start the necessary services using Docker Compose. This inlcudes - temporal-db: Postgres 16.x for required for temporal -- temporal: 1.25.x, it derives the main logic of the application +- temporal: 1.25.x, it drives the main logic of the application - db: Postgres 16.x for the main database ```bash diff --git a/cmd/quantm/queues.go b/cmd/quantm/queues.go index 050c7f67c..9a1772439 100644 --- a/cmd/quantm/queues.go +++ b/cmd/quantm/queues.go @@ -9,6 +9,7 @@ import ( "go.breu.io/quantm/internal/pulse" ) +// q_core sets up the core queue. func q_core() { q := durable.OnCore() @@ -17,38 +18,48 @@ func q_core() { ) if q != nil { + // Register core activities q.RegisterActivity(pulse.PersistRepoEvent) q.RegisterActivity(pulse.PersistChatEvent) + // Register repo workflows and activities q.RegisterWorkflow(repos.RepoWorkflow) q.RegisterActivity(repos.NewRepoActivities()) + // Register branch workflows and activities q.RegisterWorkflow(repos.BranchWorkflow) q.RegisterActivity(repos.NewBranchActivities()) } } +// q_hooks sets up the hooks queue. func q_hooks() { q := durable.OnHooks() q.CreateWorker() if q != nil { + // Register pulse activities q.RegisterActivity(pulse.PersistRepoEvent) q.RegisterActivity(pulse.PersistChatEvent) + // Register github install workflow and activity q.RegisterWorkflow(github.InstallWorkflow) q.RegisterActivity(&github.InstallActivity{}) + // Register github sync repos workflow and activity q.RegisterWorkflow(github.SyncReposWorkflow) q.RegisterActivity(&github.InstallReposActivity{}) + // Register github push workflow and activity q.RegisterWorkflow(github.PushWorkflow) q.RegisterActivity(&github.PushActivity{}) + // Register github ref workflow and activity q.RegisterWorkflow(github.RefWorkflow) q.RegisterActivity(&github.RefActivity{}) + // Register github pull request workflow and activity q.RegisterWorkflow(github.PullRequestWorkflow) q.RegisterActivity(&github.PullRequestActivity{}) } diff --git a/docker-compose.yaml b/docker-compose.yaml index 497b75f73..e4f45dcc4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,7 +39,7 @@ services: ports: - 7233:7233 volumes: - - ./deploy/temporal/dynamicconfig/:/etc/temporal/config/dynamicconfig/ + - ./tools/temporal/dynamicconfig/:/etc/temporal/config/dynamicconfig/ networks: - ctrlplane @@ -50,7 +50,7 @@ services: environment: TEMPORAL_ADDRESS: temporal:7233 TEMPORAL_CORS_ORIGINS: http://localhost:3000 - image: temporalio/ui:2.31.2 + image: temporalio/ui:2.33.0 ports: - 8080:8080 networks: diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..63fecb32f --- /dev/null +++ b/flake.lock @@ -0,0 +1,154 @@ +{ + "nodes": { + "breu": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1737012171, + "narHash": "sha256-4nco7OvVRJoUnwM0o/atFtyKYKxDwLB3mtFbiLg7YbI=", + "owner": "breuhq", + "repo": "flake-go", + "rev": "6c1e9f5fb5976de8a4199a605d329a25579c144f", + "type": "github" + }, + "original": { + "owner": "breuhq", + "repo": "flake-go", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733668782, + "narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "514283ec89c39ad0079ff2f3b1437404e4cba608", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1735563628, + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735563628, + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "breu": "breu", + "flake-utils": "flake-utils_2", + "gomod2nix": "gomod2nix", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..f1dc8a351 --- /dev/null +++ b/flake.nix @@ -0,0 +1,69 @@ +{ + description = "quantm.io"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + flake-utils.url = "github:numtide/flake-utils"; + gomod2nix.url = "github:nix-community/gomod2nix"; + gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; + gomod2nix.inputs.flake-utils.follows = "flake-utils"; + + breu.url = "github:breuhq/flake-go"; + }; + + outputs = { + nixpkgs, + flake-utils, + breu, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = import nixpkgs {inherit system;}; + buildGoModule = pkgs.buildGo123Module; + + setup = breu.setup.${system}; + + # Base packages required for building and running quantm + base = setup.base [ + pkgs.openssl + pkgs.http-parser + pkgs.zlib + pkgs.python3 # required for http-parser in libgit2 + pkgs.libgit2 + ]; + + # Development packages for use in the dev shell + dev = [ + pkgs.libpg_query # FIXME: probably not required anymore. + (pkgs.callPackage ./tools/nix/pkgs/sqlc.nix {inherit buildGoModule;}) + ]; + + # Set up the development shell with our base and dev packages + shell = setup.shell base dev {}; + + # Build the quantm binary + quantm = pkgs.stdenv.mkDerivation { + name = "quantm"; + src = ./.; + + nativeBuildInputs = base; + + buildPhase = '' + export GOROOT=${pkgs.go_1_23}/share/go + export GOCACHE="$TEMPDIR/go-cache" + export GOMODCACHE="$TEMPDIR/go-mod-cache" + go build -x -tags static,system_libgit2 -o ./tmp/quantm ./cmd/quantm + ''; + + installPhase = '' + mkdir -p $out/bin + cp ./tmp/quantm $out/bin/quantm + ''; + }; + in { + devShells.default = shell; + packages.quantm = quantm; + } + ); +} diff --git a/go.mod b/go.mod index fff271cf7..ca92e3609 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/gobeam/stringy v0.0.7 github.com/gocql/gocql v1.7.0 github.com/google/go-github/v62 v62.0.0 - github.com/gosimple/slug v1.14.0 + github.com/gosimple/slug v1.15.0 github.com/jackc/pgx/v5 v5.7.2 github.com/jeffwelling/git2go/v37 v37.0.4 github.com/knadh/koanf/providers/env v1.0.0 @@ -32,8 +32,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 ) -require github.com/google/go-github/v66 v66.0.0 // indirect - require ( cloud.google.com/go/compute/metadata v0.6.0 dario.cat/mergo v1.0.1 // indirect @@ -61,6 +59,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/google/go-github/v66 v66.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.3 // indirect @@ -115,3 +114,5 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/jeffwelling/git2go/v37 => github.com/breuhq/git2go/v37 v37.0.4 diff --git a/go.sum b/go.sum index 5cc2a5cc0..9b1768d69 100644 --- a/go.sum +++ b/go.sum @@ -34,6 +34,8 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bradleyfalzon/ghinstallation/v2 v2.12.0 h1:k8oVjGhZel2qmCUsYwSE34jPNT9DL2wCBOtugsHv26g= github.com/bradleyfalzon/ghinstallation/v2 v2.12.0/go.mod h1:V4gJcNyAftH0rXpRp1SUVUuh+ACxOH1xOk/ZzkRHltg= +github.com/breuhq/git2go/v37 v37.0.4 h1:oJXydrg9VFxkOc0Rdimytt7VCJj23kaW2xP/4zHE2Tc= +github.com/breuhq/git2go/v37 v37.0.4/go.mod h1:FLLWa/w//wB5xNxmH/XEMmWFyPXFUgI4lEjyzYi+5oM= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -147,8 +149,8 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gosimple/slug v1.14.0 h1:RtTL/71mJNDfpUbCOmnf/XFkzKRtD6wL6Uy+3akm4Es= -github.com/gosimple/slug v1.14.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= +github.com/gosimple/slug v1.15.0 h1:wRZHsRrRcs6b0XnxMUBM6WK1U1Vg5B0R7VkIf1Xzobo= +github.com/gosimple/slug v1.15.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o= github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -172,8 +174,6 @@ github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jeffwelling/git2go/v37 v37.0.4 h1:1zeyPM+MH5ZKHPA7SCaPCNA6rGuxOiskau593Uu36jg= -github.com/jeffwelling/git2go/v37 v37.0.4/go.mod h1:FLLWa/w//wB5xNxmH/XEMmWFyPXFUgI4lEjyzYi+5oM= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/internal/core/repos/activities/branch.go b/internal/core/repos/activities/branch.go index 8594b452c..6a1cd86c3 100644 --- a/internal/core/repos/activities/branch.go +++ b/internal/core/repos/activities/branch.go @@ -5,6 +5,7 @@ import ( "fmt" "log/slog" "os" + "sync" git "github.com/jeffwelling/git2go/v37" @@ -23,7 +24,7 @@ type ( func (a *Branch) Clone(ctx context.Context, payload *defs.ClonePayload) (string, error) { url, err := kernel.Get().RepoHook(payload.Hook).TokenizedCloneUrl(ctx, payload.Repo) if err != nil { - slog.Warn("clone: unable to get tokenized url ...", "error", err) + slog.Warn("clone: unable to get tokenized url", "error", err) return "", err } @@ -35,10 +36,11 @@ func (a *Branch) Clone(ctx context.Context, payload *defs.ClonePayload) (string, CheckoutBranch: payload.Branch, } - cloned, err := git.Clone(url, fmt.Sprintf("/tmp/%s", payload.Path), opts) - if err != nil { - slog.Warn("clone: failed ...", "error", err, "url", url, "path", fmt.Sprintf("/tmp/%s", payload.Path)) + path := fmt.Sprintf("/tmp/%s", payload.Path) + cloned, err := git.Clone(url, path, opts) + if err != nil { + slog.Warn("clone: failed", "error", err, "url", url, "path", path) return "", err } @@ -75,7 +77,7 @@ func (a *Branch) Diff(ctx context.Context, payload *defs.DiffPayload) (*eventsv1 base, err := a.tree_from_branch(ctx, repo, payload.Base) if err != nil { - slog.Warn("diff: unable to process base", "base", base) + slog.Warn("diff: unable to process base", "base", payload.Base, "error", err) return nil, err } @@ -83,7 +85,7 @@ func (a *Branch) Diff(ctx context.Context, payload *defs.DiffPayload) (*eventsv1 head, err := a.tree_from_sha(ctx, repo, payload.SHA) if err != nil { - slog.Warn("diff: unable to process head", "head", payload.SHA) + slog.Warn("diff: unable to process head", "head", payload.SHA, "error", err) return nil, err } @@ -183,8 +185,6 @@ func (a *Branch) Rebase(ctx context.Context, payload *defs.RebasePayload) (*defs return result, nil } - rebase = nil - return result, nil } @@ -212,29 +212,45 @@ func (a *Branch) NotifyMergeConflict(ctx context.Context, event *events.Event[ev // diff_to_result converts a git.Diff to a DiffResult. func (a *Branch) diff_to_result(_ context.Context, diff *git.Diff) (*eventsv1.Diff, error) { result := &eventsv1.Diff{Files: &eventsv1.DiffFiles{}, Lines: &eventsv1.DiffLines{}} - deltas, err := diff.NumDeltas() + if err != nil { slog.Warn("Failed to get number of deltas", "error", err) return nil, err } + // use a sync.Map for concurrent safe updates + var mutex sync.Mutex + + // use a go routine to handle diff deltas in parallel + var wg sync.WaitGroup + + wg.Add(deltas) + for idx := 0; idx < deltas; idx++ { - delta, _ := diff.Delta(idx) - - switch delta.Status { // nolint:exhaustive - default: - case git.DeltaAdded: - result.Files.Added = append(result.Files.Added, delta.NewFile.Path) - case git.DeltaDeleted: - result.Files.Deleted = append(result.Files.Deleted, delta.OldFile.Path) - case git.DeltaModified: - result.Files.Modified = append(result.Files.Modified, delta.NewFile.Path) - case git.DeltaRenamed: - result.Files.Renamed = append(result.Files.Renamed, &eventsv1.RenamedFile{Old: delta.OldFile.Path, New: delta.NewFile.Path}) - } + go func(i int) { + defer wg.Done() + + delta, _ := diff.Delta(i) + + mutex.Lock() + defer mutex.Unlock() + + switch delta.Status { // nolint:exhaustive + case git.DeltaAdded: + result.Files.Added = append(result.Files.Added, delta.NewFile.Path) + case git.DeltaDeleted: + result.Files.Deleted = append(result.Files.Deleted, delta.OldFile.Path) + case git.DeltaModified: + result.Files.Modified = append(result.Files.Modified, delta.NewFile.Path) + case git.DeltaRenamed: + result.Files.Renamed = append(result.Files.Renamed, &eventsv1.RenamedFile{Old: delta.OldFile.Path, New: delta.NewFile.Path}) + } + }(idx) } + wg.Wait() + stats, err := diff.Stats() if err != nil { return nil, err @@ -405,13 +421,12 @@ func (a *Branch) rebase_op( return err } - defer idx.Free() - if conflicts, err := a.get_conflicts(ctx, idx); err != nil { + conflicts, err := a.get_conflicts(ctx, idx) + if err != nil { result.AddOperation(op.Type, defs.RebaseStatusFailure, commit.Id().String(), commit.Message(), err) result.SetStatusFailure(err) - a.rebase_abort(ctx, rebase) return err @@ -517,7 +532,6 @@ func (a *Branch) refresh_remote(_ context.Context, repo *git.Repository, branch if err != nil { return err } - defer ref.Free() _, err = repo.References.Create(fns.BranchNameToRef(branch), ref.Target(), true, "") diff --git a/internal/proto/buf/validate/validate.pb.go b/internal/proto/buf/validate/validate.pb.go index 6186ffb10..13df629e5 100644 --- a/internal/proto/buf/validate/validate.pb.go +++ b/internal/proto/buf/validate/validate.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: buf/validate/validate.proto diff --git a/internal/proto/ctrlplane/auth/v1/accounts.pb.go b/internal/proto/ctrlplane/auth/v1/accounts.pb.go index 1e662754c..314d809c6 100644 --- a/internal/proto/ctrlplane/auth/v1/accounts.pb.go +++ b/internal/proto/ctrlplane/auth/v1/accounts.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/accounts.proto diff --git a/internal/proto/ctrlplane/auth/v1/enums.pb.go b/internal/proto/ctrlplane/auth/v1/enums.pb.go index 7939b180d..bfcf40da7 100644 --- a/internal/proto/ctrlplane/auth/v1/enums.pb.go +++ b/internal/proto/ctrlplane/auth/v1/enums.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/enums.proto diff --git a/internal/proto/ctrlplane/auth/v1/orgs.pb.go b/internal/proto/ctrlplane/auth/v1/orgs.pb.go index 1c025f2fa..12ed7f2ce 100644 --- a/internal/proto/ctrlplane/auth/v1/orgs.pb.go +++ b/internal/proto/ctrlplane/auth/v1/orgs.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/orgs.proto diff --git a/internal/proto/ctrlplane/auth/v1/roles.pb.go b/internal/proto/ctrlplane/auth/v1/roles.pb.go index 3083f8cdc..62b0753b0 100644 --- a/internal/proto/ctrlplane/auth/v1/roles.pb.go +++ b/internal/proto/ctrlplane/auth/v1/roles.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/roles.proto diff --git a/internal/proto/ctrlplane/auth/v1/teams.pb.go b/internal/proto/ctrlplane/auth/v1/teams.pb.go index d52aafbd0..7ebc062dd 100644 --- a/internal/proto/ctrlplane/auth/v1/teams.pb.go +++ b/internal/proto/ctrlplane/auth/v1/teams.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/teams.proto diff --git a/internal/proto/ctrlplane/auth/v1/users.pb.go b/internal/proto/ctrlplane/auth/v1/users.pb.go index 029d6b27e..7203b10b1 100644 --- a/internal/proto/ctrlplane/auth/v1/users.pb.go +++ b/internal/proto/ctrlplane/auth/v1/users.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/auth/v1/users.proto diff --git a/internal/proto/ctrlplane/core/v1/chat.pb.go b/internal/proto/ctrlplane/core/v1/chat.pb.go index b3ee49be1..76f7a9b60 100644 --- a/internal/proto/ctrlplane/core/v1/chat.pb.go +++ b/internal/proto/ctrlplane/core/v1/chat.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/core/v1/chat.proto diff --git a/internal/proto/ctrlplane/core/v1/repos.pb.go b/internal/proto/ctrlplane/core/v1/repos.pb.go index e57fc3724..973aad8c6 100644 --- a/internal/proto/ctrlplane/core/v1/repos.pb.go +++ b/internal/proto/ctrlplane/core/v1/repos.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/core/v1/repos.proto diff --git a/internal/proto/ctrlplane/events/v1/author.pb.go b/internal/proto/ctrlplane/events/v1/author.pb.go index 3777e9095..3c122160f 100644 --- a/internal/proto/ctrlplane/events/v1/author.pb.go +++ b/internal/proto/ctrlplane/events/v1/author.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/author.proto diff --git a/internal/proto/ctrlplane/events/v1/commit.pb.go b/internal/proto/ctrlplane/events/v1/commit.pb.go index 795e3740e..9d1521909 100644 --- a/internal/proto/ctrlplane/events/v1/commit.pb.go +++ b/internal/proto/ctrlplane/events/v1/commit.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/commit.proto diff --git a/internal/proto/ctrlplane/events/v1/diff.pb.go b/internal/proto/ctrlplane/events/v1/diff.pb.go index 4b229de60..85ba8f6e0 100644 --- a/internal/proto/ctrlplane/events/v1/diff.pb.go +++ b/internal/proto/ctrlplane/events/v1/diff.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/diff.proto diff --git a/internal/proto/ctrlplane/events/v1/hooks.pb.go b/internal/proto/ctrlplane/events/v1/hooks.pb.go index f85da1c68..656f1f501 100644 --- a/internal/proto/ctrlplane/events/v1/hooks.pb.go +++ b/internal/proto/ctrlplane/events/v1/hooks.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/hooks.proto diff --git a/internal/proto/ctrlplane/events/v1/merge.pb.go b/internal/proto/ctrlplane/events/v1/merge.pb.go index b4c2823ad..e40919c13 100644 --- a/internal/proto/ctrlplane/events/v1/merge.pb.go +++ b/internal/proto/ctrlplane/events/v1/merge.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/merge.proto diff --git a/internal/proto/ctrlplane/events/v1/pull_request.pb.go b/internal/proto/ctrlplane/events/v1/pull_request.pb.go index b5a47b15c..057e0f036 100644 --- a/internal/proto/ctrlplane/events/v1/pull_request.pb.go +++ b/internal/proto/ctrlplane/events/v1/pull_request.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/pull_request.proto diff --git a/internal/proto/ctrlplane/events/v1/pull_request_review.pb.go b/internal/proto/ctrlplane/events/v1/pull_request_review.pb.go index 0ad0b25fb..dce29f551 100644 --- a/internal/proto/ctrlplane/events/v1/pull_request_review.pb.go +++ b/internal/proto/ctrlplane/events/v1/pull_request_review.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/pull_request_review.proto diff --git a/internal/proto/ctrlplane/events/v1/pull_request_review_comment.pb.go b/internal/proto/ctrlplane/events/v1/pull_request_review_comment.pb.go index a80b9a873..79a918a6b 100644 --- a/internal/proto/ctrlplane/events/v1/pull_request_review_comment.pb.go +++ b/internal/proto/ctrlplane/events/v1/pull_request_review_comment.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/pull_request_review_comment.proto diff --git a/internal/proto/ctrlplane/events/v1/push.pb.go b/internal/proto/ctrlplane/events/v1/push.pb.go index 4ea3cb55e..3f3fc7398 100644 --- a/internal/proto/ctrlplane/events/v1/push.pb.go +++ b/internal/proto/ctrlplane/events/v1/push.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/push.proto diff --git a/internal/proto/ctrlplane/events/v1/rebase.pb.go b/internal/proto/ctrlplane/events/v1/rebase.pb.go index 8e1e261f6..96d44dfbc 100644 --- a/internal/proto/ctrlplane/events/v1/rebase.pb.go +++ b/internal/proto/ctrlplane/events/v1/rebase.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/rebase.proto diff --git a/internal/proto/ctrlplane/events/v1/ref.pb.go b/internal/proto/ctrlplane/events/v1/ref.pb.go index ecb6b4648..3b6ef66b1 100644 --- a/internal/proto/ctrlplane/events/v1/ref.pb.go +++ b/internal/proto/ctrlplane/events/v1/ref.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/events/v1/ref.proto diff --git a/internal/proto/ctrlplane/healthz/v1/healthz.pb.go b/internal/proto/ctrlplane/healthz/v1/healthz.pb.go index eb6a69c09..c0298075f 100644 --- a/internal/proto/ctrlplane/healthz/v1/healthz.pb.go +++ b/internal/proto/ctrlplane/healthz/v1/healthz.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: ctrlplane/healthz/v1/healthz.proto diff --git a/internal/proto/hooks/github/v1/github.pb.go b/internal/proto/hooks/github/v1/github.pb.go index 635355703..18f197ebe 100644 --- a/internal/proto/hooks/github/v1/github.pb.go +++ b/internal/proto/hooks/github/v1/github.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: hooks/github/v1/github.proto diff --git a/internal/proto/hooks/slack/v1/slack.pb.go b/internal/proto/hooks/slack/v1/slack.pb.go index f56008354..81fee8179 100644 --- a/internal/proto/hooks/slack/v1/slack.pb.go +++ b/internal/proto/hooks/slack/v1/slack.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: hooks/slack/v1/slack.proto diff --git a/tools/nix/pkgs/sqlc.nix b/tools/nix/pkgs/sqlc.nix new file mode 100644 index 000000000..cfc0451fc --- /dev/null +++ b/tools/nix/pkgs/sqlc.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + installShellFiles, +}: +buildGoModule rec { + pname = "sqlc"; + version = "1.27.0"; + + src = fetchFromGitHub { + owner = "sqlc-dev"; + repo = "sqlc"; + rev = "v${version}"; + hash = "sha256-wxQ+YPsDX0Z6B8whlQ/IaT2dRqapPL8kOuFEc6As1rU="; + }; + + proxyVendor = true; + vendorHash = "sha256-ndOw3uShF5TngpxYNumoK3H3R9v4crfi5V3ZCoSqW90="; + + subPackages = ["cmd/sqlc"]; + + nativeBuildInputs = [installShellFiles]; + + ldflags = [ + "-s" + "-w" + ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd sqlc \ + --bash <($out/bin/sqlc completion bash) \ + --fish <($out/bin/sqlc completion fish) \ + --zsh <($out/bin/sqlc completion zsh) + ''; + + meta = { + description = "Generate type-safe code from SQL"; + homepage = "https://sqlc.dev/"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [aaronjheng]; + mainProgram = "sqlc"; + }; +} diff --git a/deploy/temporal/dynamicconfig/development-cass.yaml b/tools/temporal/dynamicconfig/development-cass.yaml similarity index 100% rename from deploy/temporal/dynamicconfig/development-cass.yaml rename to tools/temporal/dynamicconfig/development-cass.yaml diff --git a/deploy/temporal/dynamicconfig/development.yaml b/tools/temporal/dynamicconfig/development.yaml similarity index 100% rename from deploy/temporal/dynamicconfig/development.yaml rename to tools/temporal/dynamicconfig/development.yaml