Skip to content

Commit 09cad17

Browse files
committed
## [2.0.0] - 2025-12-09
### Added - Prebuilt runner image with `aio` - no CLI installation steps in the workflow.
1 parent 277d6a5 commit 09cad17

4 files changed

Lines changed: 111 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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,74 @@ If these variables are present, the workflow writes them to `.env` before runnin
6969

7070
---
7171

72+
### Runner image requirements
73+
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.
74+
75+
Dockerfile used by the workflow:
76+
77+
```
78+
FROM node:20-bullseye-slim
79+
80+
RUN apt-get update && apt-get install -y \
81+
git \
82+
ca-certificates \
83+
&& rm -rf /var/lib/apt/lists/*
84+
85+
RUN npm install -g @adobe/aio-cli && \
86+
npm cache clean --force && \
87+
rm -rf /root/.npm /tmp/*
88+
89+
WORKDIR /workspace
90+
91+
```
92+
Build and push the AMD64 image:
93+
```
94+
docker buildx build \
95+
--platform linux/amd64 \
96+
-t ghcr.io/<org-or-user>/aio-mesh-runner:latest \
97+
--push \
98+
-f .github/images/aio-mesh-runner/Dockerfile .
99+
```
100+
101+
Reference it in `deploy.yaml`:
102+
```
103+
jobs:
104+
deploy:
105+
runs-on: ${{ matrix.os }}
106+
container:
107+
image: ghcr.io/<org-or-user>/aio-mesh-runner:latest
108+
strategy:
109+
matrix:
110+
node-version: ["20"]
111+
os: [ubuntu-latest]
112+
# ...
113+
114+
```
115+
#### Why the API Mesh plugin is installed in the runner
116+
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:
117+
```
118+
- name: Install API Mesh plugin
119+
run: aio plugins:install @adobe/aio-cli-plugin-api-mesh
120+
121+
```
122+
This is required because:
123+
124+
- AIO plugins are resolved per user via the CLI config directory under `$HOME` (for example `~/.config/@adobe/aio`), not from a global shared path.
125+
- In GitHub container jobs, the runner forcibly sets `HOME=/github/home`, which is different from the `HOME` used at image build time (typically `/root`).
126+
- 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.
127+
128+
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.
129+
130+
**If you do not have such a runner image, use the 1.x version of this template, where:**
131+
132+
- The job runs directly on `ubuntu-latest` (no `container`: stanza).
133+
- `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`).
134+
135+
In short:
136+
137+
- 2.x template – requires a prebuilt runner image with `aio`; no CLI installation steps in the workflow.
138+
- 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.
139+
72140
## Quick Start
73141

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

0 commit comments

Comments
 (0)