Skip to content

Commit b38a051

Browse files
authored
[BLD] Update deploy automation to deploy control and data planes separately (#4917)
## Description of changes Updates the places in our GitHub Actions where we dispatch the `deploy.yaml` workflow in our internal repository to match the updates to its inputs. The deploy workflow was updated to take a single `plane` string value instead of a comma-separated `planes` input. The update on the other side is intended to affect the deployments to production to further reduce the likelihood that one of the planes is inadvertently deployed. Note: Rather than write the throw-away code on the other side to support both `plane` and `planes` inputs, I'm going to land this change shortly after landing the change in hosted, but there may be older versions of the `trigger-deploy.yaml` workflow that fail if they dispatch with the old `planes` input. ## Test plan Once this change lands, it will trigger a deploy and we will see if it works.
1 parent c441791 commit b38a051

File tree

3 files changed

+71
-51
lines changed

3 files changed

+71
-51
lines changed

.github/workflows/_deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Trigger deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
plane:
7+
description: 'Plane to deploy (control or data)'
8+
required: true
9+
type: string
10+
ignore-lock:
11+
description: 'Ignore lock file'
12+
required: false
13+
default: false
14+
type: boolean
15+
16+
jobs:
17+
deploy:
18+
name: Dispatch deploy ${{ inputs.plane }} plane workflow
19+
runs-on: blacksmith-4vcpu-ubuntu-2204
20+
steps:
21+
- name: Dispatch deploy ${{ inputs.plane }} plane
22+
uses: actions/github-script@v6
23+
with:
24+
github-token: ${{ secrets.HOSTED_CHROMA_WORKFLOW_DISPATCH_TOKEN}}
25+
# we don't expose environment here because we only want to automate deploys to staging
26+
# we also don't expose the ref here because we want to use the defaults on the other side (latest, main)
27+
script: |
28+
const result = await github.rest.actions.createWorkflowDispatch({
29+
owner: 'chroma-core',
30+
repo: 'hosted-chroma',
31+
workflow_id: 'deploy.yaml',
32+
ref: 'main',
33+
inputs: {
34+
'plane': '${{ inputs.plane }}',
35+
environment: 'staging',
36+
'ignore-lock': ${{ inputs.ignore-lock }},
37+
}
38+
})
39+
console.log(result)

.github/workflows/release-chromadb.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -205,36 +205,25 @@ jobs:
205205
removeArtifacts: true
206206
prerelease: true
207207

208-
release-hosted:
209-
name: Release to Chroma Cloud
210-
runs-on: blacksmith-4vcpu-ubuntu-2204
208+
release-hosted-control-plane:
209+
name: Release to Chroma Cloud control plane
210+
# depends on release-github because it updates the tag to latest, which is what will get deployed
211211
needs:
212212
- release-github
213-
steps:
214-
- name: Checkout
215-
uses: actions/checkout@v4
216-
- name: Dispatch deploy
217-
uses: actions/github-script@v6
218-
with:
219-
github-token: ${{ secrets.HOSTED_CHROMA_WORKFLOW_DISPATCH_TOKEN }}
220-
script: |
221-
const result = await github.rest.actions.createWorkflowDispatch({
222-
owner: 'chroma-core',
223-
repo: 'hosted-chroma',
224-
workflow_id: 'deploy.yaml',
225-
ref: 'main',
226-
inputs: {
227-
// We intentionally *do not* provide the current commit SHA of chroma-core/chroma here. The workflow we dispatch defaults to the commit tagged with "latest" (which we update above).
228-
// If we provided the current commit here, there's a potential race condition:
229-
// - Commit history is A -> B
230-
// - This CI workflow runs on both commits, but the second commit finishes first
231-
// - B is deployed to Chroma Cloud
232-
// - This workflow finishes for A and deploys A to Chroma Cloud
233-
// Chroma Cloud is now running A, but the last commit was B.
234-
"environment": "staging",
235-
"planes": "control,data"
236-
}
237-
})
213+
uses: ./.github/workflows/_deploy.yml
214+
with:
215+
plane: control
216+
secrets: inherit
217+
218+
release-hosted-data-plane:
219+
name: Release to Chroma Cloud data plane
220+
# depends on release-github because it updates the tag to latest, which is what will get deployed
221+
needs:
222+
- release-github
223+
uses: ./.github/workflows/_deploy.yml
224+
with:
225+
plane: data
226+
secrets: inherit
238227

239228
release-docs:
240229
name: Deploy docs to Vercel

.github/workflows/trigger-deploy.yaml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,18 @@ on:
1010
- rc/**-**-**
1111

1212
jobs:
13-
deploy:
14-
name: Dispatch deploy workflow
15-
runs-on: blacksmith-4vcpu-ubuntu-2204
16-
steps:
17-
- name: Dispatch deploy
18-
uses: actions/github-script@v6
19-
with:
20-
github-token: ${{ secrets.HOSTED_CHROMA_WORKFLOW_DISPATCH_TOKEN}}
21-
script: |
22-
const result = await github.rest.actions.createWorkflowDispatch({
23-
owner: 'chroma-core',
24-
repo: 'hosted-chroma',
25-
workflow_id: 'deploy.yaml',
26-
ref: 'main',
27-
inputs: {
28-
'planes': 'control,data',
29-
environment: 'staging',
30-
'ignore-lock': true,
31-
'oss-ref': '${{ github.ref_name }}',
32-
'hosted-ref': '${{ github.ref_name }}'
33-
}
34-
})
35-
console.log(result)
13+
deploy-control-plane:
14+
name: Dispatch deploy control plane workflow
15+
uses: ./.github/workflows/_deploy.yml
16+
with:
17+
plane: control
18+
ignore-lock: true
19+
secrets: inherit
20+
21+
deploy-data-plane:
22+
name: Dispatch deploy data plane workflow
23+
uses: ./.github/workflows/_deploy.yml
24+
with:
25+
plane: data
26+
ignore-lock: true
27+
secrets: inherit

0 commit comments

Comments
 (0)