From 5ef2abe69da0d73e4ec87a212ca81c21418a24f5 Mon Sep 17 00:00:00 2001 From: Revanth Date: Thu, 29 May 2025 17:25:57 -0500 Subject: [PATCH 1/4] 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/4] 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/4] 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/4] 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: