Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): skip the master ecr publish role where cd is disabled (#130899)

Georges-Antoine Assi8a193aacedb9
diff --git a/.github/workflows/cd-llm-analytics-image.yml b/.github/workflows/cd-llm-analytics-image.yml
index 263827621e8f..cb25f963cce3 100644
--- a/.github/workflows/cd-llm-analytics-image.yml
+++ b/.github/workflows/cd-llm-analytics-image.yml
@@ -64,7 +64,8 @@ jobs:
steps:
- name: Assert default-branch publish role is configured
- if: github.ref == 'refs/heads/master'
+ # Only the repo with CD_DEPLOY_ENABLED publishes master images; elsewhere master builds without pushing.
+ if: github.ref == 'refs/heads/master' && vars.CD_DEPLOY_ENABLED == 'true'
env:
DEFAULT_BRANCH_ROLE: ${{ secrets.AWS_ECR_SHARED_SERVICES_POSTHOG_MASTER_PUBLISH_IAM_ROLE }}
run: |
diff --git a/.github/workflows/cd-mcp-image.yml b/.github/workflows/cd-mcp-image.yml
index ced023e81da4..dd36072c37e6 100644
--- a/.github/workflows/cd-mcp-image.yml
+++ b/.github/workflows/cd-mcp-image.yml
@@ -59,10 +59,10 @@ jobs:
uses: ./.github/actions/docker-meta
with:
image-name: posthog-mcp
- # Publishes only from the default branch — assume the role and touch ECR only there;
+ # Publishes only from the default branch of the repo with CD_DEPLOY_ENABLED — assume the role and touch ECR only there;
# labeled PRs still build (push=false) without assuming it.
aws-role-to-assume: ${{ secrets.AWS_ECR_SHARED_SERVICES_POSTHOG_MASTER_PUBLISH_IAM_ROLE }}
- push-to-ecr: ${{ github.ref == 'refs/heads/master' }}
+ push-to-ecr: ${{ github.ref == 'refs/heads/master' && vars.CD_DEPLOY_ENABLED == 'true' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKERHUB_USER }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/livestream-docker-image.yml b/.github/workflows/livestream-docker-image.yml
index a17e009fcc4f..1c3c7cc5aeea 100644
--- a/.github/workflows/livestream-docker-image.yml
+++ b/.github/workflows/livestream-docker-image.yml
@@ -43,7 +43,8 @@ jobs:
steps:
- name: Assert master publish role is configured
- if: github.ref == 'refs/heads/master'
+ # Only the repo with CD_DEPLOY_ENABLED publishes master images; elsewhere master builds without pushing.
+ if: github.ref == 'refs/heads/master' && vars.CD_DEPLOY_ENABLED == 'true'
env:
MASTER_ROLE: ${{ secrets.AWS_ECR_SHARED_SERVICES_POSTHOG_MASTER_PUBLISH_IAM_ROLE }}
run: |
diff --git a/.github/workflows/llm-gateway-cd.yml b/.github/workflows/llm-gateway-cd.yml
index cd42053c4063..17ec51f76bcb 100644
--- a/.github/workflows/llm-gateway-cd.yml
+++ b/.github/workflows/llm-gateway-cd.yml
@@ -37,10 +37,10 @@ jobs:
uses: ./.github/actions/docker-meta
with:
image-name: llm-gateway
- # Publishes only from the default branch — assume the role and touch ECR only there
+ # Publishes only from the default branch of the repo with CD_DEPLOY_ENABLED — assume the role and touch ECR only there
# (a non-default-branch workflow_dispatch builds nothing to push).
aws-role-to-assume: ${{ secrets.AWS_ECR_SHARED_SERVICES_POSTHOG_MASTER_PUBLISH_IAM_ROLE }}
- push-to-ecr: ${{ github.ref == 'refs/heads/master' }}
+ push-to-ecr: ${{ github.ref == 'refs/heads/master' && vars.CD_DEPLOY_ENABLED == 'true' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKERHUB_USER }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}