# Copyright 2021 Google LLC # Copyright 2017-2019, Schlumberger # Copyright 2021 EPAM # # 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. # Global Protected Variables: # # OSDU_GCP # OSDU_GCP_DEPLOY_FILE # OSDU_GCP_SERVICE_ACCOUNT # OSDU_GCP_INTEGRATION_TESTER # OSDU_GCP_NO_DATA_ACCESS_TESTER variables: # common variables DOMAIN: osdu-gcp.go3-nrg.projects.epam.com OSDU_GCP_VENDOR: gcp OSDU_NAMESPACE: default OSDU_GCP_URL: https://community.osdu-gcp.go3-nrg.projects.epam.com OSDU_GCP_TENANT: osdu OSDU_GCP_LEGAL_TAG: osdu-demo-legaltag osdu-gcp-deploy: image: gcr.io/google.com/cloudsdktool/cloud-sdk stage: deploy needs: ["osdu-gcp-containerize"] script: - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE - gcloud config set project $OSDU_GCP_PROJECT_NAME - gcloud container clusters get-credentials $OSDU_GCP_CLUSTER --zone $OSDU_GCP_ZONE --project $OSDU_GCP_PROJECT_NAME - curl https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz -s -o helm.tgz; tar -zxf helm.tgz; mv linux-amd64/helm /usr/local/bin/ - > helm upgrade $OSDU_GCP_SERVICE $OSDU_GCP_HELM_DEPLOYMENT_DIR --install --create-namespace --namespace=$OSDU_NAMESPACE --wait --set namespace=$OSDU_NAMESPACE --set image.repository=$CI_REGISTRY_IMAGE/osdu-gcp-$OSDU_GCP_SERVICE --set image.tag=gcp-community - echo ----- Verify Deployment ----- - kubectl rollout status deployment.v1.apps/${OSDU_GCP_SERVICE}-gcp -n $OSDU_NAMESPACE --timeout=900s - POD=$(kubectl get pod --sort-by=.metadata.creationTimestamp -n $OSDU_NAMESPACE | grep wellbore | tail -1 | awk '{print $1}') - STATUS=$(kubectl wait -n $OSDU_NAMESPACE --for=condition=Ready pod/${POD} --timeout=300s) - echo $STATUS - if [[ "$STATUS" != *"met"* ]]; then echo "POD didn't start correctly" ; exit 1 ; fi - STATUS_CODE=$(curl -X GET --write-out '%{http_code}' --silent --output /dev/null ${OSDU_GCP_URL}${OSDU_GCP_HEALTH_PATH}) - if [[ "$STATUS_CODE" -ne 200 ]] ; then exit 1 ; else echo health check OK! ; fi only: variables: - $OSDU_GCP == 'true'