google-datacatalog-hive-connector/cloudbuild.connector.yaml (64 lines of code) (raw):

# # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. steps: - name: 'gcr.io/cloud-builders/docker' id: 'BUILD' args: ['build', '-t', 'gcr.io/$PROJECT_ID/hive2datacatalog:$COMMIT_SHA', '/workspace/google-datacatalog-hive-connector/.'] - name: 'alpine' id: 'SETUP_TAG' args: ['sh', '-c', "echo `echo $BRANCH_NAME | sed 's,/,-,g' | awk '{print tolower($0)}'`_$(date -u +%Y%m%dT%H%M)_$SHORT_SHA > _TAG; echo $(cat _TAG)"] - name: 'gcr.io/cloudshell-images/cloudshell:latest' id: 'GET_PACKAGE' entrypoint: '/bin/bash' args: ['-c', 'gsutil cp gs://datacatalog-connector-tools/hive-0.0.2.tar.gz .'] - name: 'gcr.io/cloudshell-images/cloudshell:latest' id: 'EXTRACT' entrypoint: '/bin/bash' args: ['-c', 'tar -zxvf /workspace/hive-0.0.2.tar.gz'] - name: 'gcr.io/cloud-builders/gsutil' id: 'PREPARE_SERVICE_ACCOUNT' args: ['cp', 'gs://connectors_build_env/hive2dc-credentials.json', '/workspace/hive/infrastructure/.'] - name: 'gcr.io/cloudshell-images/cloudshell:latest' id: 'PREPARE_ENV' entrypoint: '/bin/bash' args: ['-c', 'cd /workspace/hive && ./cleanup-datacatalog.sh'] - name: 'gcr.io/cloudshell-images/cloudshell:latest' id: 'RUN' entrypoint: '/bin/bash' env: - 'PROJECT_ID=${PROJECT_ID}' - 'CONNECTOR_TAG_NAME=${COMMIT_SHA}' args: ['-c', 'cd /workspace/hive && ./run-demo.sh'] # Tag image with the custom tag - name: 'docker.io/library/python:3.7' id: 'ASSERT_RESULTS' entrypoint: 'bash' env: - 'GOOGLE_APPLICATION_CREDENTIALS=/workspace/hive/infrastructure/hive2dc-credentials.json' - 'HIVE2DC_DATACATALOG_PROJECT_ID=${PROJECT_ID}' args: - -c - 'pip install google-cloud-datacatalog && /workspace/google-datacatalog-hive-connector/system_tests/assert.sh' - name: 'gcr.io/cloud-builders/docker' id: 'TAG_IMAGE' entrypoint: '/bin/bash' args: ['-c', "docker tag gcr.io/$PROJECT_ID/hive2datacatalog:$COMMIT_SHA gcr.io/$PROJECT_ID/hive2datacatalog:$(cat _TAG)"] - name: 'gcr.io/cloudshell-images/cloudshell:latest' id: 'DELETE_ENV' entrypoint: '/bin/bash' args: ['-c', 'cd /workspace/hive && ./delete-demo.sh'] images: ['gcr.io/$PROJECT_ID/hive2datacatalog'] timeout: 30m