This repository was archived by the owner on Jun 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Update gatway subgraph using rover #295
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3e94251
update subgraph using rover
nxtcoder19 7c38a91
update subgraph using rover
nxtcoder19 def82fe
update subgraph using rover
nxtcoder19 5c65c44
update subgraph using rover
nxtcoder19 4ae58ff
update subgraph using rover
nxtcoder19 cee15b3
update subgraph using rover
nxtcoder19 6a51235
update subgraph using rover
nxtcoder19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: build-gateway-images | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| repository_dispatch: | ||
| types: | ||
| - webhook | ||
|
|
||
| push: | ||
| paths: | ||
| - "apps/**/graph/*.graphqls" | ||
| - "apps/**/graph/struct-to-graphql/*.graphqls" | ||
| - "apps/gateway/**" | ||
| - ".github/workflows/build-gateway.yml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| docker-builds: | ||
| runs-on: ubuntu-latest | ||
| name: Deploy to Docker Image | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v2 | ||
|
|
||
| - name: Install Task | ||
| uses: arduino/setup-task@v1 | ||
| with: | ||
| version: 3.x | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Install Rover | ||
| run: | | ||
| curl -sSL https://rover.apollo.dev/nix/v0.23.0-rc.3 | sh | ||
|
|
||
| # Add Rover to the $GITHUB_PATH so it can be used in another step | ||
| # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path | ||
| echo "$HOME/.rover/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Generate Schema | ||
| run: | | ||
| cd apps/gateway | ||
| task generate-schema | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Create Image Tag from branch name | ||
| if: startsWith(github.ref, 'refs/heads/release') | ||
| run: | | ||
| set +e | ||
| IMAGE_TAG=$(echo ${GITHUB_REF#refs/heads/} | sed 's/release-//g') | ||
| echo "$IMAGE_TAG" | grep -i '\-nightly$' | ||
| if [ $? -ne 0 ]; then | ||
| IMAGE_TAG="$IMAGE_TAG-nightly" | ||
| fi | ||
| set -e | ||
|
|
||
| echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | ||
| echo "OVERRIDE_PUSHED_IMAGE=true" >> $GITHUB_ENV | ||
|
|
||
| - name: Create Image Tag from tag | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| run: | | ||
| IMAGE_TAG=$(echo ${GITHUB_REF#refs/tags/}) | ||
|
|
||
| echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | ||
| echo "OVERRIDE_PUSHED_IMAGE=false" >> $GITHUB_ENV | ||
|
|
||
| - name: Build & Push Image | ||
| if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/tags/') | ||
| run: | | ||
| set +e | ||
| image_name="ghcr.io/${{ github.repository }}/gateway" | ||
|
|
||
| docker manifest inspect $image_name:$IMAGE_TAG | ||
| exit_status=$? | ||
| if [ $exit_status -eq 0 ]; then | ||
| [ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image_name:$IMAGE_TAG) already exists, and override image is disable, exiting" && exit 0 | ||
| echo "image exists, but override pushed image is set to true. proceeding with building image" | ||
| fi | ||
|
|
||
| set -e | ||
|
|
||
| cd apps/gateway | ||
| task container:build-and-push Image=$image_name:$IMAGE_TAG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| !package.json | ||
| !src | ||
| !pnpm-lock.yaml | ||
| !prod-schema.graphql | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| schemas | ||
| prod-schema.graphql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| mkdir -p schemas | ||
|
|
||
| cat ../accounts/internal/app/graph/*.graphqls > ./schemas/accounts-api.schema | ||
| cat ../accounts/internal/app/graph/struct-to-graphql/*.graphqls >> ./schemas/accounts-api.schema | ||
|
|
||
| cat ../console/internal/app/graph/*.graphqls > ./schemas/console-api.schema | ||
| cat ../console/internal/app/graph/struct-to-graphql/*.graphqls >> ./schemas/console-api.schema | ||
|
|
||
| cat ../container-registry/internal/app/graph/*.graphqls > ./schemas/container-registry-api.schema | ||
| cat ../container-registry/internal/app/graph/struct-to-graphql/*.graphqls >> ./schemas/container-registry-api.schema | ||
|
|
||
| cat ../infra/internal/app/graph/*.graphqls > ./schemas/infra-api.schema | ||
| cat ../infra/internal/app/graph/struct-to-graphql/*.graphqls >> ./schemas/infra-api.schema | ||
|
|
||
| cat ../auth/internal/app/graph/*.graphqls > ./schemas/auth-api.schema | ||
| cat ../message-office/internal/app/graph/*.graphqls > ./schemas/message-office-api.schema | ||
|
|
||
| rover supergraph compose --config ./supergraph.yml --output prod-schema.graphql --elv2-license accept |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| federation_version: =2.3.2 | ||
| subgraphs: | ||
| auth-api: | ||
| routing_url: http://auth-api | ||
| schema: | ||
| file: ./schemas/auth-api.schema | ||
| account-api: | ||
| routing_url: https://accounts-api | ||
| schema: | ||
| file: ./schemas/accounts-api.schema | ||
| container-registry-api: | ||
| routing_url: https://container-registry-api | ||
| schema: | ||
| file: ./schemas/container-registry-api.schema | ||
| console-api: | ||
| routing_url: https://console-api | ||
| schema: | ||
| file: ./schemas/console-api.schema | ||
| infra-api: | ||
| routing_url: https://infra-api | ||
| schema: | ||
| file: ./schemas/infra-api.schema |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Consider using asynchronous file reading with
fs.promises.readFileinstead offs.readFileSyncto avoid blocking the event loop, especially since this operation is performed at the startup.