Skip to content

chore: validate rendered compose and surface Portainer errors in staging deploy - #206

Merged
akandic47 merged 1 commit into
mainfrom
chore/staging-deploy-validation
Aug 31, 2026
Merged

akandic47 merged 1 commit into
mainfrom
chore/staging-deploy-validation

Conversation

@akandic47

Copy link
Copy Markdown

Description

Improves debuggability and safety of the staging Portainer deployment:

  • Validate docker-compose.rendered.yml with docker compose config -q before sending it to Portainer. A secret that corrupts the rendered YAML (e.g. a multi-line value) now fails fast in the render step, with validator output suppressed so no secret content can appear in public logs.
  • Log the Portainer HTTP status code on deploy instead of failing with a bare curl exit 22 (--fail discards the response), while still never printing the response body.
  • Drop stale SYG_RELAYER_COINMARKETCAPCONFIG_APIKEY from the envsubst list (secret removed in feat: replace coinmarketcap with pyth pricer #200).
  • Run the cleanup step with if: always() so the rendered file with secrets is removed even when the deploy fails.

Related Issue Or Context

Staging deploys were failing with Process completed with exit code 22 and no further information.

How Has This Been Tested? Testing details.

Render and validation logic exercised locally against deploy/docker-compose.staging.yml: a valid render passes, a multi-line secret value fails validation before the Portainer call, and no file content is printed in either case.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

…ing deploy

- validate docker-compose.rendered.yml with docker compose config before
  sending it to Portainer, failing early without printing the file
- log the Portainer HTTP status code instead of failing with a bare
  curl exit 22
- drop stale SYG_RELAYER_COINMARKETCAPCONFIG_APIKEY from envsubst
- always run cleanup so the rendered file is removed on failure
@github-actions

Copy link
Copy Markdown

Go Test coverage is 36.5 %\ ✨ ✨ ✨

@akandic47
akandic47 merged commit fad423c into main Aug 31, 2026
7 checks passed
@akandic47
akandic47 deleted the chore/staging-deploy-validation branch August 31, 2026 07:29
akandic47 added a commit that referenced this pull request Aug 31, 2026
## Problem

The staging deploy has been failing on the `Rendered docker-compose is
invalid` check added in #206 (e.g. [run
33368743093](https://github.com/sprintertech/sprinter-signing/actions/runs/33368743093/job/99414870056)).
The rendered compose file is actually valid — the check itself could
never succeed because the self-hosted runner is a container **without
docker**, so `docker compose config` fails for environmental reasons,
and the step suppressed all output, making it look like a compose
problem.

## Change

Replace the `docker compose config` check with a plain YAML parse using
`yq`:

```yaml
- name: Validate rendered docker-compose
  run: yq . docker-compose.rendered.yml > /dev/null
```

This catches the realistic failure mode (envsubst producing broken YAML
from a secret value) and prints the parse error with line/column to the
log on failure, while discarding stdout so the rendered file's secret
values are never echoed. Full compose-schema validation still
effectively happens at deploy time via the Portainer HTTP status check
from #206.

## Requires

`yq` in the actions-runner image:

```
sudo apt-get update && sudo apt-get install -y curl jq git gettext yq
```

On the `ghcr.io/actions/actions-runner` base (Ubuntu 24.04, python3
preinstalled) this adds only `python3-yaml python3-argcomplete
python3-toml python3-xmltodict yq`.

## Verification

Tested in a clean `ubuntu:24.04` container against renders of
`deploy/docker-compose.staging.yml` (with dummy secret values):
- valid render → exit 0, no output
- render broken by a multiline secret → exit 1, `could not find expected
':' in ..., line 19, column 6`
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.

3 participants