Skip to content

Instantly share code, notes, and snippets.

@mik-laj
Created June 25, 2020 09:50
Show Gist options
  • Save mik-laj/e7866bd4c8e21a01fa7faa6599b70134 to your computer and use it in GitHub Desktop.
Save mik-laj/e7866bd4c8e21a01fa7faa6599b70134 to your computer and use it in GitHub Desktop.
steps:
- name: gcr.io/cloud-builders/git
args: ['clone', 'https://github.com/GoogleCloudPlatform/java-docs-samples.git', 'repo_dir']
- name: gcr.io/cloud-builders/git
args: ['checkout', '$_GIT_COMMIT']
dir: 'repo_dir'
- name: maven:3.6.3-jdk-8
args:
- sed
- -i
- 's#<beam.version>.\+</beam.version>#<beam.version>${_APACHE_BEAM_VERSION}</beam.version>#'
- repo_dir/dataflow/templates/pom.xml
- name: maven:3.6.3-jdk-8
args:
- sed
- -i
- 's#<maven.compiler.target>.\+</maven.compiler.target>#<maven.compiler.target>1.8</maven.compiler.target>#'
- repo_dir/dataflow/templates/pom.xml
- name: maven:3.6.3-jdk-8
args:
- sed
- -i
- 's#<maven.compiler.source>.\+</maven.compiler.source>#<maven.compiler.source>1.8</maven.compiler.source>#'
- repo_dir/dataflow/templates/pom.xml
- name: maven:3.6.3-jdk-8
args:
- cat
- repo_dir/dataflow/templates/pom.xml
- name: maven:3.6.3-jdk-8
args:
- bash
- -c
- |
[[ "${_PIPELINE_WAIT_UNTIL_FINISH}" == "true" ]] && \
sed -i "s#pipeline.run();#pipeline.run().waitUntilFinish();#" \
repo_dir/dataflow/templates/src/main/java/com/example/dataflow/templates/WordCount.java \
|| true
- name: maven:3.6.3-jdk-8
args: ["mvn", "clean", "package"]
dir: 'repo_dir/dataflow/templates'
- name: maven:3.6.3-jdk-8
args:
- java
- -jar
- repo_dir/dataflow/templates/target/dataflow-templates-bundled-1.0.jar
- --project=${PROJECT_ID}
- --runner=DataflowRunner
- --tempLocation=gs://test-dataflow-example/temp/
- --stagingLocation=gs://test-dataflow-example/staging/
- '--outputBucket=test-dataflow-example-output'
- '--labels={"airflow-version":"v2-0-0-dev0"}'
- --region=europe-west3
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
args:
- gsutil
- cp
- repo_dir/dataflow/templates/target/dataflow-templates-bundled-1.0.jar
- 'gs://test-dataflow-example/builds/dataflow-templates-bundled-java=11-beam=${_APACHE_BEAM_VERSION}-wait_until_finish=${_PIPELINE_WAIT_UNTIL_FINISH}.jar'
substitutions:
_GIT_COMMIT: "e186156021f63bc4ad40bb12ecac11946d60b992"
_APACHE_BEAM_VERSION: "2.22.0"
_PIPELINE_WAIT_UNTIL_FINISH: "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment