Skip to content

Commit

Permalink
chore: adjust ci for rust services, merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkakkar committed Jun 11, 2024
1 parent b43108d commit ee6cd6d
Show file tree
Hide file tree
Showing 243 changed files with 5,309 additions and 3,772 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
push:
branches:
- master
paths-ignore:
- 'rust/**'

jobs:
slack:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-hog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
# If this run wasn't initiated by the bot (meaning: snapshot update) and we've determined
# there are backend changes, cancel previous runs
- uses: n1hility/cancel-previous-runs@v3
if: github.actor != 'posthog-bot' && needs.changes.outputs.backend == 'true'
if: github.actor != 'posthog-bot' && needs.changes.outputs.hog == 'true'
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
65 changes: 41 additions & 24 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
push:
branches:
- master
paths-ignore:
- 'rust/**'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -120,17 +122,22 @@ jobs:
- name: Trigger Batch Exports Temporal Worker Cloud deployment
if: steps.check_changes_batch_exports_temporal_worker.outputs.changed == 'true'
uses: mvasigh/dispatch-action@main
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.deployer.outputs.token }}
repo: charts
owner: PostHog
event_type: temporal_worker_deploy
message: |
repository: PostHog/charts
event-type: commit_state_update
client-payload: |
{
"image_tag": "${{ steps.build.outputs.digest }}",
"worker_name": "temporal-worker",
"context": ${{ toJson(github) }}
"values": {
"image": {
"sha": "${{ steps.build.outputs.digest }}"
}
},
"release": "temporal-worker",
"commit": ${{ toJson(github.event.head_commit) }},
"repository": ${{ toJson(github.repository) }},
"labels": ${{ steps.labels.outputs.labels }}
}
- name: Check for changes that affect general purpose temporal worker
Expand All @@ -140,17 +147,22 @@ jobs:
- name: Trigger General Purpose Temporal Worker Cloud deployment
if: steps.check_changes_general_purpose_temporal_worker.outputs.changed == 'true'
uses: mvasigh/dispatch-action@main
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.deployer.outputs.token }}
repo: charts
owner: PostHog
event_type: temporal_worker_deploy
message: |
repository: PostHog/charts
event-type: commit_state_update
client-payload: |
{
"image_tag": "${{ steps.build.outputs.digest }}",
"worker_name": "temporal-worker-general-purpose",
"context": ${{ toJson(github) }}
"values": {
"image": {
"sha": "${{ steps.build.outputs.digest }}"
}
},
"release": "temporal-worker-general-purpose",
"commit": ${{ toJson(github.event.head_commit) }},
"repository": ${{ toJson(github.repository) }},
"labels": ${{ steps.labels.outputs.labels }}
}
- name: Check for changes that affect data warehouse temporal worker
Expand All @@ -160,15 +172,20 @@ jobs:
- name: Trigger Data Warehouse Temporal Worker Cloud deployment
if: steps.check_changes_data_warehouse_temporal_worker.outputs.changed == 'true'
uses: mvasigh/dispatch-action@main
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.deployer.outputs.token }}
repo: charts
owner: PostHog
event_type: temporal_worker_deploy
message: |
repository: PostHog/charts
event-type: commit_state_update
client-payload: |
{
"image_tag": "${{ steps.build.outputs.digest }}",
"worker_name": "temporal-worker-data-warehouse",
"context": ${{ toJson(github) }}
"values": {
"image": {
"sha": "${{ steps.build.outputs.digest }}"
}
},
"release": "temporal-worker-data-warehouse",
"commit": ${{ toJson(github.event.head_commit) }},
"repository": ${{ toJson(github.repository) }},
"labels": ${{ steps.labels.outputs.labels }}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: Build container images
on:
workflow_dispatch:
push:
paths:
- 'rust/**'
branches:
- 'main'
- 'master'

jobs:
build:
Expand All @@ -22,9 +24,19 @@ jobs:
contents: read # allow reading the repo contents
packages: write # allow push to ghcr.io

defaults:
run:
working-directory: rust

steps:
- name: Check Out Repo
# Checkout project code
# Use sparse checkout to only select files in rust directory
# Turning off cone mode ensures that files in the project root are not included during checkout
uses: actions/checkout@v3
with:
sparse-checkout: 'rust/'
sparse-checkout-cone-mode: false

- name: Set up Depot CLI
uses: depot/setup-action@v1
Expand All @@ -41,6 +53,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -49,7 +62,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/posthog/hog-rs/${{ matrix.image }}
images: ghcr.io/posthog/posthog/${{ matrix.image }}
tags: |
type=ref,event=pr
type=ref,event=branch
Expand All @@ -65,8 +78,8 @@ jobs:
id: docker_build
uses: depot/build-push-action@v1
with:
context: ./
file: ./Dockerfile
context: ./rust/
file: ./rust/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: Build hook-migrator docker image
on:
workflow_dispatch:
push:
paths:
- 'rust/**'
branches:
- 'main'
- 'master'

permissions:
packages: write
Expand All @@ -18,9 +20,19 @@ jobs:
contents: read # allow reading the repo contents
packages: write # allow push to ghcr.io

defaults:
run:
working-directory: rust

steps:
- name: Check Out Repo
# Checkout project code
# Use sparse checkout to only select files in rust directory
# Turning off cone mode ensures that files in the project root are not included during checkout
uses: actions/checkout@v3
with:
sparse-checkout: 'rust/'
sparse-checkout-cone-mode: false

- name: Set up Depot CLI
uses: depot/setup-action@v1
Expand Down Expand Up @@ -61,8 +73,8 @@ jobs:
id: docker_build_hook_migrator
uses: depot/build-push-action@v1
with:
context: ./
file: ./Dockerfile.migrate
context: ./rust/
file: ./rust/Dockerfile.migrate
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
Loading

0 comments on commit ee6cd6d

Please sign in to comment.