Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ brain.code-workspace

# Fixture validation reports and captured disposable quickstart output.
test/skills/reports/

# Shared repositories fetched to materialize fixture expected-output baselines.
test/skills/*/.shared-dependencies/
128 changes: 96 additions & 32 deletions core/skills/rh-qs-test-suite/SKILL.md

Large diffs are not rendered by default.

170 changes: 170 additions & 0 deletions core/skills/rh-qs-test-suite/references/build-and-push-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Canonical local reference for rh-qs-test-suite image publishing.
# Adapt Make target names, variable names, REGISTRY, and toolchain setup to the
# quickstart's Makefile and README. Set IMAGE_REPOSITORIES to every image
# repository built by build-all-images, using fully qualified registry names.
# This workflow is self-contained; it is not a reusable workflow.
name: Build and push images

on:
push:
branches:
- main
- dev
workflow_dispatch:
inputs:
target_branch:
description: Branch whose images should be built
required: true
default: main
type: choice
options:
- main
- dev
force_build_all:
description: Build and publish every image even when the optional Make target says none are needed
required: true
default: 'FALSE'
type: choice
options:
- 'FALSE'
- 'TRUE'

concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ inputs.target_branch || github.ref_name }}
cancel-in-progress: false
queue: max

permissions:
contents: read

env:
REGISTRY: quay.io/rh-ai-quickstart
FORCE_BUILD_ALL: ${{ inputs.force_build_all || 'FALSE' }}
IMAGE_REPOSITORIES: "quay.io/rh-ai-quickstart/replace-with-image-name" # Space-separated; include every image built by the Makefile.
UV_VERSION: "0.8.9" # Replace with the quickstart's Makefile value when uv is used.
PYTHON_VERSION: "3.12" # Replace with the quickstart's required Python version.

jobs:
build-and-push:
if: github.repository_owner == 'rh-ai-quickstart' && github.event.repository.fork == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ inputs.target_branch || github.sha }}

- name: Check whether image publishing is needed
id: image-check
run: |
MAKE_STATUS=0
MAKE_DATABASE="$(make -qp 2>/dev/null)" || MAKE_STATUS=$?
if [ "${MAKE_STATUS}" -gt 1 ]; then
echo "Unable to inspect Makefile targets (make exited ${MAKE_STATUS})." >&2
exit "${MAKE_STATUS}"
fi

if grep -Eq '^build-push-images-needed::?([[:space:]]|$)' <<< "${MAKE_DATABASE}"; then
echo "Found build-push-images-needed; checking whether images need publishing."
TARGET_STATUS=0
if make build-push-images-needed; then
TARGET_STATUS=0
else
TARGET_STATUS=$?
fi

if [ "${FORCE_BUILD_ALL}" = "TRUE" ]; then
echo "FORCE_BUILD_ALL=TRUE; building and publishing all images regardless of the optional target result."
echo "needed=true" >> "$GITHUB_OUTPUT"
elif [ "${TARGET_STATUS}" -eq 0 ]; then
echo "Image build and push are needed."
echo "needed=true" >> "$GITHUB_OUTPUT"
else
echo "Image build and push are not needed; skipping them."
echo "needed=false" >> "$GITHUB_OUTPUT"
fi
else
echo "No build-push-images-needed target found; proceeding with image publishing."
echo "needed=true" >> "$GITHUB_OUTPUT"
fi

- name: Extract image tags
id: version
if: steps.image-check.outputs.needed == 'true'
env:
TARGET_BRANCH: ${{ inputs.target_branch || github.ref_name }}
run: |
BASE_VERSION=$(make version)
if [[ ! "${BASE_VERSION}" =~ ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$ ]]; then
echo "make version must return a valid OCI tag (1-128 characters, starting with a letter, number, or underscore)." >&2
exit 1
fi
if [ "${TARGET_BRANCH}" = "main" ]; then
TAG_BASE="${BASE_VERSION}"
elif [ "${TARGET_BRANCH}" = "dev" ]; then
TAG_BASE="${BASE_VERSION}-dev"
else
echo "Unsupported target branch: ${TARGET_BRANCH}" >&2
exit 1
fi
COMMIT_SHA=$(git rev-parse HEAD)
VERSIONS="${TAG_BASE} ${TAG_BASE}-${COMMIT_SHA}"
if [ "${TARGET_BRANCH}" = "main" ]; then
VERSIONS="${VERSIONS} latest"
else
VERSIONS="${VERSIONS} dev"
fi
for TAG in ${VERSIONS}; do
if [[ ! "${TAG}" =~ ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$ ]]; then
echo "Derived image tag is not a valid OCI tag: ${TAG}" >&2
exit 1
fi
done
echo "versions=${VERSIONS}" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
if: steps.image-check.outputs.needed == 'true'
uses: docker/setup-buildx-action@v3

- name: Log in to Quay.io
if: steps.image-check.outputs.needed == 'true'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

# Include this step only if the quickstart uses uv, with versions from
# its Makefile and README. Add other required runtime setup as needed.
- name: Set up uv
if: steps.image-check.outputs.needed == 'true'
uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Build all images
if: steps.image-check.outputs.needed == 'true'
run: |
IFS=' ' read -ra VERSIONS <<< "${{ steps.version.outputs.versions }}"
VERSION="${VERSIONS[0]}" make build-all-images

- name: Push all images
if: steps.image-check.outputs.needed == 'true'
run: |
IFS=' ' read -ra VERSIONS <<< "${{ steps.version.outputs.versions }}"
VERSION="${VERSIONS[0]}" make push-all-images

- name: Tag pushed images
if: steps.image-check.outputs.needed == 'true'
env:
IMAGE_TAGS: ${{ steps.version.outputs.versions }}
run: |
IFS=' ' read -ra VERSIONS <<< "${IMAGE_TAGS}"
PRIMARY_TAG="${VERSIONS[0]}"
for IMAGE in ${IMAGE_REPOSITORIES}; do
for TAG in "${VERSIONS[@]:1}"; do
echo "Tagging ${IMAGE}:${PRIMARY_TAG} as ${IMAGE}:${TAG}"
docker buildx imagetools create --tag "${IMAGE}:${TAG}" "${IMAGE}:${PRIMARY_TAG}"
done
done
12 changes: 12 additions & 0 deletions core/skills/rh-qs-test-suite/references/bump-release.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"replacements": [
{
"rule": "makefile_base_version",
"paths": ["Makefile"]
},
{
"rule": "chart_app_version",
"paths": ["helm/Chart.yaml"]
}
]
}
Loading
Loading