Skip to content

Deploy Linear Triage to Cloud Run

Category AI Solutions Engineering
Status ๐ŸŸก Partially completed
Repo nextwork-deploy-linear-triage-to-cloud-run
Original NextWork guide nextwork.ai

Learning project

Practice work following a NextWork guide, separate from my production projects.

๐Ÿ“š NextWork learning project. This is a practice project I built while working through NextWork's Deploy Linear Triage to Cloud Run guide. It is part of my Learning portfolio and is fully separate from my production projects.

Category: Learning โ€บ AI Solutions Engineering
Status: ๐ŸŸก Partially completed

Overview

A deployed webhook is a public door, so it has to prove each request is genuine and fresh before doing anything. I put the triage sync behind signature, timestamp and replay checks, and packaged it the way a serverless container platform expects.

Summary

I packaged my triage sync as a container-ready webhook service and ran the real image locally with Docker instead of deploying to Cloud Run, so there's no Google Cloud project or billing. The service reads PORT from the environment, runs under gunicorn as a non-root user (uid 10001), has a /healthz check and takes every secret from environment variables. Each webhook must carry an HMAC-SHA256 signature over a timestamp and the body. Stale timestamps, wrong secrets, tampered bodies and replays are refused, and tracker failures come back as 502. The end-to-end run builds the 134 MB image and starts it beside my local tracker mock. Results: signed 200 (created), replay 409, wrong secret 401, tampered 401, old timestamp 401, and a fresh delivery of the same report 200 as a duplicate. Partial: no Cloud Run deployment, Secret Manager or real Linear workspace.

The checks behind this are in docs/verification.txt.

Skills & tools

Python, Flask, Docker, gunicorn, HMAC webhooks, Container security

What I built

  • service.py: /healthz and /webhook (timestamp window, HMAC check, replay guard, JSON validation, sync, 502 on tracker errors).
  • triage_sync.py and mock_linear.py: the triage and GraphQL sync from my tracker project, and the local tracker stand-in for testing.
  • Dockerfile, requirements.txt, .dockerignore: a slim image running gunicorn as a non-root user on $PORT.
  • tests/e2e.sh and tests/send.py: build, run, and six signed, unsigned, tampered and replayed deliveries. docs/e2e-run.txt is the output.

How to run

PY=python3 sh tests/e2e.sh
# real deploy would need: an image registry, WEBHOOK_SECRET / TRACKER_KEY from a secret store, TRACKER_URL

Verification

I ran the verification command on 2026-12-03. The full output is in docs/verification.txt.

PY=/workspace/nextwork-portfolio/.venv/bin/python MP=5294 SP=8194 sh tests/e2e.sh > /tmp/deploy-e2e.txt 2>&1; tail -2 /tmp/deploy-e2e.txt; grep 'DEPLOY E2E OK' /tmp/deploy-e2e.txt > /dev/null && echo DEPLOY OK

Notes

The replay guard is an in-memory set, so it only protects one instance. With several instances or a restart, a replay inside the 5-minute window could get through. The fingerprint check still stops it creating a duplicate issue, but a shared store would be the proper fix.

What isn't done, and why

Not deployed: no Google Cloud project, Cloud Run service, Artifact Registry or Secret Manager (that would mean a new account and possible spend). The image ran locally with Docker, and the tracker is my mock, not Linear.


Original project: https://nextwork.ai/projects/c28b3e09-d609-4648-bd35-e22af1ec2cfc ยท Part of my NextWork Learning portfolio (hub).

Verification output

From docs/verification.txt:

$ PY=/workspace/nextwork-portfolio/.venv/bin/python MP=5294 SP=8194 sh tests/e2e.sh > /tmp/deploy-e2e.txt 2>&1; tail -2 /tmp/deploy-e2e.txt; grep 'DEPLOY E2E OK' /tmp/deploy-e2e.txt > /dev/null && echo DEPLOY OK

same report again -> 200 {'report': 'Checkout API returns 500', 'result': 'duplicate of API-1'}
DEPLOY E2E OK
DEPLOY OK

[exit code 0]