Skip to content

Commit 7bdf903

Browse files
committed
Fixes for merged logic
1 parent fa7805c commit 7bdf903

5 files changed

Lines changed: 33 additions & 77 deletions

File tree

pipeline/ingestion/cloudbuild.yaml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,7 @@ steps:
1818
- DC_API_KEY
1919
id: 'build-jar'
2020

21-
# 2. Run Dataflow Integration Tests
22-
- name: 'maven:3.9-eclipse-temurin-17'
23-
entrypoint: 'mvn'
24-
args:
25-
- 'test'
26-
- '-Dmaven.repo.local=/workspace/.m2/repository'
27-
- '-Dtest=GraphIngestionPipelineIntegrationTest'
28-
- '-DprojectId=$PROJECT_ID'
29-
- '-DinstanceId=$_INSTANCE_ID'
30-
- '-DdatabaseId=$_DATABASE_ID'
31-
- '-DgcsBucket=$_GCS_BUCKET'
32-
- '-Dregion=$_REGION'
33-
- '-pl'
34-
- 'pipeline/ingestion'
35-
- '-DtestMode=DATAFLOW'
36-
- '-Drevision=${_VERSION}'
37-
secretEnv:
38-
- DC_API_KEY
39-
id: 'run-dataflow-integration-test'
40-
41-
# 3. Build the Dataflow Flex Template
21+
# 2. Build the Dataflow Flex Template
4222
# This step uses the built JAR to create the Flex Template image and spec file.
4323
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
4424
entrypoint: 'gcloud'
@@ -61,15 +41,6 @@ steps:
6141
- 'FLEX_TEMPLATE_JAVA_MAIN_CLASS=org.datacommons.ingestion.pipeline.GraphIngestionPipeline'
6242
id: 'build-flex-template'
6343

64-
# 4. Update the "latest" pointer for the workflow default
65-
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
66-
entrypoint: 'gsutil'
67-
args:
68-
- 'cp'
69-
- 'gs://$_TEMPLATE_BUCKET/templates/flex/ingestion-${_VERSION}.json'
70-
- 'gs://$_TEMPLATE_BUCKET/templates/flex/ingestion.json'
71-
id: 'update-latest-template'
72-
7344
availableSecrets:
7445
secretManager:
7546
- versionName: projects/$PROJECT_ID/secrets/dc-api-key/versions/latest

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.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,30 @@ 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'
34-
_PROD_TAG: 'latest' # TODO: rename to prod
33+
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/ingestion-${_VERSION}.json'
34+
_PROD_TAG: 'stable'
3535

3636
steps:
3737

3838
# 1. Build and push helper images
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=deploy-services.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=deploy-services.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)