Repository navigation
feat(release): automate verified OpenCode image publishing #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 4 commits into
main
from
ACM-47609/automate-opencode-image-releases
Oct 6, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
adb4c5d
feat(release): automate verified OpenCode image publishing
jnpacker 4019753
ci: add pull request lint and image build checks
jnpacker 3f8811b
fix: address PR security and review findings
jnpacker 477ec66
fix: use Semgrep alongside repository CodeQL setup
jnpacker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Python and shell lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out source | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: "3.14" | ||
|
|
||
| - name: Install pinned Ruff | ||
| run: python -m pip install "ruff==$(make --no-print-directory -s lint-version)" | ||
|
|
||
| - name: Run repository lint target | ||
| run: make lint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: Publish OpenCode image | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Build, verify, and promote OpenCode image | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: opencode-image-release-${{ github.repository }} | ||
| cancel-in-progress: false | ||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
| id-token: write | ||
| steps: | ||
| - name: Check out main with full history | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| ref: main | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Podman | ||
| run: | | ||
| if ! command -v podman >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y podman | ||
| fi | ||
| podman --version | ||
|
|
||
| - name: Build and push unprocessed squash-merge candidates | ||
| id: publish | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| QUAY_REPOSITORY_PATH: ${{ vars.QUAY_REPOSITORY_PATH }} | ||
| QUAY_ROBOT_USERNAME: ${{ vars.QUAY_ROBOT_USERNAME }} | ||
| QUAY_PUSH_TOKEN: ${{ secrets.QUAY_PUSH_TOKEN }} | ||
| run: python3 scripts/publish_image.py --stage publish | ||
|
|
||
| - name: Install KinD | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| run: | | ||
| curl -fsSLo kind-linux-amd64 https://kind.sigs.k8s.io/dl/v0.32.0/kind-linux-amd64 | ||
| # Expected digest is the GitHub Release API digest for the v0.32.0 | ||
| # linux/amd64 asset, pinned independently of kind.sigs.k8s.io. | ||
| echo "50030de23cf40a18505f20426f6a8506bedf13c6e509244bd1fa9463721b0f54 kind-linux-amd64" | sha256sum --check - | ||
| chmod +x kind-linux-amd64 | ||
| sudo mv kind-linux-amd64 /usr/local/bin/kind | ||
| kind version | ||
|
|
||
| - name: Run SCA audit for every candidate digest | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| env: | ||
| IMAGE_REFS: ${{ steps.publish.outputs.image_refs }} | ||
| run: | | ||
| set -euo pipefail | ||
| [[ -n "$IMAGE_REFS" ]] | ||
| candidate=0 | ||
| while IFS= read -r image_ref; do | ||
| [ -n "$image_ref" ] || continue | ||
| candidate=$((candidate + 1)) | ||
| echo "::group::SCA audit candidate $candidate — $image_ref" | ||
| podman run --rm --pull=always --entrypoint /bin/sh "$image_ref" -ec 'pip-audit --local' | ||
| echo "::endgroup::" | ||
| done <<< "$IMAGE_REFS" | ||
|
|
||
| - name: Run standalone container E2E for every candidate | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| env: | ||
| IMAGE_REFS: ${{ steps.publish.outputs.image_refs }} | ||
| run: | | ||
| [[ -n "$IMAGE_REFS" ]] | ||
| candidate=0 | ||
| while IFS= read -r image_ref; do | ||
| [ -n "$image_ref" ] || continue | ||
| candidate=$((candidate + 1)) | ||
| echo "::group::Standalone E2E candidate $candidate — $image_ref" | ||
| if python3 scripts/e2e_container.py --image-ref "$image_ref"; then | ||
| echo "::endgroup::" | ||
| else | ||
| result=$? | ||
| echo "::endgroup::" | ||
| exit "$result" | ||
| fi | ||
| done <<< "$IMAGE_REFS" | ||
|
|
||
| - name: Run KinD Pod E2E for every candidate | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| env: | ||
| IMAGE_REFS: ${{ steps.publish.outputs.image_refs }} | ||
| run: | | ||
| [[ -n "$IMAGE_REFS" ]] | ||
| candidate=0 | ||
| while IFS= read -r image_ref; do | ||
| [ -n "$image_ref" ] || continue | ||
| candidate=$((candidate + 1)) | ||
| echo "::group::KinD Pod E2E candidate $candidate — $image_ref" | ||
| if python3 scripts/e2e_kind_pod.py --image-ref "$image_ref" --cluster-name "agent-containers-$candidate"; then | ||
| echo "::endgroup::" | ||
| else | ||
| result=$? | ||
| echo "::endgroup::" | ||
| exit "$result" | ||
| fi | ||
| done <<< "$IMAGE_REFS" | ||
|
|
||
| - name: Install pinned cosign | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 | ||
| with: | ||
| cosign-release: v3.1.3 | ||
|
|
||
| - name: Sign each tested candidate digest with GitHub OIDC | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| env: | ||
| IMAGE_REFS: ${{ steps.publish.outputs.image_refs }} | ||
| QUAY_REPOSITORY_PATH: ${{ vars.QUAY_REPOSITORY_PATH }} | ||
| QUAY_ROBOT_USERNAME: ${{ vars.QUAY_ROBOT_USERNAME }} | ||
| QUAY_PUSH_TOKEN: ${{ secrets.QUAY_PUSH_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| authfile="${RUNNER_TEMP}/cosign-quay-auth.json" | ||
| docker_config="${RUNNER_TEMP}/cosign-docker-config" | ||
| mkdir -p "$docker_config" | ||
| printf '%s' "$QUAY_PUSH_TOKEN" | podman login \ | ||
| --authfile "$authfile" \ | ||
| --username "$QUAY_ROBOT_USERNAME" \ | ||
| --password-stdin quay.io | ||
| cp "$authfile" "$docker_config/config.json" | ||
| chmod 600 "$docker_config/config.json" | ||
| export DOCKER_CONFIG="$docker_config" | ||
| [[ -n "$IMAGE_REFS" ]] | ||
| while IFS= read -r image_ref; do | ||
| [ -n "$image_ref" ] || continue | ||
| echo "::group::Sign tested candidate — $image_ref" | ||
| cosign sign --yes "$image_ref" | ||
| echo "::endgroup::" | ||
| done <<< "$IMAGE_REFS" | ||
|
|
||
| - name: Promote tested candidate and publish release metadata | ||
| if: ${{ success() && steps.publish.outputs.published == 'true' }} | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| QUAY_REPOSITORY_PATH: ${{ vars.QUAY_REPOSITORY_PATH }} | ||
| QUAY_ROBOT_USERNAME: ${{ vars.QUAY_ROBOT_USERNAME }} | ||
| QUAY_PUSH_TOKEN: ${{ secrets.QUAY_PUSH_TOKEN }} | ||
| run: python3 scripts/publish_image.py --stage promote-and-push | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Security analysis | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| sast: | ||
| name: Semgrep SAST | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check out source | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install pinned Semgrep | ||
| run: python -m pip install semgrep==1.179.0 | ||
|
|
||
| - name: Scan Python source | ||
| run: semgrep scan --config p/python --error scripts tests | ||
|
|
||
| dependency-review: | ||
| name: Dependency review SCA | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| steps: | ||
| - name: Review dependency changes | ||
| uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 | ||
| with: | ||
| fail-on-severity: high |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: PR tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: Unit and contract tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out source | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: "3.14" | ||
|
|
||
| - name: Install test dependency | ||
| run: python -m pip install pytest | ||
|
|
||
| - name: Run Python tests | ||
| run: python -m pytest -q | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Check pinned toolchain wiring | ||
| run: bash tests/test_lsp_version_pinning.sh | ||
|
|
||
| - name: Check standalone provider secrets | ||
| run: bash tests/test_standalone_provider_secrets.sh | ||
|
|
||
| trusted-image-build: | ||
| name: Build image for trusted PRs | ||
| if: >- | ||
| github.event_name == 'pull_request' && | ||
| github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out PR source | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Podman | ||
| run: | | ||
| if ! command -v podman >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y podman | ||
| fi | ||
| podman --version | ||
|
|
||
| - name: Build image locally without pushing | ||
| run: >- | ||
| make build-opencode REGISTRY=localhost | ||
| IMAGE_TAG=pr-${{ github.event.number }} NOPROMPT=1 SAVE_DEFAULTS=0 | ||
|
|
||
| - name: Audit built image dependencies | ||
| run: >- | ||
| podman run --rm --entrypoint /bin/sh | ||
| localhost/opencode:pr-${{ github.event.number }} | ||
| -ec 'pip-audit --local' | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3b2b440b80f891d2e0ef5d552f53f35e45b08554 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.