From 5ef2abe69da0d73e4ec87a212ca81c21418a24f5 Mon Sep 17 00:00:00 2001 From: Revanth Date: Thu, 29 May 2025 17:25:57 -0500 Subject: [PATCH 1/8] Updated deploy workflow to work for both creates and updates --- src/templates/deployWorkflow.yaml | 32 +++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/templates/deployWorkflow.yaml b/src/templates/deployWorkflow.yaml index 2b03979d..3650c61f 100644 --- a/src/templates/deployWorkflow.yaml +++ b/src/templates/deployWorkflow.yaml @@ -51,13 +51,29 @@ jobs: run: aio console:project:select ${{ secrets.PROJECTID }} - name: Select workspace run: aio console:workspace:select ${{ secrets.WORKSPACEID }} - - name: "Create env file" + - name: Print AIO CLI Config + run: aio config list + - name: Get Mesh + id: get_mesh + continue-on-error: true run: | - touch .env - echo API_ENDPOINT="https://xxx.execute-api.us-west-2.amazonaws.com" >> .env - echo API_KEY=${{ secrets.API_KEY }} >> .env - cat .env - - name: Describe - run: aio api-mesh:describe - - name: Update + output=$(aio api-mesh:get 2>&1) + # Escape the output and replace newlines with %0A + escaped_output=$(echo "$output" | tr -d '\r' | tr '\n' ' ') + echo "mesh_output=$escaped_output" >> $GITHUB_OUTPUT + echo "$output" + - name: Debug Get Mesh Output + continue-on-error: true + run: echo "Get Mesh Output - ${{ steps.get_mesh.outputs.mesh_output }}" + - name: Create Mesh + if: ${{ contains(steps.get_mesh.outputs.mesh_output, 'No mesh found') }} + run: aio api-mesh:create -c mesh.json --env .env + - name: Update Mesh + if: ${{ !contains(steps.get_mesh.outputs.mesh_output, 'No mesh found') }} run: aio api-mesh:update -c mesh.json --env .env + - name: Wait for 30 seconds + run: sleep 30 + - name: Describe Mesh + run: aio api-mesh:describe + - name: Get Mesh Status + run: aio api-mesh:status From a2ff83ce50fcfc676339557eabdc2652d8338ae7 Mon Sep 17 00:00:00 2001 From: Revanth Date: Thu, 29 May 2025 17:26:13 -0500 Subject: [PATCH 2/8] Updated file references --- src/templates/loadTestWorkflow.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/loadTestWorkflow.yaml b/src/templates/loadTestWorkflow.yaml index 33d0c35f..25036951 100644 --- a/src/templates/loadTestWorkflow.yaml +++ b/src/templates/loadTestWorkflow.yaml @@ -8,8 +8,8 @@ jobs: - uses: actions/checkout@v3 with: sparse-checkout: | - script.js - convert.js + k6Tests.js + convertHTMLToPDF.js reports/ - name: Verify vars are set and fail if not run: | From 54bac48f1d632abcf46423f3501a960355fc9361 Mon Sep 17 00:00:00 2001 From: Revanth Date: Thu, 29 May 2025 17:33:28 -0500 Subject: [PATCH 3/8] Updated readme --- src/templates/readme.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/templates/readme.md b/src/templates/readme.md index 334a6e08..e458f37c 100644 --- a/src/templates/readme.md +++ b/src/templates/readme.md @@ -6,6 +6,13 @@ Use this repo to bootstrap Adobe API Mesh development with ease. Use this repo t This repo comes with all the files and dependencies necessary to get started with API Mesh. +1. `mesh.json` - sample mesh config with a single source +2. `.env` - environment file with variables for the config presented in mesh.json +3. `package.json` - dependencies and scripts to test and deploy meshes +4. `.vscode/launch.json` - VS Code configuration to setup debugging out of the box. This applies to VS Code on local machines or Codespaces on Github.com +5. `.devcontainer/devcontainer.json` - Codespaces configuration to setup dev container out of the box. This config will help setup the packages and build the mesh config automatically. As a bonus it also sets up port-forwarding so you can use your favourite GraphQL interface to practice the mesh +6. `.github/workflows/deployMesh.yml` - Github workflow to automatically publish mesh config when something is committed to `main` + # Local Dev `yarn start mesh.json` - to start the local dev server in watch mode @@ -18,6 +25,22 @@ This repo comes with all the files and dependencies necessary to get started wit `yarn test:perf` - to start the Performance Testing process locally for development. Make sure to update the `MESH_ENDPOINT` in the `test:perf` command located in the `package.json` +# Setup Github Workflows + +This repo comes with CICD out of the box but it will need Github Secrets to deploy meshes. + +Please add the following secrets to the repo upon setup. Follow the [CICD guide](https://developer.adobe.com/graphql-mesh-gateway/gateway/cicd/) to learn more about acquiring the required secrets. + +1. API_KEY +2. CLIENTID +3. CLIENTSECRET +4. IMSORGID +5. ORGID +6. PROJECTID +7. TECHNICALACCEMAIL +8. TECHNICALACCID +9. WORKSPACEID + # Documentation Check out the [documentation](https://developer.adobe.com/graphql-mesh-gateway/mesh/basic/create-mesh/) for further details on how to create and maintain meshes. From 2aaca6fb32d57bb88d4765d8998a8c529f95f52b Mon Sep 17 00:00:00 2001 From: Revanth Date: Fri, 30 May 2025 11:45:48 -0500 Subject: [PATCH 4/8] Validate secrets before attempting a deploy --- src/templates/deployWorkflow.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/templates/deployWorkflow.yaml b/src/templates/deployWorkflow.yaml index 3650c61f..4e31427a 100644 --- a/src/templates/deployWorkflow.yaml +++ b/src/templates/deployWorkflow.yaml @@ -25,6 +25,20 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + - name: Validate Secrets + run: | + if + [ -z "${{ secrets.CLIENTID }}" ] || + [ -z "${{ secrets.CLIENTSECRET }}" ] || + [ -z "${{ secrets.TECHNICALACCID }}" ] || + [ -z "${{ secrets.TECHNICALACCEMAIL }}" ] || + [ -z "${{ secrets.IMSORGID }}" ] || + [ -z "${{ secrets.ORGID }}" ] || + [ -z "${{ secrets.PROJECTID }}" ] || + [ -z "${{ secrets.WORKSPACEID }}" ]; then + echo "Please set all required secrets: CLIENTID, CLIENTSECRET, TECHNICALACCID, TECHNICALACCEMAIL, IMSORGID, ORGID, PROJECTID, WORKSPACEID" + exit 1 + fi - name: Setup CLI uses: adobe/aio-cli-setup-action@1.3.0 with: From c30588d54f3db2ce173a712c056f17dd21951e46 Mon Sep 17 00:00:00 2001 From: Revanth Kumar Annavarapu <35203638+revanth0212@users.noreply.github.com> Date: Mon, 2 Jun 2025 17:42:55 -0500 Subject: [PATCH 5/8] Update init.js --- src/commands/api-mesh/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/api-mesh/init.js b/src/commands/api-mesh/init.js index 7fe659c0..22d344a5 100644 --- a/src/commands/api-mesh/init.js +++ b/src/commands/api-mesh/init.js @@ -156,7 +156,7 @@ class InitCommand extends Command { const gitIgnoreFilePath = `${absolutePath}/.gitignore`; await this.cloneFile(gitIgnoreTemplatePath, gitIgnoreFilePath); - await this.cloneFile(deployWorkflowPath, `${absolutePath}/.github/workflows/deploy.yaml`); + await this.cloneFile(deployWorkflowPath, `${absolutePath}/.github/workflows/deployMesh.yaml`); await this.cloneFile( loadTestWorkflowPath, `${absolutePath}/.github/workflows/loadTest.yaml`, From 5ad9f74ffb83e523030e74de63c5f6d118717093 Mon Sep 17 00:00:00 2001 From: Revanth Kumar Annavarapu <35203638+revanth0212@users.noreply.github.com> Date: Mon, 2 Jun 2025 17:43:48 -0500 Subject: [PATCH 6/8] Update readme.md --- src/templates/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/readme.md b/src/templates/readme.md index e458f37c..ccd53bd9 100644 --- a/src/templates/readme.md +++ b/src/templates/readme.md @@ -11,7 +11,7 @@ This repo comes with all the files and dependencies necessary to get started wit 3. `package.json` - dependencies and scripts to test and deploy meshes 4. `.vscode/launch.json` - VS Code configuration to setup debugging out of the box. This applies to VS Code on local machines or Codespaces on Github.com 5. `.devcontainer/devcontainer.json` - Codespaces configuration to setup dev container out of the box. This config will help setup the packages and build the mesh config automatically. As a bonus it also sets up port-forwarding so you can use your favourite GraphQL interface to practice the mesh -6. `.github/workflows/deployMesh.yml` - Github workflow to automatically publish mesh config when something is committed to `main` +6. `.github/workflows/deployMesh.yaml` - Github workflow to automatically publish mesh config when something is committed to `main` # Local Dev From 01bbbc19b5211e45dfdb7cb4f802a7841740fdf9 Mon Sep 17 00:00:00 2001 From: Revanth Date: Tue, 3 Jun 2025 10:30:29 -0500 Subject: [PATCH 7/8] v5.4.0-beta.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59ffc9da..b4dfa557 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.4.0-beta.1", + "version": "5.4.0-beta.2", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From 2abdca3a8846e25106280248da479288f15fcf5e Mon Sep 17 00:00:00 2001 From: Revanth Date: Tue, 3 Jun 2025 10:35:42 -0500 Subject: [PATCH 8/8] Lint fix --- src/commands/api-mesh/init.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/api-mesh/init.js b/src/commands/api-mesh/init.js index 22d344a5..a1fa3907 100644 --- a/src/commands/api-mesh/init.js +++ b/src/commands/api-mesh/init.js @@ -156,7 +156,10 @@ class InitCommand extends Command { const gitIgnoreFilePath = `${absolutePath}/.gitignore`; await this.cloneFile(gitIgnoreTemplatePath, gitIgnoreFilePath); - await this.cloneFile(deployWorkflowPath, `${absolutePath}/.github/workflows/deployMesh.yaml`); + await this.cloneFile( + deployWorkflowPath, + `${absolutePath}/.github/workflows/deployMesh.yaml`, + ); await this.cloneFile( loadTestWorkflowPath, `${absolutePath}/.github/workflows/loadTest.yaml`,