Skip to content

Commit e73a173

Browse files
authored
Merge pull request #1 from comwrap/2.0.0
## [2.0.0] - 2025-12-09
2 parents 277d6a5 + c2dd5f1 commit e73a173

4 files changed

Lines changed: 113 additions & 11 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,28 @@ jobs:
1313
deploy:
1414
name: Deploy API Mesh
1515
runs-on: ${{ matrix.os }}
16+
container:
17+
image: ghcr.io/comwrap/aio-mesh-runner:latest
18+
env:
19+
HOME: /root
1620
strategy:
1721
max-parallel: 1
1822
matrix:
1923
node-version: ["20"]
2024
os: [ubuntu-latest]
2125
steps:
26+
- name: Ensure AIO CLI available
27+
run: |
28+
which aio || { echo "aio missing"; exit 1; }
29+
aio -h
30+
- name: Install API Mesh plugin
31+
run: aio plugins:install @adobe/aio-cli-plugin-api-mesh
32+
- name: Debug AIO plugins
33+
run: |
34+
echo "HOME=$HOME"
35+
which aio
36+
aio -V
37+
aio plugins
2238
- name: Checkout
2339
uses: actions/checkout@v4
2440
- name: Use Node.js ${{ matrix.node-version }}
@@ -90,6 +106,7 @@ jobs:
90106
echo "Warning: MESH_SECRETS not provided; secrets.yaml will not be generated" >&2
91107
fi
92108
- name: Materialize mesh secrets file
109+
shell: bash
93110
if: ${{ env.MESH_SECRETS != '' }}
94111
run: |
95112
set -euo pipefail
@@ -101,13 +118,6 @@ jobs:
101118
set -euo pipefail
102119
printf '%s\n' "$AIO_ENV_FILE" > .env
103120
chmod 600 .env
104-
- name: Setup CLI
105-
uses: adobe/aio-cli-setup-action@1.3.0
106-
with:
107-
os: ${{ matrix.os }}
108-
version: 11.x.x
109-
- name: api-mesh-plugin install
110-
run: aio plugins:install @adobe/aio-cli-plugin-api-mesh
111121
- name: Auth
112122
uses: adobe/aio-apps-action@4.0.0
113123
with:
@@ -142,6 +152,7 @@ jobs:
142152
continue-on-error: true
143153
run: echo "Get Mesh Output - ${{ steps.get_mesh.outputs.mesh_output }}"
144154
- name: Compute Mesh Credential Flags
155+
shell: bash
145156
id: mesh_args
146157
run: |
147158
set -euo pipefail
@@ -160,6 +171,7 @@ jobs:
160171
if: ${{ !contains(steps.get_mesh.outputs.mesh_output, 'No mesh found') }}
161172
run: aio api-mesh:update ${{ steps.mesh_args.outputs.args }}
162173
- name: Wait for Mesh Provisioning
174+
shell: bash
163175
run: |
164176
set -euo pipefail
165177
max_attempts=60
@@ -175,6 +187,9 @@ jobs:
175187
elif echo "$status_output" | grep -Eq "Mesh is currently building|Your mesh is being provisioned.|Currently provisioning your mesh|Wait a few minutes and try again.|Unable to get mesh status"; then
176188
echo "Mesh is currently building. Waiting 10 seconds before next check."
177189
sleep 10
190+
elif echo "$status_output" | grep -F "is not a aio command" >/dev/null; then
191+
echo "API Mesh plugin not available. Failing explicitly."
192+
exit 1
178193
else
179194
echo "Unexpected status output. Treating as failure."
180195
exit 1
@@ -193,7 +208,7 @@ jobs:
193208
run: aio api-mesh:status
194209

