---
name: "MOTSELL Compose Check"
description: "Compare two normalized Docker Compose snapshots before running a command step."
author: "motsell"
repo: "compose-check-buildkite-plugin"
stars: 0
official: false
---

# MOTSELL Compose Check Buildkite plugin

Compare two normalized Docker Compose configurations before a migration command runs. A different project name can change the physical volume names even when the YAML is identical. This plugin reports that change before the next command step can act on it.

The plugin bundles the offline [Compose Check 0.2.1 CLI](https://github.com/motsell/compose-check/tree/700ae9dd9f3cd492829bbfa56c79116f9e18d6cd). It reads two explicit local files. It does not run Docker, install packages, connect to servers, upload logs or restore data.

## Example

Use a trusted Linux or macOS Buildkite agent (v3.85 or newer) with Node.js 22 or newer. Prepare both JSON snapshots privately using `docker compose config --format json` in the source and destination projects. Remove private values; do not commit or upload snapshots containing credentials. The two files must already be present in the checkout directory before the pre-command hook starts.

```yaml
steps:
  - label: "Review migration configuration"
    command: "echo Configuration review finished"
    plugins:
      - motsell/compose-check#v0.1.0:
          source: migration/source.json
          destination: migration/destination.json
```

Review the release and pin its full commit SHA before using the plugin in a production pipeline. Use it only in trusted, operator-controlled jobs, not on untrusted pull requests or jobs that expose secrets to untrusted code.

## Configuration

- `source`: required checkout-relative path to the normalized source JSON.
- `destination`: required checkout-relative path to the normalized destination JSON.

Both must be regular files. Absolute paths, URLs, parent-directory paths and symlink components are rejected. The checker limits each input to 250,000 bytes and 80 services. It reports fixed findings and ordinal positions without printing service names, paths or private configuration values.

The pre-command hook returns `0` when no important review cues were found, `1` when there are important review cues and `2` for invalid inputs or a local failure. A nonzero result stops the command step. A successful comparison does not prove that the database has been restored or that the application will work on the destination.

For a concrete recovery exercise, see the [disposable PostgreSQL migration lab](https://github.com/motsell/compose-migration-lab/blob/2f3e97b5e1684c0e208893f24f2570750da4af8d/README.md). It verifies restored data after restart. The Compose Check comparison alone cannot do that.

## Tests

Run the executable hook tests with Node.js 22 or newer:

```sh
node --test test/hook.test.mjs
```

These are local tests of the actual hook entry point with synthetic input files and the Buildkite configuration environment. They do not require a Buildkite account or Docker.

MIT. The bundled CLI files are unchanged from the Compose Check commit linked above.