Commit 9edb7d10 authored by Oleksandr Kosse (EPAM)'s avatar Oleksandr Kosse (EPAM)
Browse files

Merge branch 'GONRG-2065-Refactor-cicd-pipeline-for-common-use' into 'master'

Added ci file for stateful k8s

See merge request osdu/platform/ci-cd-pipelines!203
parents a90c3254 5a86de28
Pipeline #34370 passed with stages
in 18 seconds
# Copyright 2020 Google LLC
# Copyright 2017-2019, Schlumberger
# Copyright 2020 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
.osdu-gcp-variables:
variables:
# common variables
OSDU_GCP_PROJECT: nice-etching-277309
OSDU_GCP_ZONE: us-central1-c
OSDU_GCP_VENDOR: gcp
OSDU_GCP_TENANT: osdu
OSDU_GCP_CLUSTER: wb
OSDU_GCP_WELLBORE_DDMS_URL: https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms
osdu-gcp-deploy:
image: gcr.io/google.com/cloudsdktool/cloud-sdk
needs: ["osdu-gcp-containerize"]
stage: deploy
script:
- gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
- gcloud config set project $OSDU_GCP_PROJECT
- gcloud container clusters get-credentials $OSDU_GCP_CLUSTER --zone $OSDU_GCP_ZONE --project $OSDU_GCP_PROJECT
- 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_HELM_CHART $OSDU_GCP_HELM_DEPLOYMENT_DIR
--install
--create-namespace
--namespace=$OSDU_GCP_APPLICATION_NAME
--wait
$OSDU_GCP_ENV_HELM_EXTRA_VARS
--set image.repository=gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR
--set image.tag=$CI_COMMIT_SHORT_SHA
- kubectl rollout status deployment.v1.apps/$OSDU_GCP_PROJECT -n $OSDU_GCP_APPLICATION_NAME --timeout=900s
- pod=$(kubectl get pod -n $OSDU_GCP_APPLICATION_NAME | grep $OSDU_GCP_PROJECT | tail -1 | awk '{print $1}')
- status=$(kubectl wait -n $OSDU_GCP_APPLICATION_NAME --for=condition=Ready pod/$pod --timeout=300s)
- 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_APPLICATION_HEALTH_URL)
- if [[ "$status_code" -ne 200 ]] ; then echo exit 1 ; else echo health check OK! ; fi
only:
variables:
- $OSDU_GCP == 'true'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment