From 8ebe95c24576048339a8b3c84bb42b1119045aa4 Mon Sep 17 00:00:00 2001 From: Eddie Mattia Date: Mon, 13 Apr 2026 11:58:45 -0700 Subject: [PATCH 1/2] mod actions policy --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8b4a8a6..0720e0e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,8 @@ name: Deploy Project on: push: - branches: [main] pull_request: + types: [closed] branches: [main] permissions: From 5a5b618066b71af4baefa5e636d6d16272011367 Mon Sep 17 00:00:00 2001 From: Eddie Mattia Date: Mon, 13 Apr 2026 12:13:56 -0700 Subject: [PATCH 2/2] refine docs --- README.md | 31 +++++++++++++------------------ TESTING.md | 6 +++--- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9232986..b09b733 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,23 @@ -# Prod-Only Event Triggering Example - +# Branch-specific event triggering example Demonstrates how to configure Outerbounds project flows to respond to external -events and schedules, with **only the prod (main branch) version** reacting to +events and schedules, with branch-specific behavior for events, +in this case **only the prod (main branch) version** reacting to external signals. -## The Pattern +## Quickstart instructions +- Create a GitHub repository +- Create a GitHub Actions machine user in the Outerbounds UI named `prod-event-example-cicd` with info for your GitHub org +- Push this repository to your fork/copy of this repository, you should then see a GitHub action and results of `obproject-deploy` +- Continue [testing](./TESTING.md) + +## The pattern in context | Decorator | Branch behavior | Use when | |---|---|---| | `@schedule(cron=...)` | Each branch gets its own CronWorkflow (isolated, cleaned up on teardown) | You want periodic runs | | `@project_trigger(event=...)` | Sensor scoped to `prj...` — **prod-only by default** when external publishers target the main branch event | External systems should only trigger prod | | `@trigger_on_finish(flow=...)` | Already branch-scoped — works out of the box | Flow chaining within the same project | -| `@trigger(event=...)` | **NOT** branch-scoped — all branches react to the same event | Avoid for prod-only use cases | +| `@trigger(event=...)` | 🚨 **NOT** branch-scoped — all branches react to the same event | Avoid for branch-specific use cases | ## Flows @@ -29,6 +35,7 @@ sensor listens for: ``` prj.prod_event_example.main.external_signal +prj... ``` When deployed on a feature branch `feature/foo`, the sensor listens for: @@ -60,16 +67,4 @@ from metaflow.integrations import ArgoEvent ArgoEvent("prj.prod_event_example.main.external_signal").safe_publish( payload={"record_count": 100} ) -``` - -## CI/CD (GitHub Actions) - -The `.github/workflows/deploy.yml` deploys on push to main and on PRs: -- **main branch** → creates prod workflow templates, CronWorkflows, and Sensors -- **feature branches** (via PR) → creates isolated test deployments (own schedules, own sensors) -- **branch teardown** (on merge/delete) → removes all branch-specific Argo resources - -### Prerequisites - -1. Create a GitHub Actions machine user in the Outerbounds UI named `prod-event-example-cicd` -2. Ensure `id-token: write` permission is set (already in the workflow) +``` \ No newline at end of file diff --git a/TESTING.md b/TESTING.md index f8266dd..542dda4 100644 --- a/TESTING.md +++ b/TESTING.md @@ -116,8 +116,8 @@ from obproject.project_events import ProjectEvent ProjectEvent( "external_signal", project="prod_event_example", - branch="feature_test_isolation", -).safe_publish(payload={"record_count": 999}) + branch="feature_test", +).publish(payload={"record_count": 999}) ``` ### Expected results @@ -135,7 +135,7 @@ This confirms full bidirectional isolation. ```bash git checkout main -obproject-deploy --teardown --branch feature/test-isolation +outerbounds flowproject teardown-branch --id feature/test-isolation ``` ### Verify cleanup