-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathtemplate.sh
More file actions
31 lines (28 loc) · 1.23 KB
/
template.sh
File metadata and controls
31 lines (28 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
OPERATION=$1
if [ "$OPERATION" == "deploy" ]; then
echo "Deploying Dataflow Flex Template..."
# Find the JAR file using wildcard
JAR_FILE=$(ls target/differ-bundled-*.jar | head -n 1)
echo "Found JAR: ${JAR_FILE}"
gcloud dataflow flex-template build \
"gs://datcom-templates/templates/flex/differ.json" \
--image-gcr-path "gcr.io/datcom-ci/dataflow-templates/differ:latest" \
--sdk-language "JAVA" \
--flex-template-base-image JAVA17 \
--metadata-file "metadata.json" \
--jar "${JAR_FILE}" \
--env FLEX_TEMPLATE_JAVA_MAIN_CLASS="org.datacommons.pipeline.differ.DifferPipeline"
elif [ "$OPERATION" == "run" ]; then
echo "Running Dataflow Flex Template..."
gcloud dataflow flex-template run "differ-job" \
--template-file-gcs-location "gs://datcom-templates/templates/flex/differ.json" \
--parameters currentData="gs://datcom-prod-imports/scripts/import-path/*.mcf" \
--parameters previousData="gs://datcom-prod-imports/scripts/import-path/*.mcf" \
--parameters outputLocation="gs://datcom-dataflow/differ/output" \
--project=datcom-store \
--region "us-central1"
else
echo "Usage: $0 [deploy|run]"
exit 1
fi