Skip to content

Commit f1d5cea

Browse files
authored
feat(registry): Add dev deployment (#38221)
## What 1. Fixes an issue with failing deployments 2. Adds the ability to publish to a dev dagster environment 3. Fixes an issue where successful pipeline runs were marked as a failure ## How 1. Removes poetry as a dependency, it was unnesessary and causing an error with pex 2. Updates GHA and the pipeline to accept `DAGSTER_CLOUD_DEPLOYMENT` 3. All we needed to do was return the result 🤦‍♂️
1 parent caec5f2 commit f1d5cea

File tree

10 files changed

+324
-1021
lines changed

10 files changed

+324
-1021
lines changed

.github/workflows/metadata_service_deploy_orchestrator_dagger.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Connector Ops CI - Metadata Service Deploy Orchestrator
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
deployment_target:
7+
description: "The deployment target for the metadata orchestrator (prod or dev)"
8+
default: "dev"
59
push:
610
branches:
711
- master
@@ -14,8 +18,9 @@ jobs:
1418
steps:
1519
- name: Checkout Airbyte
1620
uses: actions/checkout@v2
17-
- name: Deploy the metadata orchestrator
18-
id: metadata-orchestrator-deploy-orchestrator-pipeline
21+
- name: Deploy the metadata orchestrator [On merge to master]
22+
id: metadata-orchestrator-deploy-orchestrator-pipeline-prod
23+
if: github.event_name == 'push'
1924
uses: ./.github/actions/run-airbyte-ci
2025
with:
2126
subcommand: "metadata deploy orchestrator"
@@ -27,3 +32,19 @@ jobs:
2732
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
2833
env:
2934
DAGSTER_CLOUD_METADATA_API_TOKEN: ${{ secrets.DAGSTER_CLOUD_METADATA_API_TOKEN }}
35+
DAGSTER_CLOUD_DEPLOYMENT: "prod"
36+
- name: Deploy the metadata orchestrator [On workflow]
37+
id: metadata-orchestrator-deploy-orchestrator-pipeline-branch
38+
if: github.event_name == 'workflow_dispatch'
39+
uses: ./.github/actions/run-airbyte-ci
40+
with:
41+
subcommand: "metadata deploy orchestrator"
42+
context: "manual"
43+
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_2 }}
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
46+
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
47+
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
48+
env:
49+
DAGSTER_CLOUD_METADATA_API_TOKEN: ${{ secrets.DAGSTER_CLOUD_METADATA_API_TOKEN }}
50+
DAGSTER_CLOUD_DEPLOYMENT: ${{ inputs.deployment_target }}

airbyte-ci/connectors/metadata_service/orchestrator/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ open http://localhost:3000
171171
And run the `generate_registry` job
172172

173173
## Additional Notes
174+
### How to publish to Dagster Cloud Dev
175+
Pre-requisites:
176+
- You need to have `airbyte-ci` installed. You can install it by running `make tools.airbyte-ci-dev.install` from the root of the repository.
177+
- You need to have the `DAGSTER_CLOUD_METADATA_API_TOKEN` environment variable set to an API token from the Airbyte Dagster Cloud account.
178+
179+
```sh
180+
DAGSTER_CLOUD_METADATA_API_TOKEN=<SECRET> DAGSTER_CLOUD_DEPLOYMENT="dev" airbyte-ci metadata deploy orchestrator
181+
```
174182

175183
### Testing Slack Notifications
176184
You will need to add the following environment variables to your `.env` file:

airbyte-ci/connectors/metadata_service/orchestrator/orchestrator/jobs/registry.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ def remove_stale_metadata_partitions_op(context):
3333
partition_name = registry_entry.metadata_partitions_def.name
3434

3535
all_fresh_etags = [blob.etag for blob in all_metadata_file_blobs]
36+
context.log.info(f"Found {len(all_fresh_etags)} fresh metadata files found in GCS bucket")
3637

3738
all_etag_partitions = context.instance.get_dynamic_partitions(partition_name)
39+
context.log.info(f"Found {len(all_etag_partitions)} existing metadata partitions")
3840

3941
for stale_etag in [etag for etag in all_etag_partitions if etag not in all_fresh_etags]:
4042
context.log.info(f"Removing stale etag: {stale_etag}")
@@ -55,12 +57,16 @@ def add_new_metadata_partitions_op(context):
5557
"""
5658
This op is responsible for polling for new metadata files and adding their etag to the dynamic partition.
5759
"""
60+
context.log.info("Starting add_new_metadata_partitions_op")
61+
5862
all_metadata_file_blobs = context.resources.all_metadata_file_blobs
63+
context.log.info(f"Found {len(all_metadata_file_blobs)} metadata files found in GCS bucket")
64+
5965
partition_name = registry_entry.metadata_partitions_def.name
66+
existing_partitions = context.instance.get_dynamic_partitions(partition_name)
67+
context.log.info(f"Found {len(existing_partitions)} existing metadata partitions")
6068

61-
new_files_found = {
62-
blob.etag: blob.name for blob in all_metadata_file_blobs if not context.instance.has_dynamic_partition(partition_name, blob.etag)
63-
}
69+
new_files_found = {blob.etag: blob.name for blob in all_metadata_file_blobs if not blob.etag in existing_partitions}
6470

6571
new_etags_found = list(new_files_found.keys())
6672
context.log.info(f"New etags found: {new_etags_found}")

0 commit comments

Comments
 (0)