195210
tests:
196-
name: Execute Tests
197-
needs: [deploy]
198-
# Use the path to the reusable workflow file
199-
uses: ./.github/workflows/tests.yaml
211+
name: Execute Tests
212+
needs: [deploy]
213+
# Use the path to the reusable workflow file
214+
uses: ./.github/workflows/tests.yaml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:20-bullseye-slim
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
ca-certificates \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
RUN npm install -g @adobe/aio-cli && \
9+
npm cache clean --force && \
10+
rm -rf /root/.npm /tmp/*
11+
12+
WORKDIR /workspace

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ All notable changes to this project will be documented in this file. The format
2020
## [1.0.0] - 2025-11-19
2121
### Added
2222
- Initial Adobe API Mesh CI/CD template with a GitHub Actions workflow for staging/production deployments, README-based setup guidance, and secret validation.
23+
24+
## [2.0.0] - 2025-12-09
25+
### Added
26+
- Prebuilt runner image with `aio`
27+
- no CLI installation steps in the workflow.

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Adobe API Mesh CI/CD Template
22

3+
> ⚠️ **Important:** Starting from version 2.x, a custom container is required. The Dockerfile can be found in `.github/images/aio-mesh-runner/Dockerfile`. If you prefer to use a standard GitHub runner without a custom container, please use version 1.x of this template.
4+
35
This repository is a lightweight starting point for teams that want a repeatable GitHub Actions pipeline for provisioning and updating Adobe API Mesh configurations. Fork it, drop in your mesh definition files, wire up the required Adobe Developer Console credentials, and you will have a push-button deployment path for staging and production meshes.
46

57
---
@@ -69,6 +71,74 @@ If these variables are present, the workflow writes them to `.env` before runnin
6971

7072
---
7173

74+
### Runner image requirements
75+
This template is designed to run the deploy workflow inside a lightweight Docker image that already contains Node.js 20.x and the Adobe AIO CLI, but does not bake in the API Mesh plugin. The plugin is installed on each run inside the GitHub Actions job so that it is always available under the correct `$HOME` and CLI config scope.
76+
77+
Dockerfile used by the workflow:
78+
79+
```
80+
FROM node:20-bullseye-slim
81+
82+
RUN apt-get update && apt-get install -y \
83+
git \
84+
ca-certificates \
85+
&& rm -rf /var/lib/apt/lists/*
86+
87+
RUN npm install -g @adobe/aio-cli && \
88+
npm cache clean --force && \
89+
rm -rf /root/.npm /tmp/*
90+
91+
WORKDIR /workspace
92+
93+
```
94+
Build and push the AMD64 image:
95+
```
96+
docker buildx build \
97+
--platform linux/amd64 \
98+
-t ghcr.io/<org-or-user>/aio-mesh-runner:latest \
99+
--push \
100+
-f .github/images/aio-mesh-runner/Dockerfile .
101+
```
102+
103+
Reference it in `deploy.yaml`:
104+
```
105+
jobs:
106+
deploy:
107+
runs-on: ${{ matrix.os }}
108+
container:
109+
image: ghcr.io/<org-or-user>/aio-mesh-runner:latest
110+
strategy:
111+
matrix:
112+
node-version: ["20"]
113+
os: [ubuntu-latest]
114+
# ...
115+
116+
```
117+
#### Why the API Mesh plugin is installed in the runner
118+
The API Mesh plugin (`@adobe/aio-cli-plugin-api-mesh`) is not installed in the Docker image. Instead, the workflow installs it inside the job, for example:
119+
```
120+
- name: Install API Mesh plugin
121+
run: aio plugins:install @adobe/aio-cli-plugin-api-mesh
122+
123+
```
124+
This is required because:
125+
126+
- AIO plugins are resolved per user via the CLI config directory under `$HOME` (for example `~/.config/@adobe/aio`), not from a global shared path.
127+
- In GitHub container jobs, the runner forcibly sets `HOME=/github/home`, which is different from the `HOME` used at image build time (typically `/root`).
128+
- If the plugin is only installed during `docker build`, it ends up wired to the build-time home and config; when the job runs with `HOME=/github/home`, `aio` does not see those plugins and `aio api-mesh:*` commands fail.
129+
130+
By installing `@adobe/aio-cli-plugin-api-mesh` inside the GitHub Actions job (with the final `$HOME` already set by the runner), the CLI always discovers the plugin correctly, regardless of how the container image was built.
131+
132+
**If you do not have such a runner image, use the 1.x version of this template, where:**
133+
134+
- The job runs directly on `ubuntu-latest` (no `container`: stanza).
135+
- `aio` and the API Mesh plugin are installed inside the workflow steps (for example using `adobe/aio-cli-setup-action` plus an explicit `aio plugins:install @adobe/aio-cli-plugin-api-mesh`).
136+
137+
In short:
138+
139+
- 2.x template – requires a prebuilt runner image with `aio`; no CLI installation steps in the workflow.
140+
- 1.x template – no custom image required; CLI and plugin are installed at runtime in the job, which is slower but does not depend on Docker image management.
141+
72142
## Quick Start
73143

74144
1. **Fork this repo** or use it as a template inside your organization.

0 commit comments

Comments
 (0)