Skip to content

feat: add container-structure-test action kickstart#1

Merged
ChristophShyper merged 10 commits intomasterfrom
copilot/create-github-action-for-container-test
Apr 12, 2026
Merged

feat: add container-structure-test action kickstart#1
ChristophShyper merged 10 commits intomasterfrom
copilot/create-github-action-for-container-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Implements a production-ready GitHub Action wrapping GoogleContainerTools/container-structure-test following the devops-infra action pattern. Supports all CST CLI inputs, exports key test stats as outputs, and ships a multi-arch (amd64/arm64) Alpine-based Docker image.

Dockerfile

  • Replaces Ubuntu base with alpine:3.21
  • Installs bash, curl, jq via apk --no-cache
  • Downloads the container-structure-test binary from GitHub Releases using TARGETARCH for multi-arch builds; binary version pinned via ARG CST_VERSION with a Renovate annotation for automatic updates

action.yml

Full input surface covering all CST test subcommand flags:

Category Inputs
Image source image, image_from_oci_layout, default_image_tag, ignore_ref_annotation
Config config (space- or newline-separated paths)
Driver driver, platform, runtime, force
Behaviour pull, save, quiet, no_color
Reporting output (text/json/junit), test_report, junit_suite_name, metadata
Debug debug

Outputs: total, passed, failed, exit_code

entrypoint.sh

  • Builds the CST command array from inputs; config paths split on both spaces and newlines via tr -s '[:space:]' ' '
  • Two execution paths: test_report set → CST writes to file, action cats it and parses JSON; test_report unset → output captured via tee, stats parsed per format (text: grep, json: jq, junit: grep XML attributes)
  • Exit code captured independently of the ERR trap so a failing test suite propagates correctly

README.md

Full API reference tables, four usage examples (basic, multi-config JSON, JUnit, TAR driver), and a test config YAML reference.

Example usage

- name: Run structure tests
  id: cst
  uses: devops-infra/container-structure-test@v1
  with:
    image: my-image:latest
    config: |
      tests/command-tests.yaml
      tests/file-tests.yaml
    output: json

- run: |
    echo "Passed ${{ steps.cst.outputs.passed }}/${{ steps.cst.outputs.total }}"
Original prompt

Using my style of https://github.com/devops-infra github actions create comprehensive github action serving https://github.com/googlecontainertools/container-structure-test. refer to docs to cover all inputs, export important outputs.
image must suport amd64 and arm64, like all my actions. use alpine as base image.

…d comprehensive CLI support

Agent-Logs-Url: https://github.com/devops-infra/container-structure-test/sessions/12a900b5-99e4-4bd0-865d-be7d8331c2ec

Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub action for container structure test Add comprehensive GitHub Action for container-structure-test (Alpine, multi-arch) Apr 11, 2026
Copilot AI requested a review from ChristophShyper April 11, 2026 19:38
@ChristophShyper ChristophShyper changed the title Add comprehensive GitHub Action for container-structure-test (Alpine, multi-arch) feat: add container-structure-test action kickstart Apr 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a production-ready Docker-based GitHub Action for running Google container-structure-test against images/OCI layouts, following the devops-infra action pattern.

Changes:

  • Implement CST wrapper in entrypoint.sh with full input validation, command construction, and metrics extraction as outputs.
  • Switch image to Alpine and install CST binary with checksum verification for multi-arch builds.
  • Add local build/smoke-test Task targets and bash unit tests for the entrypoint, plus smoke-test jobs in workflows.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
entrypoint.sh Builds/validates CST CLI args, runs CST, parses totals/passed/failed, exports outputs
Dockerfile Alpine-based image, installs bash/curl/jq, downloads CST per-arch + checksum verify
action.yml Defines action inputs/outputs and points to the published Docker image
Taskfile.docker.yml Adds local build + local run + smoke test helpers
Taskfile.cicd.yml Adds task test + test:entrypoint runner task
tests/test_entrypoint.sh Adds bash unit tests with a fake container-structure-test binary
tests/fixtures/local-image.yml Container-structure-test config to validate the built action image
.github/workflows/* Adds a post-job smoke-test stage to multiple workflows
.env.example Adds example env vars for Docker/GitHub publishing workflows
README.md Updates documentation for the new action (usage, inputs/outputs, local tasks)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile Outdated
Comment thread entrypoint.sh
Comment thread tests/test_entrypoint.sh Outdated
Comment thread entrypoint.sh
@ChristophShyper ChristophShyper marked this pull request as ready for review April 12, 2026 16:02
@ChristophShyper ChristophShyper merged commit 84ca2f8 into master Apr 12, 2026
4 checks passed
@ChristophShyper ChristophShyper deleted the copilot/create-github-action-for-container-test branch April 12, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants