Skip to content
Open
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
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ jobs:
- build
env:
publish: ${{contains(fromJSON('["push", "release"]'), github.event_name)}}
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- uses: actions/checkout@v7

Expand Down Expand Up @@ -184,3 +186,18 @@ jobs:
if: ${{ fromJSON(env.publish) }}
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

smoke-test:
name: Smoke test published image
needs:
- merge
if: github.event_name == 'release'
uses: ./.github/workflows/smoke-test.yml
with:
version: ${{ needs.merge.outputs.version }}
secrets:
CS_VAULT_CLIENT_ID: ${{ secrets.CS_VAULT_CLIENT_ID }}
CS_VAULT_CLIENT_KEY: ${{ secrets.CS_VAULT_CLIENT_KEY }}
CS_VAULT_CLIENT_ACCESS_KEY: ${{ secrets.CS_VAULT_CLIENT_ACCESS_KEY }}
CS_VAULT_WORKSPACE_CRN: ${{ secrets.CS_VAULT_WORKSPACE_CRN }}
SLACK_NOTIFICATION_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }}
97 changes: 97 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Smoke test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor This workflow sets no permissions:, so the job runs a pulled image and the test code with the default-scope GITHUB_TOKEN, which actions/checkout keeps in .git/config. The job only needs permissions: contents: read, and a called workflow may narrow the token.

Source: company-skills:rust-security · claude-opus-5-5


Generated by Claude Code


# Runs the integration suite against a published Proxy image instead of one built from source.
# `release.yml` calls it after a release's image is published.
# A pull request that changes this workflow runs it against the `latest` published image.
on:
workflow_call:
inputs:
version:
description: Published image version to test, such as 3.1.1
required: true
type: string
secrets:
CS_VAULT_CLIENT_ID:
required: true
CS_VAULT_CLIENT_KEY:
required: true
CS_VAULT_CLIENT_ACCESS_KEY:
required: true
CS_VAULT_WORKSPACE_CRN:
required: true
SLACK_NOTIFICATION_WEBHOOK_URL:
required: false
pull_request:
branches:
- main
paths:
- '.github/workflows/smoke-test.yml'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor The path filter lists only this file. A change to the PROXY_IMAGE branch in mise.toml or to the image and pull_policy coupling in tests/docker-compose.yml never runs this path before the next release. Add mise.toml and tests/docker-compose.yml, after fixing the latest mismatch at line 32, or this trigger will fail more often.

Sources: code-review, mattpocock-skills:code-review · claude-opus-5-5


Generated by Claude Code


permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
smoke-test:
name: Smoke test cipherstash/proxy:${{ inputs.version || 'latest' }} (PostgreSQL ${{ matrix.pg_version }})
runs-on: blacksmith-16vcpu-ubuntu-2204

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor Only the amd64 image is smoke tested: this runner is x86_64, and both pulls omit --platform. The arm64 image that release.yml:42 publishes is never run, so an arm64-only packaging fault ships green. Add an architecture axis to the matrix, using blacksmith-16vcpu-ubuntu-2404-arm (already used by merge) with linux/arm64.

Sources: code-review, mattpocock-skills:code-review · claude-opus-5-5


Generated by Claude Code

strategy:
fail-fast: false
matrix:
pg_version: [14, 15, 16, 17] # PG 18 not currently supported
env:
PG_VERSION: ${{ matrix.pg_version }}
PROXY_IMAGE: cipherstash/proxy:${{ inputs.version || 'latest' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

major On pull_request, this runs the PR's own integration tests against the released latest, so it fails as soon as main has a test for behaviour that is not yet released. That already happened between v3.1.0 and v3.1.1: log_redaction.rs expected a startup warning that 3.1.0 does not emit. On pull_request, check out the latest release's tag (actions/checkout with ref: v<version>), or test cipherstash/proxy:main.

Sources: code-review, mattpocock-skills:code-review · claude-opus-5-5


Generated by Claude Code

CS_ZEROKMS_HOST: https://us-east-1.aws.zerokms.cipherstashmanaged.net
CS_CTS_HOST: https://ap-southeast-2.aws.cts.cipherstashmanaged.net
timeout-minutes: 30

steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-test

- name: Decrypt secrets
uses: cipherstash/secrets-action@main
with:
secrets-file: .github/secrets.env.encrypted
env:
CS_CLIENT_ID: ${{ secrets.CS_VAULT_CLIENT_ID }}
CS_CLIENT_KEY: ${{ secrets.CS_VAULT_CLIENT_KEY }}
CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_VAULT_CLIENT_ACCESS_KEY }}
CS_WORKSPACE_CRN: ${{ secrets.CS_VAULT_WORKSPACE_CRN }}

- name: Show the image under test
run: |
docker pull --quiet "${PROXY_IMAGE}"
docker image inspect "${PROXY_IMAGE}" --format '{{index .RepoDigests 0}} {{.Created}}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor The digest printed here comes from the first pull only. Every later proxy:up resolves the mutable tag again, so if latest moves during a pull-request run, later steps test a different image under the printed digest. Resolve the tag to its digest once and export it, for example echo "PROXY_IMAGE=$(docker image inspect "$PROXY_IMAGE" --format '{{index .RepoDigests 0}}')" >> "$GITHUB_ENV".

Source: code-review · claude-opus-5-5


Generated by Claude Code


- run: |
mise run postgres:up --extra-args "--detach --wait"

- name: Run integration tests against the published image
env:
RUST_BACKTRACE: "1"
run: |
mise run --output prefix test:integration

- name: Show proxy logs on failure

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

major A failed smoke test alerts nobody. The image is already published by then, and the only signal is a red job in the release run. Copying send-slack-notification from test.yml would not help, because that action is gated on github.ref == 'refs/heads/main' and a release run's ref is refs/tags/vX.Y.Z. Add a Slack step with if: failure() and no ref gate.

Sources: code-review, mattpocock-skills:code-review · claude-opus-5-5


Generated by Claude Code

if: failure()
run: |
docker logs --timestamps proxy 2>&1 || true
docker logs --timestamps proxy-tls 2>&1 || true

# The image is already published, so say so. Not the shared send-slack-notification
# action: it only fires on main, and a release run's ref is the tag.
- name: Notify Slack on failure
if: failure() && github.event_name == 'release'
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": ":alert::alert::alert:\n\nSmoke test failed for the published image `${{ env.PROXY_IMAGE }}`.\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>",
"channel": "#engineering"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }}
15 changes: 13 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ Running Proxy in a container cross-compiles a binary for Linux and the current a
We cross-compile binary outside the container because it's generally faster, due to packages already being cached, and slower network and disk IO in Docker.

> [!IMPORTANT]
> **Proxy must always be built from source for testing.** The `proxy:up` task builds a binary from source (`build:binary`), packages it into a Docker image tagged `cipherstash/proxy:latest` (`build:docker`), then starts it via `docker compose up`. The `tests/docker-compose.yml` file uses `pull_policy: never` on the proxy services to ensure Docker never pulls the released image from Docker Hub. If you see an error like `pull access denied` or `image not found`, run `mise run build` first to build the local image.
> **Proxy is built from source for testing, unless `PROXY_IMAGE` is set** (see [Integration tests](#integration-tests)). The `proxy:up` task builds a binary from source (`build:binary`), packages it into a Docker image tagged `cipherstash/proxy:latest` (`build:docker`), then starts it via `docker compose up`. The `tests/docker-compose.yml` file uses `pull_policy: never` on the proxy services to ensure Docker never pulls the released image from Docker Hub. If you see an error like `pull access denied` or `image not found`, run `mise run build` first to build the local image.
> The released-image RSS rig is the one exception: it measures published images on purpose, so it pulls them.
> See [`packages/cipherstash-proxy-burn-in/README.md`](packages/cipherstash-proxy-burn-in/README.md).

Expand Down Expand Up @@ -460,6 +460,17 @@ Integration tests are defined in `tests/tasks/test/`.

Integration tests verify behaviour from a PostgreSQL client (`psql`), to Proxy (running in a container), to a PostgreSQL instance (running in a container).

By default `mise run proxy:up` builds the Proxy image from source, so the tests run against your working tree.
To run them against a published image instead, set `PROXY_IMAGE`:

```bash
PROXY_IMAGE=cipherstash/proxy:3.1.1 mise run test:integration
```

`proxy:up` then pulls that image if it isn't already present locally, tags it as `cipherstash/proxy:latest`, the image `tests/docker-compose.yml` runs, and skips the build.
The test clients still come from your checkout, so check out the release's tag to test it with its own tests.
After a release is published, `release.yml` runs this suite against the new image in the `Smoke test published image` job.

The integration tests have several runtime dependencies:

- Running PostgreSQL instances (that can be started with `mise run postgres:up`)
Expand Down Expand Up @@ -545,7 +556,7 @@ This project uses `docker compose` to manage containers and networking.

The configuration for those containers is in `tests/docker-compose.yml`.

The proxy services in `tests/docker-compose.yml` use `pull_policy: never` to ensure Docker never pulls the released `cipherstash/proxy:latest` image from Docker Hub. The image must be built locally from source via `mise run proxy:up` (or `mise run build`). This guarantees integration tests always run against the current source code.
The proxy services in `tests/docker-compose.yml` use `pull_policy: never` to ensure Docker never pulls the released `cipherstash/proxy:latest` image from Docker Hub. The image is built locally from source via `mise run proxy:up` (or `mise run build`), so integration tests run against the current source code. With `PROXY_IMAGE` set, `proxy:up` pulls that published image and tags it as `cipherstash/proxy:latest` instead.

The integration tests use the `proxy:up` and `proxy:down` commands documented above to run containers in different configurations.

Expand Down
16 changes: 11 additions & 5 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ set -e
{% set target = target_arch ~ "-unknown-linux-gnu" %}
{% set docker_platform = "linux/" ~ arch() | replace(from="x64", to="amd64") %}

# build a binary
mise run build:binary --target {{target}}

# build a new container
mise run build:docker --platform {{docker_platform}}
if [ -n "${PROXY_IMAGE:-}" ]; then
# Test a published image instead of building from source.
# tests/docker-compose.yml never pulls, so tag the image as the one it runs.
# Pull only when missing: test:integration calls proxy:up many times.
echo "Using published image: ${PROXY_IMAGE}"
docker image inspect "${PROXY_IMAGE}" >/dev/null 2>&1 || docker pull --quiet "${PROXY_IMAGE}"
docker tag "${PROXY_IMAGE}" cipherstash/proxy:latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor This leaves the published image tagged as the local cipherstash/proxy:latest after the run. A later POOLERS_SKIP_BUILD=1 mise run test:poolers, or the manual release:docker task, then uses or pushes it as if it were a source build. Tag a dedicated name and parameterise the compose image:, or remove the tag in proxy:down.

Sources: code-review, mattpocock-skills:code-review · claude-opus-5-5


Generated by Claude Code

else
mise run build:binary --target {{target}}
mise run build:docker --platform {{docker_platform}}
fi

# Make the default invocation with `mise run proxy:up` work.
# The default mise environment configuration works for Proxy running as a process, connecting via a port forward.
Expand Down
8 changes: 4 additions & 4 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ services:

proxy:
image: cipherstash/proxy:latest
# Never pull from Docker Hub. The proxy image must be built from source
# via `mise run proxy:up` (which runs build:binary + build:docker).
# This ensures integration tests always run against the current source,
# not the released version on Docker Hub.
# Never pull from Docker Hub. `mise run proxy:up` builds this image from
# source (build:binary + build:docker), so integration tests run against
# the current source. With PROXY_IMAGE set, proxy:up instead pulls that
# published image and tags it as cipherstash/proxy:latest.
pull_policy: never
container_name: proxy
ports:
Expand Down
Loading