Skip to content

Commit 9fbe5ae

Browse files
committed
Fixes for merged logic
1 parent c35956f commit 9fbe5ae

5 files changed

Lines changed: 32 additions & 46 deletions

File tree

pipeline/ingestion/cloudbuild.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ steps:
6262
id: 'build-flex-template'
6363

6464
# 4. Update the "latest" pointer for the workflow default
65+
# TODO: remove this step after DCP migration to prod tag.
6566
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
6667
entrypoint: 'gsutil'
6768
args:

pipeline/spanner/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,15 @@
7676
<scope>test</scope>
7777
</dependency>
7878
</dependencies>
79+
80+
<build>
81+
<resources>
82+
<resource>
83+
<directory>../workflow/ingestion-helper</directory>
84+
<includes>
85+
<include>schema.sql</include>
86+
</includes>
87+
</resource>
88+
</resources>
89+
</build>
7990
</project>

pipeline/spanner/src/main/java/org/datacommons/ingestion/spanner/SpannerClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,17 @@ public void validateOrInitializeDatabase() {
231231
}
232232
}
233233

234-
/** Reads DDL statements from the spanner_schema.sql file in the resources directory. */
234+
/** Reads DDL statements from the schema.sql file in the resources directory. */
235235
List<String> readDdlStatements() {
236-
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("spanner_schema.sql");
236+
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("schema.sql");
237237
if (inputStream == null) {
238-
throw new IllegalStateException("Could not find spanner_schema.sql in resources.");
238+
throw new IllegalStateException("Could not find schema.sql in resources.");
239239
}
240240
try (BufferedReader reader =
241241
new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
242242
return parseDdlStatements(reader);
243243
} catch (IOException e) {
244-
throw new IllegalStateException("Failed to read spanner_schema.sql", e);
244+
throw new IllegalStateException("Failed to read schema.sql", e);
245245
}
246246
}
247247

pipeline/spanner/src/main/resources/spanner_schema.sql

Lines changed: 0 additions & 35 deletions
This file was deleted.

pipeline/workflow/cloudbuild_main.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ substitutions:
3030
_AR_REPO_URL: 'us-docker.pkg.dev/datcom-ci/gcr.io'
3131
_BQ_SPANNER_CONN_ID: 'projects/datcom-ci/locations/us-central1/connections/bq_spanner_conn_test'
3232
_VERSION: '${SHORT_SHA}'
33-
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/ingestion.json'
33+
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/ingestion-${_VERSION}.json'
3434
_PROD_TAG: 'latest' # TODO: rename to prod
3535

3636
steps:
@@ -39,12 +39,21 @@ steps:
3939
- id: 'build-ingestion-helper'
4040
name: 'gcr.io/cloud-builders/gcloud'
4141
args: ['builds', 'submit', 'ingestion-helper', '--config', 'ingestion-helper/cloudbuild.yaml', '--substitutions', '_AR_REPO_URL=${_AR_REPO_URL},_VERSION=${_VERSION}']
42-
dir: 'import-automation/workflow'
42+
dir: 'pipeline/workflow'
4343

4444
- id: 'build-import-helper'
4545
name: 'gcr.io/cloud-builders/gcloud'
4646
args: ['builds', 'submit', 'import-helper', '--config', 'import-helper/cloudbuild.yaml', '--substitutions', '_AR_REPO_URL=${_AR_REPO_URL},_VERSION=${_VERSION}']
47-
dir: 'import-automation/workflow'
47+
dir: 'pipeline/workflow'
48+
49+
- id: 'build-dataflow-template'
50+
name: 'gcr.io/cloud-builders/gcloud'
51+
args:
52+
- 'builds'
53+
- 'submit'
54+
- '.'
55+
- '--config=pipeline/ingestion/cloudbuild.yaml'
56+
- '--substitutions=_VERSION=${_VERSION},_IMAGE_GCR_PATH=${_AR_REPO_URL}/dataflow-templates/ingestion,_INSTANCE_ID=${_SPANNER_INSTANCE_ID},_DATABASE_ID=${_SPANNER_DATABASE_ID},_GCS_BUCKET=${_GCS_BUCKET_ID},_REGION=${_LOCATION}'
4857

4958
# 2. Trigger Staging Build (Child)
5059
# Overrides default (Production) values with Staging values.
@@ -57,7 +66,7 @@ steps:
5766
- '--config=cloudbuild.yaml'
5867
- '--project=${_PROJECT_ID}'
5968
- '--substitutions=_PROJECT_ID=${_PROJECT_ID},_SPANNER_PROJECT_ID=${_SPANNER_PROJECT_ID},_SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID},_SPANNER_DATABASE_ID=${_SPANNER_DATABASE_ID},_SPANNER_GRAPH_DATABASE_ID=${_SPANNER_GRAPH_DATABASE_ID},_GCS_BUCKET_ID=${_GCS_BUCKET_ID},_LOCATION=${_LOCATION},_GCS_MOUNT_BUCKET=${_GCS_MOUNT_BUCKET},_BQ_DATASET_ID=${_BQ_DATASET_ID},_PROJECT_NUMBER=${_PROJECT_NUMBER},_BQ_SPANNER_CONN_ID=${_BQ_SPANNER_CONN_ID},_VERSION=${_VERSION},_DATAFLOW_TEMPLATE_PATH=${_DATAFLOW_TEMPLATE_PATH}'
60-
dir: 'import-automation/workflow'
69+
dir: 'pipeline/workflow'
6170

6271
# 2. Run E2E Tests on Staging
6372
- id: 'e2e-test-staging'
@@ -75,12 +84,12 @@ steps:
7584
- 'SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID}'
7685
- 'SPANNER_DATABASE_ID=${_SPANNER_DATABASE_ID}'
7786
- 'GCS_BUCKET_ID=${_GCS_BUCKET_ID}'
78-
dir: 'import-automation/workflow'
87+
dir: 'pipeline/workflow'
7988

8089
- id: 'tag-prod'
8190
name: 'gcr.io/cloud-builders/gcloud'
8291
args: ['builds', 'submit', '.', '--config', 'tag-prod.yaml', '--substitutions', '_AR_REPO_URL=${_AR_REPO_URL},_PROD_TAG=${_PROD_TAG},_VERSION=${_VERSION}']
83-
dir: 'import-automation/workflow'
92+
dir: 'pipeline/workflow'
8493

8594
# 3. Trigger Production Build (Child)
8695
# Uses default (Production) values defined in cloudbuild.yaml.
@@ -93,7 +102,7 @@ steps:
93102
- '--config=cloudbuild.yaml'
94103
- '--project=${_PROJECT_ID}' # Build runs in CI project, deploys to Prod
95104
- '--substitutions=_VERSION=${_PROD_TAG}'
96-
dir: 'import-automation/workflow'
105+
dir: 'pipeline/workflow'
97106

98107
options:
99108
logging: CLOUD_LOGGING_ONLY

0 commit comments

Comments
 (0)