From f9ef7de0d6f8f1aadfe061b8b1521109c5917572 Mon Sep 17 00:00:00 2001 From: nunopato Date: Tue, 3 Jun 2025 20:12:42 +0000 Subject: [PATCH 1/7] chore: bump nhost/dashboard to 2.30.0 --- cmd/dev/up.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dev/up.go b/cmd/dev/up.go index eb4911d5d..c13e11027 100644 --- a/cmd/dev/up.go +++ b/cmd/dev/up.go @@ -110,7 +110,7 @@ func CommandUp() *cli.Command { //nolint:funlen &cli.StringFlag{ //nolint:exhaustruct Name: flagDashboardVersion, Usage: "Dashboard version to use", - Value: "nhost/dashboard:2.29.0", + Value: "nhost/dashboard:2.30.0", EnvVars: []string{"NHOST_DASHBOARD_VERSION"}, }, &cli.StringFlag{ //nolint:exhaustruct From 3e751c7d02a1888a84519f1655ff5006ca3624b5 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 12:35:34 +0200 Subject: [PATCH 2/7] asd --- nhostclient/graphql/models_gen.go | 148 ++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/nhostclient/graphql/models_gen.go b/nhostclient/graphql/models_gen.go index 483c2ad9d..5091df530 100644 --- a/nhostclient/graphql/models_gen.go +++ b/nhostclient/graphql/models_gen.go @@ -2993,6 +2993,77 @@ type FeatureFlagsStreamCursorValueInput struct { Value *string `json:"value,omitempty"` } +// columns and relationships of "storage.files" +type Files struct { + BucketID string `json:"bucketId"` + CreatedAt time.Time `json:"createdAt"` + Etag *string `json:"etag,omitempty"` + ID string `json:"id"` + IsUploaded *bool `json:"isUploaded,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` + MimeType *string `json:"mimeType,omitempty"` + Name *string `json:"name,omitempty"` + Size *int64 `json:"size,omitempty"` + UpdatedAt time.Time `json:"updatedAt"` + UploadedByUserID *string `json:"uploadedByUserId,omitempty"` +} + +// Boolean expression to filter rows from the table "storage.files". All fields are combined with a logical 'AND'. +type FilesBoolExp struct { + And []*FilesBoolExp `json:"_and,omitempty"` + Not *FilesBoolExp `json:"_not,omitempty"` + Or []*FilesBoolExp `json:"_or,omitempty"` + BucketID *StringComparisonExp `json:"bucketId,omitempty"` + CreatedAt *TimestamptzComparisonExp `json:"createdAt,omitempty"` + Etag *StringComparisonExp `json:"etag,omitempty"` + ID *UUIDComparisonExp `json:"id,omitempty"` + IsUploaded *BooleanComparisonExp `json:"isUploaded,omitempty"` + Metadata *JsonbComparisonExp `json:"metadata,omitempty"` + MimeType *StringComparisonExp `json:"mimeType,omitempty"` + Name *StringComparisonExp `json:"name,omitempty"` + Size *IntComparisonExp `json:"size,omitempty"` + UpdatedAt *TimestamptzComparisonExp `json:"updatedAt,omitempty"` + UploadedByUserID *UUIDComparisonExp `json:"uploadedByUserId,omitempty"` +} + +// Ordering options when selecting data from "storage.files". +type FilesOrderBy struct { + BucketID *OrderBy `json:"bucketId,omitempty"` + CreatedAt *OrderBy `json:"createdAt,omitempty"` + Etag *OrderBy `json:"etag,omitempty"` + ID *OrderBy `json:"id,omitempty"` + IsUploaded *OrderBy `json:"isUploaded,omitempty"` + Metadata *OrderBy `json:"metadata,omitempty"` + MimeType *OrderBy `json:"mimeType,omitempty"` + Name *OrderBy `json:"name,omitempty"` + Size *OrderBy `json:"size,omitempty"` + UpdatedAt *OrderBy `json:"updatedAt,omitempty"` + UploadedByUserID *OrderBy `json:"uploadedByUserId,omitempty"` +} + +// Streaming cursor of the table "files" +type FilesStreamCursorInput struct { + // Stream column input with initial value + InitialValue *FilesStreamCursorValueInput `json:"initial_value"` + // cursor ordering + Ordering *CursorOrdering `json:"ordering,omitempty"` +} + +// Initial value of the column from where the streaming should start +type FilesStreamCursorValueInput struct { + BucketID *string `json:"bucketId,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + Etag *string `json:"etag,omitempty"` + ID *string `json:"id,omitempty"` + IsUploaded *bool `json:"isUploaded,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` + MimeType *string `json:"mimeType,omitempty"` + Name *string `json:"name,omitempty"` + Size *int64 `json:"size,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + UploadedByUserID *string `json:"uploadedByUserId,omitempty"` +} + // columns and relationships of "github_app_installations" type GithubAppInstallations struct { AccountAvatarURL *string `json:"accountAvatarUrl,omitempty"` @@ -4623,6 +4694,12 @@ type SubscriptionRoot struct { FeatureFlags []*FeatureFlags `json:"featureFlags"` // fetch data from the table in a streaming manner: "feature_flags" FeatureFlagsStream []*FeatureFlags `json:"featureFlags_stream"` + // fetch data from the table: "storage.files" using primary key columns + File *Files `json:"file,omitempty"` + // fetch data from the table: "storage.files" + Files []*Files `json:"files"` + // fetch data from the table in a streaming manner: "storage.files" + FilesStream []*Files `json:"files_stream"` // fetch data from the table: "github_app_installations" using primary key columns GithubAppInstallation *GithubAppInstallations `json:"githubAppInstallation,omitempty"` // fetch data from the table: "github_app_installations" @@ -6746,6 +6823,77 @@ func (e FeatureFlagsUpdateColumn) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } +// select columns of table "storage.files" +type FilesSelectColumn string + +const ( + // column name + FilesSelectColumnBucketID FilesSelectColumn = "bucketId" + // column name + FilesSelectColumnCreatedAt FilesSelectColumn = "createdAt" + // column name + FilesSelectColumnEtag FilesSelectColumn = "etag" + // column name + FilesSelectColumnID FilesSelectColumn = "id" + // column name + FilesSelectColumnIsUploaded FilesSelectColumn = "isUploaded" + // column name + FilesSelectColumnMetadata FilesSelectColumn = "metadata" + // column name + FilesSelectColumnMimeType FilesSelectColumn = "mimeType" + // column name + FilesSelectColumnName FilesSelectColumn = "name" + // column name + FilesSelectColumnSize FilesSelectColumn = "size" + // column name + FilesSelectColumnUpdatedAt FilesSelectColumn = "updatedAt" + // column name + FilesSelectColumnUploadedByUserID FilesSelectColumn = "uploadedByUserId" +) + +var AllFilesSelectColumn = []FilesSelectColumn{ + FilesSelectColumnBucketID, + FilesSelectColumnCreatedAt, + FilesSelectColumnEtag, + FilesSelectColumnID, + FilesSelectColumnIsUploaded, + FilesSelectColumnMetadata, + FilesSelectColumnMimeType, + FilesSelectColumnName, + FilesSelectColumnSize, + FilesSelectColumnUpdatedAt, + FilesSelectColumnUploadedByUserID, +} + +func (e FilesSelectColumn) IsValid() bool { + switch e { + case FilesSelectColumnBucketID, FilesSelectColumnCreatedAt, FilesSelectColumnEtag, FilesSelectColumnID, FilesSelectColumnIsUploaded, FilesSelectColumnMetadata, FilesSelectColumnMimeType, FilesSelectColumnName, FilesSelectColumnSize, FilesSelectColumnUpdatedAt, FilesSelectColumnUploadedByUserID: + return true + } + return false +} + +func (e FilesSelectColumn) String() string { + return string(e) +} + +func (e *FilesSelectColumn) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = FilesSelectColumn(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid files_select_column", str) + } + return nil +} + +func (e FilesSelectColumn) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + // unique or primary key constraints on table "github_app_installations" type GithubAppInstallationsConstraint string From 8179bacbd5c6a40cd78bc3a8a345fb7df3ffccf9 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 12:50:45 +0200 Subject: [PATCH 3/7] asd --- .github/workflows/wf_publish.yaml | 10 ++++++---- Makefile | 14 ++++++++++---- VERSION | 1 - flake.lock | 32 ++++++++++++++++++++++++++++--- flake.nix | 14 +++++++++----- 5 files changed, 54 insertions(+), 17 deletions(-) delete mode 100644 VERSION diff --git a/.github/workflows/wf_publish.yaml b/.github/workflows/wf_publish.yaml index 226edaf74..89446b27a 100644 --- a/.github/workflows/wf_publish.yaml +++ b/.github/workflows/wf_publish.yaml @@ -50,12 +50,14 @@ jobs: export VERSION=${{ steps.vars.outputs.VERSION }} export CONTAINER_NAME=nhost/cli - docker load < ~/artifacts/cli-docker-image-$VERSION-linux-amd64/result - docker tag cli:$VERSION $CONTAINER_NAME:$VERSION-amd64 + skopeo copy --insecure-policy \ + dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-amd64/result \ + docker-daemon:$CONTAINER_NAME:$VERSION-amd64 docker push $CONTAINER_NAME:$VERSION-amd64 - docker load < ~/artifacts/cli-docker-image-$VERSION-linux-arm64/result - docker tag cli:$VERSION $CONTAINER_NAME:$VERSION-arm64 + skopeo copy --insecure-policy \ + dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-arm64/result \ + docker-daemon:$CONTAINER_NAME:$VERSION-arm64 docker push $CONTAINER_NAME:$VERSION-arm64 docker manifest create \ diff --git a/Makefile b/Makefile index b0cae0dd3..40739e604 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,12 @@ else OS?=linux endif -VER=$(shell echo $(VERSION) | sed -e 's/\//_/g') + +ifdef VER +VERSION=$(shell echo $(VER) | sed -e 's/^v//g' -e 's/\//_/g') +else +VERSION=$(shell grep -oP 'version\s*=\s*"\K[^"]+' flake.nix | head -n 1) +endif .PHONY: check @@ -33,10 +38,11 @@ build-docker-image: ## Build docker image nix build $(docker-build-options) \ .\#packages.$(HOST_ARCH)-linux.docker-image-$(ARCH) \ --print-build-logs - docker load < result + skopeo copy --insecure-policy dir:./result docker-daemon:nhost/cli:$(VERSION) .PHONY: get-version get-version: ## Return version - @echo $(VER) > VERSION - @echo $(VER) + @sed -i '/^\s*version = "0.0.0-dev";/s//version = "${VERSION}";/' flake.nix + @sed -i '/^\s*created = "1970-.*";/s//created = "${shell date --utc '+%Y-%m-%dT%H:%M:%SZ'}";/' flake.nix + @echo $(VERSION) diff --git a/VERSION b/VERSION deleted file mode 100644 index cb676de10..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.0-dev diff --git a/flake.lock b/flake.lock index d45d8469b..6317f1900 100644 --- a/flake.lock +++ b/flake.lock @@ -33,18 +33,40 @@ "type": "github" } }, + "nix2container": { + "inputs": { + "nixpkgs": [ + "nixops", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749158376, + "narHash": "sha256-uirStFNxauh0lxzBowcp28X+Sq7JgsBIDnbwbAfZwf8=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "0f8974c58755dba441df03598eefd1e1cd50e341", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, "nixops": { "inputs": { "flake-utils": "flake-utils", "nix-filter": "nix-filter", + "nix2container": "nix2container", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1745925792, - "narHash": "sha256-tSN3G8dAm4cX6vG6Agm/jXGhBrsHgewHCHVF0LR52fQ=", + "lastModified": 1749810533, + "narHash": "sha256-VrH4a1M9Icoe7Zjt/Cp0ZwTg11dxgQpzRHOJK717oQQ=", "owner": "nhost", "repo": "nixops", - "rev": "555a2f79e2a0187c0e2f33d519c8e79041b681e1", + "rev": "6421c2f2ffb7da1246de344f5a63bc140ff4cefb", "type": "github" }, "original": { @@ -79,6 +101,10 @@ "nixops", "nix-filter" ], + "nix2container": [ + "nixops", + "nix2container" + ], "nixops": "nixops", "nixpkgs": [ "nixops", diff --git a/flake.nix b/flake.nix index b4328ec6f..86dfdbcd0 100644 --- a/flake.nix +++ b/flake.nix @@ -4,9 +4,10 @@ nixpkgs.follows = "nixops/nixpkgs"; flake-utils.follows = "nixops/flake-utils"; nix-filter.follows = "nixops/nix-filter"; + nix2container.follows = "nixops/nix2container"; }; - outputs = { self, nixops, nixpkgs, flake-utils, nix-filter }: + outputs = { self, nixops, nixpkgs, flake-utils, nix-filter, nix2container }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ @@ -59,11 +60,13 @@ nativeBuildInputs = with pkgs; [ ]; - nixops-lib = nixops.lib { inherit pkgs; }; + nix2containerPkgs = nix2container.packages.${system}; + nixops-lib = nixops.lib { inherit pkgs nix2containerPkgs; }; name = "cli"; description = "Nhost CLI"; - version = pkgs.lib.fileContents ./VERSION; + version = "0.0.0-dev"; + created = "1970-01-01T00:00:00Z"; module = "github.com/nhost/cli"; submodule = "."; @@ -92,6 +95,7 @@ buildInputs = with pkgs; [ certbot-full python312Packages.certbot-dns-route53 + skopeo ] ++ checkDeps ++ buildInputs ++ nativeBuildInputs; }; }; @@ -142,13 +146,13 @@ }); docker-image-arm64 = nixops-lib.go.docker-image { - inherit name version buildInputs; + inherit name version created buildInputs; package = cli-arm64-linux; }; docker-image-amd64 = nixops-lib.go.docker-image { - inherit name version buildInputs; + inherit name version created buildInputs; package = cli-amd64-linux; }; From 1422b184318521885bad9f3f99d2de5acd574c2b Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 12:59:48 +0200 Subject: [PATCH 4/7] asd --- .github/workflows/wf_publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wf_publish.yaml b/.github/workflows/wf_publish.yaml index 89446b27a..fe0eac014 100644 --- a/.github/workflows/wf_publish.yaml +++ b/.github/workflows/wf_publish.yaml @@ -51,12 +51,12 @@ jobs: export CONTAINER_NAME=nhost/cli skopeo copy --insecure-policy \ - dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-amd64/result \ + dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-amd64 \ docker-daemon:$CONTAINER_NAME:$VERSION-amd64 docker push $CONTAINER_NAME:$VERSION-amd64 skopeo copy --insecure-policy \ - dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-arm64/result \ + dir:/home/runner/artifacts/cli-docker-image-$VERSION-linux-arm64 \ docker-daemon:$CONTAINER_NAME:$VERSION-arm64 docker push $CONTAINER_NAME:$VERSION-arm64 From 29215106a80bba7c408eb8e039e98837ed389f27 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 14:27:47 +0200 Subject: [PATCH 5/7] asd --- .github/workflows/wf_build_artifacts.yaml | 13 ------------- Makefile | 4 +++- flake.lock | 7 ++++--- flake.nix | 4 +++- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/wf_build_artifacts.yaml b/.github/workflows/wf_build_artifacts.yaml index 991314fe3..50deafba3 100644 --- a/.github/workflows/wf_build_artifacts.yaml +++ b/.github/workflows/wf_build_artifacts.yaml @@ -67,19 +67,6 @@ jobs: make build-docker-image ARCH=${{ inputs.GOARCH }} if: ${{ ( inputs.GOOS == 'linux' ) }} - - name: "Ammend manifest" - run: | - # hack that speeds up build a lot by crosscompiling with nix/go - # and avoiding to use qemu - mkdir tmp && cd tmp - tar xvzf ../result - sed -i 's/amd64/arm64/g' *.json - tar cvzf image * - rm ../result - cp image ../result - shell: bash - if: ${{ ( inputs.GOOS == 'linux' && inputs.GOARCH == 'arm64' ) }} - - name: "Create a new project" run: | export NHOST_DOMAIN=staging.nhost.run diff --git a/Makefile b/Makefile index 40739e604..6eb20b7ab 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,9 @@ build-docker-image: ## Build docker image nix build $(docker-build-options) \ .\#packages.$(HOST_ARCH)-linux.docker-image-$(ARCH) \ --print-build-logs - skopeo copy --insecure-policy dir:./result docker-daemon:nhost/cli:$(VERSION) + skopeo copy --insecure-policy \ + --override-arch $(ARCH) \ + dir:./result docker-daemon:nhost/cli:$(VERSION) .PHONY: get-version diff --git a/flake.lock b/flake.lock index 6317f1900..45f82ed16 100644 --- a/flake.lock +++ b/flake.lock @@ -62,15 +62,16 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1749810533, - "narHash": "sha256-VrH4a1M9Icoe7Zjt/Cp0ZwTg11dxgQpzRHOJK717oQQ=", + "lastModified": 1750076681, + "narHash": "sha256-MsaskaJ+a0O06SZ6eVLfhx+oMcO6R8PFlyBpRwnMn8E=", "owner": "nhost", "repo": "nixops", - "rev": "6421c2f2ffb7da1246de344f5a63bc140ff4cefb", + "rev": "c5c91aef5a51cb476324478696572dd3bbac2dff", "type": "github" }, "original": { "owner": "nhost", + "ref": "arch", "repo": "nixops", "type": "github" } diff --git a/flake.nix b/flake.nix index 86dfdbcd0..b49f7b7b0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixops.url = "github:nhost/nixops"; + nixops.url = "github:nhost/nixops?ref=arch"; nixpkgs.follows = "nixops/nixpkgs"; flake-utils.follows = "nixops/flake-utils"; nix-filter.follows = "nixops/nix-filter"; @@ -147,12 +147,14 @@ docker-image-arm64 = nixops-lib.go.docker-image { inherit name version created buildInputs; + arch = "arm64"; package = cli-arm64-linux; }; docker-image-amd64 = nixops-lib.go.docker-image { inherit name version created buildInputs; + arch = "amd64"; package = cli-amd64-linux; }; From 5c8dff88cee2290ac864ac42db075c1c0d4dbc20 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 14:35:41 +0200 Subject: [PATCH 6/7] asd --- .github/workflows/wf_build_artifacts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wf_build_artifacts.yaml b/.github/workflows/wf_build_artifacts.yaml index 50deafba3..308ce7bac 100644 --- a/.github/workflows/wf_build_artifacts.yaml +++ b/.github/workflows/wf_build_artifacts.yaml @@ -70,7 +70,7 @@ jobs: - name: "Create a new project" run: | export NHOST_DOMAIN=staging.nhost.run - export NHOST_CONFIGSERVER_IMAGE=cli:${{ steps.vars.outputs.VERSION }} + export NHOST_CONFIGSERVER_IMAGE=nhost/cli:${{ steps.vars.outputs.VERSION }} mkdir new-project cd new-project From 282499c0b0848ff79be23673eb23f1fd2e99aea1 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 14:43:48 +0200 Subject: [PATCH 7/7] asd --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b49f7b7b0..9b3ca9af1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixops.url = "github:nhost/nixops?ref=arch"; + nixops.url = "github:nhost/nixops"; nixpkgs.follows = "nixops/nixpkgs"; flake-utils.follows = "nixops/flake-utils"; nix-filter.follows = "nixops/nix-filter";