Skip to content

Commit 9fa54fd

Browse files
committed
Take a test path for image verification, matching the sibling actions
run-tests and run-package-tests take a test-path and own the pytest invocation; passing a whole shell command was a vocabulary of its own and put the runner's uv incantation in the caller.
1 parent d9ec1cf commit 9fa54fd

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

.github/actions/ecr-build-push-pull/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ ECR is also used as the BuildKit layer cache.
1818
1919
## Verifying a freshly built image
2020
21-
Pass `verify-command` to assert against the image before it is published:
21+
Pass `verify-test-path` to assert against the image before it is published:
2222

2323
```yaml
24-
verify-command: uv run --no-project --with pytest python -m pytest -q docker/test/test_image_invariants.py
24+
verify-test-path: docker/test/test_image_invariants.py
2525
```
2626

27-
It runs only on a full build, with `IMAGE_TAG` and `IMAGE_DIGEST` exported. A failure fails the
28-
action with nothing pushed, so the next run rebuilds rather than serving the bad image from the
29-
deps cache. Exact-tag and deps-cache hits skip it: that image passed the command when it was built.
27+
The tests run only on a full build, with `IMAGE_TAG` and `IMAGE_DIGEST` set, so the caller's job
28+
needs `uv` (`astral-sh/setup-uv`). A failure fails the action with nothing pushed, so the next run
29+
rebuilds rather than serving the bad image from the deps cache. Exact-tag and deps-cache hits skip
30+
them: that image passed when it was built.
3031

3132
## ECR URL resolution order
3233

.github/actions/ecr-build-push-pull/action.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ inputs:
3737
description: Tag used for the ECR layer cache image (e.g. "cache-base", "cache-curobo").
3838
required: false
3939
default: 'cache'
40-
verify-command:
40+
verify-test-path:
4141
description: >
42-
Command run against a freshly built image, before it is tagged or pushed, with IMAGE_TAG
43-
and IMAGE_DIGEST exported. A failing command fails the action with nothing published, so
44-
the next run rebuilds instead of inheriting the bad image from the cache.
42+
Path to tests asserted against a freshly built image, before it is tagged or pushed. They
43+
run with IMAGE_TAG and IMAGE_DIGEST set; a failure fails the action with nothing published,
44+
so the next run rebuilds instead of inheriting the bad image from the cache.
4545
46-
Not run on an exact-tag or deps-cache hit: those serve an image that already passed this
47-
command when it was built.
46+
Not run on an exact-tag or deps-cache hit: those serve an image that already passed when it
47+
was built.
4848
required: false
4949
default: ''
5050
pull-on-deps-hit:
@@ -257,18 +257,19 @@ runs:
257257
# rebuilding it, so anything published unverified stays unverified.
258258
- name: Verify freshly built image
259259
if: >
260-
inputs.verify-command != '' &&
260+
inputs.verify-test-path != '' &&
261261
steps.pull-exact.outputs.hit != 'true' &&
262262
steps.deps-cache.outputs.deps-cache-hit != 'true'
263263
shell: bash
264264
env:
265265
IMAGE_TAG: ${{ inputs.image-tag }}
266-
VERIFY_COMMAND: ${{ inputs.verify-command }}
266+
TEST_PATH: ${{ inputs.verify-test-path }}
267267
run: |
268268
set -euo pipefail
269269
IMAGE_DIGEST="$(docker image inspect --format '{{.Id}}' "${IMAGE_TAG}")"
270270
export IMAGE_DIGEST
271-
bash -c "${VERIFY_COMMAND}"
271+
uv run --no-project --with pytest \
272+
python -m pytest -q "${TEST_PATH}"
272273
273274
- name: Tag built image with ECR-prefixed name
274275
if: >

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
isaacsim-version: ${{ needs.config.outputs.isaacsim_image_tag }}
219219
dockerfile-path: docker/Dockerfile.base
220220
cache-tag: cache-base
221-
verify-command: uv run --no-project --with pytest python -m pytest -q docker/test/test_image_invariants.py
221+
verify-test-path: docker/test/test_image_invariants.py
222222

223223
build-curobo:
224224
name: Build cuRobo Docker Image

docker/test/test_container_profiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def test_image_is_verified_before_it_is_published():
303303
assert names.index("Verify freshly built image") < names.index("Push to ECR") < names.index("Push deps tag")
304304

305305
build = (REPO_ROOT / ".github" / "workflows" / "build.yaml").read_text(encoding="utf-8")
306-
assert "verify-command: uv run" in build, "the base image job must hand its invariants to the action"
306+
assert "verify-test-path: docker/test/test_image_invariants.py" in build, "the base job must ask for them"
307307

308308

309309
def test_run_tests_links_isaac_sim_only_where_kit_is_installed():

0 commit comments

Comments
 (0)