Skip to content

spdx-tools: gate the latest tag on smoke tests and document the image - #463

Open
officialasishkumar wants to merge 1 commit into
wolfi-dev:mainfrom
officialasishkumar:fix/spdx-tools-tests
Open

officialasishkumar wants to merge 1 commit into
wolfi-dev:mainfrom
officialasishkumar:fix/spdx-tools-tests

Conversation

@officialasishkumar

Copy link
Copy Markdown

Fixes #462

spdx-tools was the only image whose latest tag didn't depend on any oci_exec_test. If a build succeeded but produced a broken image, the nightly release would still tag it.

This adds images/spdx-tools/tests, laid out like the other images' tests, and makes the latest tag depends_on them. The tests check that:

  • Version runs and prints the tool version
  • the image runs as nonroot
  • a valid SPDX 2.3 JSON document passes Verify
  • Convert from JSON to tag-value works, and the output also passes Verify
  • Verify exits non-zero on an invalid document

The test document is written from the script instead of being checked in, because .gitignore excludes **/*.spdx.json.

It also adds a README for the image and lists it in the top-level README.

Testing: I ran terraform apply -target=module.spdx-tools against a local registry (aarch64). The image built, both tests passed, and latest was tagged. I also ran the script against a copy of the image with the JVM modules file deleted, and it failed (exit 1) as it should. terraform fmt -check is clean.

spdx-tools was the only image whose oci_tag did not depend on any
oci_exec_test, so a build that succeeded but produced a broken image
(e.g. a JRE packaging change or a broken tools-java launcher) would
still be tagged as ghcr.io/wolfi-dev/spdx-tools:latest by the nightly
release, and presubmit had nothing to run.

Add images/spdx-tools/tests, following the layout used by the other
images, with checks that:

- `Version` runs and prints the SPDX tool version
- the image runs as the nonroot user
- a valid SPDX 2.3 JSON document passes `Verify`
- `Convert` turns it into tag-value output that also passes `Verify`
- `Verify` exits non-zero for an invalid document

The test document is written from the script rather than checked in
because .gitignore excludes **/*.spdx.json.

The latest tag now depends on module.test-latest, like the other
images. Also add an images/spdx-tools README with usage examples and
list the image in the top-level README.

Fixes wolfi-dev#462

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spdx-tools: latest tag is published without any tests

1 participant