SeamTrailSeamTrail

Promotion rules and deploy gates

Say what must wait for what before code moves to the next environment, and let your CI ask SeamTrail before it deploys.

SeamTrail can answer one question for your CI: "May this go to this environment?"

It answers from what it already knows: which tickets wait on which, how far each ticket's code has gone, and your checklists.

Where code is

SeamTrail tracks how far each ticket's code has gone, by each team's own environments — the ones its repositories deploy to (Stage and Prod, or Dev, QA and Production…). See How work ships. There are no fixed "dev / stage / prod" words: the project card says "Stage 0 · Prod 23", a ticket says "on Prod", and the promotion rules below use the same environments.

A ticket never moves backwards.

Report deploys from your CI

  1. Open the repository's page: a team's Settings → Shipping → the repository. Under Deploy webhook, click Make a key. Copy the key now. It is shown only once.
  2. Copy the ready-made line from that page into your CI, after each deploy. It already has the repository's name and the team's environment names.

A repository's key reports deploys for that repository only; for any other it is refused. The team's Admins and Managers make it. The division also has one key that works for every repository, in the division's Settings → Tools → Deploy webhook.

The line sends four things: the repo (owner/name), the environment (one of the team's own, like Dev, Stage or Prod), the commit, and success or failure. Sending the same deploy twice is safe.

Creating a new key stops the old one at once.

Promotion rules

Promotion rules are extra deploy rules on top of the "blocked by" links in Jira and Notion. Each project has its own.

Dependencies. Make one thing wait for another:

  • Ticket → ticket: PAY-7 waits for PAY-4.
  • Team → team: the Frontend team waits for the Backend team.
    • Strict: wait until every upstream ticket reaches each environment.
    • Loose: wait only for the tickets it really depends on.

The teams you can pick are the project's teams: teams linked to it, teams with a folder in it, and the teams of its people. A ticket outside any team folder belongs to the team whose repository its code went into.

Each dependency either blocks the deploy or only warns.

Checklist. Steps to have done before each environment, like "feature flag configured". A step can cover the whole project, one team or one ticket. It is needed from a chosen environment upward. Nobody ticks a step.

A step a test can prove ticks itself. SeamTrail finds the build test that proves a step by the step's own words: "Independent verifier passes" is the test called verifier, a check on GitHub or a build status on Bitbucket. It looks at the tests on the project's repositories and pull requests, so the project needs its repository linked. When the test passes on the code going to an environment, SeamTrail ticks the step for that environment and says which test passed on which commit. When it fails, the step is open again and holds the deploy. A wrong match is removed with Not this test, and SeamTrail never makes it again. You can also name the test yourself when you add the step.

A step no test proves never holds a deploy. It shows Not seen done yet, as a heads-up. When a message, a ticket or a commit shows it was done ("told support about the new ladder"), SeamTrail marks it done and links that message.

Its repository, suggested. A project with no repository linked shows its likely one: the repository its teams ship from, one whose pull requests name its tickets, or one named like the project or its department. Click Link, or Not this.

Add a rule

On the project, click + Add memory and pick Dependency or Checklist. You can also ask the SeamTrail agent or your AI assistant.

Adding and changing rules needs the project's Admin or Manager role.

The deploy gate

Before a deploy, your CI asks SeamTrail. SeamTrail answers allow or block, with the reasons.

It blocks when:

  • a ticket waits for another ticket that has not reached this environment yet, or
  • a checklist step's test failed, or has not run yet, on this code (a step no test proves only warns).

A blocker that Jira or Notion says is Done, but whose code SeamTrail never saw, does not block. It becomes a warning: make sure its code is out.

Set how strict, per repo

Open the repository's page: a team's Settings → Shipping → the repository. Under Deploy rules, pick How strict:

ModeWhat happens
offNever blocks. The answer still lists what is not ready.
warn onlyNever blocks. Reports what is not ready.
blockStops the deploy until it is ready.

Every repo starts at off. The team's Admins and Managers change it, and so do division Admins and Managers. One repository has one set of rules: when two teams ship the same repository, its page says "Shared with" the other team, and either team's page changes the same rules.

Add the gate to your CI

Copy the snippet from the repository's page: a team's Settings → Shipping → the repository, under Ask before a deploy. It has the right address and the repository's name. It looks like this:

allow=$(curl -s "<gate address from SeamTrail>" \
  -H "Authorization: Bearer <your deploy key>" -H "content-type: application/json" \
  -d '{"repo":"owner/name","env":"stage","commit_sha":"'$COMMIT_SHA'"}' | jq -r .allow)
[ "$allow" = "true" ] || { echo "SeamTrail blocked this deploy"; exit 1; }

It works in any CI: GitHub Actions, Bitbucket Pipelines, Jenkins and others. You can also send a ticket key (ticket) or a branch name (ref).

The gate is a guard rail, not a lock

Your pipeline asks and obeys. Someone who can edit the pipeline can remove the check. For a hard lock, use your code host's branch protection or environment protection rules.

Pull request status (GitHub and Bitbucket)

Turn on SeamTrail check on pull requests on the repository's page: a team's Settings → Shipping → the repository, under Deploy rules. It is off until you turn it on.

SeamTrail then adds a check named SeamTrail to every pull request in that repo, next to your tests, like a code analysis tool does. On GitHub it is in the pull request's Checks tab, with every reason. On Bitbucket it is a build status plus a SeamTrail report beside the pull request (Code Insights). It says one of three things:

  • Ready for Prod: every ticket the pull request names is ready for the environment the merge reaches.
  • Ready for Prod, with a warning: ready, with something to look at, like a promotion rule set to warn.
  • Not ready for Prod, and the first reason: for example "SEAM-12 waits for SEAM-9".

Where the merge goes comes from the team's own branch rules for that repository. If the rules say a merge into main reaches Prod, the pull request is judged for Prod. With no rule for the branch, the default branch counts as dev.

Not ready means at least one of these:

  • a ticket waits for another ticket that has not reached that environment,
  • a checklist step for that environment is not ticked,
  • a ticket needs an update after a later decision or doc change (open drift),
  • someone recorded a blocker on a ticket.

No ticket mentioned. A pull request that mentions no ticket in its branch name, title or description is never held. It goes, and the check says Ready, with a warning: no ticket mentioned in this pull request, even when the repo blocks.

Red, grey or green. The check is red only when the repo's gate is set to block and the pull request is not ready. A warning is grey on GitHub, and green on Bitbucket (which has no grey). Ready is green. To stop a merge, make the SeamTrail check required: in GitHub's branch protection ("Require status checks to pass"), or in Bitbucket's merge checks ("Minimum successful builds"). A grey check does not stop a merge. Whether your plan can enforce this is up to GitHub or Bitbucket.

A comment only as a fallback. The reasons live in the check (GitHub) or the report (Bitbucket). SeamTrail writes a comment only when it cannot put them there, for example while the GitHub App still lacks the "Checks" permission. A comment written earlier is kept up to date.

Checked again on its own. When something changes for a ticket — a dependency or checklist step, a recorded blocker, drift, a deploy, its status or "blocked by" link in Jira or Notion — SeamTrail checks again, within about 20 seconds, the open pull requests that name that ticket or a ticket waiting for it. Changing the repository's own setting checks all its open pull requests again. Nothing else is checked again, and closed pull requests never are.

A ticket's own description never counts as a blocker on that ticket: it describes the problem the ticket fixes.

The check, the report and the comment use rule facts only: ticket keys, what they wait for, checklist steps, and that drift or a blocker exists. They never quote your chats, docs or decisions, because everyone who can see the repository reads them.

Set it up on GitHub

Nothing to paste. The SeamTrail GitHub App already sends pull requests. It needs the permissions Checks: Read and write (the full check) and Commit statuses: Read and write (a one-line status, used while Checks is missing). When GitHub asks, accept them for your account or organization.

Set it up on Bitbucket

Nothing to paste either, in most cases. When you turn the check on for a Bitbucket repo, SeamTrail adds its webhook to that repository itself, signed with your division's own secret. The repository's page says "Webhook added by SeamTrail", or why it could not.

If it could not (for example, the Bitbucket connection may not add webhooks), add it by hand. On the repository's page, click Add the webhook by hand. Then, in the Bitbucket repository:

  1. Open Repository settings → Webhooks → Add webhook.
  2. Paste the URL and the secret SeamTrail shows.
  3. Tick the events SeamTrail lists: pushes, and pull requests created, updated, approved, commented and merged.
  4. Save.

The secret is your division's own. A delivery without it is ignored.

The last pull request checked, and anything that stopped the check (like a missing permission), shows on the repository's page under Deploy rules.

On this page