Commit b1b2b729 authored by Vladislav Shishko (EPAM)'s avatar Vladislav Shishko (EPAM)
Browse files

Update osdu-gcp-gke.yml

parent 7d797d58
Pipeline #53406 passed with stage
in 27 seconds
# 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
include:
- local: "cloud-providers/osdu-gcp-global.yml"
.osdu-gcp-variables:
variables:
# services' urls
OSDU_GCP_AUTHORIZE_API: http://entitlements-sql/api/entitlements/v2/
# should be changed to gke local url after parition is migrated in community gke
OSDU_GCP_PARTITION_API: https://no-admin---os-partition-attcrcktoa-uc.a.run.app/api/partition/v1/
# common helm variables
OSDU_GCP_HELM_PACKAGE_CHARTS: "devops/gcp/deploy devops/gcp/configmap"
OSDU_GCP_HELM_DEPLOYMENT_DIR: "devops/gcp/deploy"
OSDU_GCP_HELM_CONFIG_DIR: "devops/gcp/configmap"
OSDU_GCP_HELM_NAMESPACE: default
# common variables
OSDU_GCP_PROJECT: nice-etching-277309
OSDU_GCP_CLUSTER: asm-primary
OSDU_GCP_ZONE: us-central1-c
OSDU_GCP_PORT: 8080
REDIS_GROUP_HOST: 10.234.198.27
REDIS_STORAGE_HOST: 10.16.59.203
OSDU_GCP_LOCAL_IMAGE_TAG_SHA: $CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_SHORT_SHA
# variables for partition
OSDU_GCP_PARTITION_KEY_RING: csqp
OSDU_GCP_PARTITION_KMS_KEY: managerService
# common variables for tests
DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
GOOGLE_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
LEGAL_TAG: osdu-demo-legaltag
OTHER_RELEVANT_DATA_COUNTRIES: US
DEFAULT_DATA_PARTITION_ID_TENANT1: osdu
GCLOUD_PROJECT: nice-etching-277309
OSDU_GCP_TESTING_DIR: testing
OSDU_GCP_TEST_SUBDIR: testing/$OSDU_GCP_SERVICE-test-$OSDU_GCP_VENDOR
ENVIRONMENT: dev
PARTITION_BASE_URL: https://community.osdu-gcp.go3-nrg.projects.epam.com/
# variables for legal tests
MY_TENANT_PROJECT: osdu
MY_TENANT: osdu
SKIP_HTTP_TESTS: "true"
HOST_URL: https://community.osdu-gcp.go3-nrg.projects.epam.com/api/legal/v1/
ENABLE_FULL_BUCKET_NAME: "true"
.common: &common
- 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.4-linux-amd64.tar.gz -s -o helm.tgz; tar -zxf helm.tgz; mv linux-amd64/helm /usr/local/bin/
osdu-gcp-containerize-gitlab:
stage: containerize
needs: ["compile-and-unit-test"]
tags: ["osdu-medium"]
extends: .osdu-gcp-variables
image: docker:19.03
cache: {}
script:
- export EXTRA_DOCKER_TAG=""; if [ "$CI_COMMIT_TAG" != "" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_TAG" ; elif [ "$CI_COMMIT_REF_NAME" = "master" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp:latest" ; fi
- docker build -t $OSDU_GCP_LOCAL_IMAGE_TAG_SHA $EXTRA_DOCKER_TAG --file provider/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR/cloudbuild/Dockerfile.cloudbuild --build-arg PROVIDER_NAME=$OSDU_GCP_VENDOR --build-arg PORT=$OSDU_GCP_PORT .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE/osdu-gcp
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-deploy-configmap:
extends: .osdu-gcp-variables
image: gcr.io/google.com/cloudsdktool/cloud-sdk
stage: deploy
needs: ["compile-and-unit-test"]
script:
- *common
- >
helm upgrade $OSDU_GCP_HELM_CONFIG_SERVICE $OSDU_GCP_HELM_CONFIG_DIR
--install
--create-namespace
--namespace=$OSDU_GCP_HELM_NAMESPACE
--wait
$OSDU_GCP_HELM_CONFIG_SERVICE_VARS
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-deploy-deployment:
extends: .osdu-gcp-variables
image: gcr.io/google.com/cloudsdktool/cloud-sdk
stage: deploy
needs: ["osdu-gcp-containerize-gitlab"]
script:
- *common
- >
helm upgrade $OSDU_GCP_HELM_DEPLOYMENT_SERVICE $OSDU_GCP_HELM_DEPLOYMENT_DIR
--install
--create-namespace
--namespace=$OSDU_GCP_HELM_NAMESPACE
--wait
$OSDU_GCP_HELM_DEPLOYMENT_SERVICE_VARS
- echo ----- Verify Deployment -----
- kubectl rollout status deployment.v1.apps/$OSDU_GCP_SERVICE -n $OSDU_GCP_HELM_NAMESPACE --timeout=900s
- POD=$(kubectl get pod --sort-by=.metadata.creationTimestamp -n $OSDU_GCP_HELM_NAMESPACE | grep $OSDU_GCP_SERVICE | tail -1 | awk '{print $1}')
- STATUS=$(kubectl wait -n $OSDU_GCP_HELM_NAMESPACE --for=condition=Ready pod/$POD --timeout=300s)
- echo $STATUS
- if [[ "$STATUS" != *"met"* ]]; then echo "POD didn't start correctly" ; exit 1 ; fi
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-test:
image: maven:3.3.9-jdk-8
extends:
- .osdu-gcp-variables
- .maven
stage: integration
needs: ["osdu-gcp-deploy-deployment"]
variables:
INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
NO_DATA_ACCESS_TESTER: $OSDU_GCP_NO_DATA_ACCESS_TESTER
SEARCH_INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
DE_OPS_TESTER: $OSDU_GCP_R3_OPS_TESTER
DE_ADMIN_TESTER: $OSDU_GCP_R3_ADMIN_TESTER
DE_EDITOR_TESTER: $OSDU_GCP_R3_EDITOR_TESTER
DE_NO_ACCESS_TESTER: $OSDU_GCP_R3_NO_ACCESS_TESTER
script:
- export GCP_DEPLOY_FILE=$(echo $OSDU_GCP_DEPLOY_FILE)
- >
mvn
--batch-mode
--settings=$CI_PROJECT_DIR/.mvn/community-maven.settings.xml
-f $OSDU_GCP_TESTING_DIR/pom.xml
verify
--projects $OSDU_GCP_SERVICE-test-core,$OSDU_GCP_SERVICE-test-gcp
2>&1 | tee test-results.log
only:
variables:
- $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE != 'python'
artifacts:
when: always
paths:
- test-results.log
- $OSDU_GCP_TEST_SUBDIR/target/*/TEST-*.xml
expire_in: 1 week
reports:
junit:
- $OSDU_GCP_TEST_SUBDIR/target/*/TEST-*.xml
# 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
include:
- local: "cloud-providers/osdu-gcp-global.yml"
.osdu-gcp-variables:
variables:
# services' urls
OSDU_GCP_AUTHORIZE_API: http://entitlements-sql/api/entitlements/v2/
# should be changed to gke local url after parition is migrated in community gke
OSDU_GCP_PARTITION_API: https://no-admin---os-partition-attcrcktoa-uc.a.run.app/api/partition/v1/
# common helm variables
OSDU_GCP_HELM_PACKAGE_CHARTS: "devops/gcp/deploy devops/gcp/configmap"
OSDU_GCP_HELM_DEPLOYMENT_DIR: "devops/gcp/deploy"
OSDU_GCP_HELM_CONFIG_DIR: "devops/gcp/configmap"
OSDU_GCP_HELM_NAMESPACE: default
# common variables
OSDU_GCP_PROJECT: nice-etching-277309
OSDU_GCP_CLUSTER: asm-primary
OSDU_GCP_ZONE: us-central1-c
OSDU_GCP_PORT: 8080
REDIS_GROUP_HOST: 10.234.198.27
REDIS_STORAGE_HOST: 10.16.59.203
OSDU_GCP_LOCAL_IMAGE_TAG_SHA: $CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_SHORT_SHA
# variables for partition
OSDU_GCP_PARTITION_KEY_RING: csqp
OSDU_GCP_PARTITION_KMS_KEY: managerService
# common variables for tests
DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
GOOGLE_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
LEGAL_TAG: osdu-demo-legaltag
OTHER_RELEVANT_DATA_COUNTRIES: US
DEFAULT_DATA_PARTITION_ID_TENANT1: osdu
GCLOUD_PROJECT: nice-etching-277309
OSDU_GCP_TESTING_DIR: testing
OSDU_GCP_TEST_SUBDIR: testing/$OSDU_GCP_SERVICE-test-$OSDU_GCP_VENDOR
ENVIRONMENT: dev
PARTITION_BASE_URL: https://community.osdu-gcp.go3-nrg.projects.epam.com/
# variables for legal tests
MY_TENANT_PROJECT: osdu
MY_TENANT: osdu
SKIP_HTTP_TESTS: "true"
HOST_URL: https://community.osdu-gcp.go3-nrg.projects.epam.com/api/legal/v1/
ENABLE_FULL_BUCKET_NAME: "true"
.common: &common
- 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.4-linux-amd64.tar.gz -s -o helm.tgz; tar -zxf helm.tgz; mv linux-amd64/helm /usr/local/bin/
osdu-gcp-containerize-gitlab:
stage: containerize
needs: ["compile-and-unit-test"]
tags: ["osdu-medium"]
extends: .osdu-gcp-variables
image: docker:19.03
cache: {}
script:
- export EXTRA_DOCKER_TAG=""; if [ "$CI_COMMIT_TAG" != "" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_TAG" ; elif [ "$CI_COMMIT_REF_NAME" = "master" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp:latest" ; fi
- docker build -t $OSDU_GCP_LOCAL_IMAGE_TAG_SHA $EXTRA_DOCKER_TAG --file provider/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR/cloudbuild/Dockerfile.cloudbuild --build-arg PROVIDER_NAME=$OSDU_GCP_VENDOR --build-arg PORT=$OSDU_GCP_PORT .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE/osdu-gcp
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-deploy-configmap:
extends: .osdu-gcp-variables
image: gcr.io/google.com/cloudsdktool/cloud-sdk
stage: deploy
needs: ["compile-and-unit-test"]
script:
- *common
- >
helm upgrade $OSDU_GCP_HELM_CONFIG_SERVICE $OSDU_GCP_HELM_CONFIG_DIR
--install
--create-namespace
--namespace=$OSDU_GCP_HELM_NAMESPACE
--wait
$OSDU_GCP_HELM_CONFIG_SERVICE_VARS
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-deploy-deployment:
extends: .osdu-gcp-variables
image: gcr.io/google.com/cloudsdktool/cloud-sdk
stage: deploy
needs: ["osdu-gcp-containerize-gitlab"]
script:
- *common
- >
helm upgrade $OSDU_GCP_HELM_DEPLOYMENT_SERVICE $OSDU_GCP_HELM_DEPLOYMENT_DIR
--install
--create-namespace
--namespace=$OSDU_GCP_HELM_NAMESPACE
--wait
$OSDU_GCP_HELM_DEPLOYMENT_SERVICE_VARS
- echo ----- Verify Deployment -----
- kubectl rollout status deployment.v1.apps/$OSDU_GCP_SERVICE -n $OSDU_GCP_HELM_NAMESPACE --timeout=900s
- POD=$(kubectl get pod --sort-by=.metadata.creationTimestamp -n $OSDU_GCP_HELM_NAMESPACE | grep $OSDU_GCP_SERVICE | tail -1 | awk '{print $1}')
- STATUS=$(kubectl wait -n $OSDU_GCP_HELM_NAMESPACE --for=condition=Ready pod/$POD --timeout=300s)
- echo $STATUS
- if [[ "$STATUS" != *"met"* ]]; then echo "POD didn't start correctly" ; exit 1 ; fi
only:
variables:
- $OSDU_GCP == 'true'
osdu-gcp-test:
image: maven:3.3.9-jdk-8
extends:
- .osdu-gcp-variables
- .maven
stage: integration
needs: ["osdu-gcp-deploy-deployment"]
variables:
INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
NO_DATA_ACCESS_TESTER: $OSDU_GCP_NO_DATA_ACCESS_TESTER
SEARCH_INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
DE_OPS_TESTER: $OSDU_GCP_R3_OPS_TESTER
DE_ADMIN_TESTER: $OSDU_GCP_R3_ADMIN_TESTER
DE_EDITOR_TESTER: $OSDU_GCP_R3_EDITOR_TESTER
DE_NO_ACCESS_TESTER: $OSDU_GCP_R3_NO_ACCESS_TESTER
script:
- export GCP_DEPLOY_FILE=$(echo $OSDU_GCP_DEPLOY_FILE)
- >
mvn
--batch-mode
--settings=$CI_PROJECT_DIR/.mvn/community-maven.settings.xml
-f $OSDU_GCP_TESTING_DIR/pom.xml
verify
--projects $OSDU_GCP_SERVICE-test-core,$OSDU_GCP_SERVICE-test-$OSDU_GCP_VENDOR
2>&1 | tee test-results.log
only:
variables:
- $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE != 'python'
artifacts:
when: always
paths:
- test-results.log
- $OSDU_GCP_TEST_SUBDIR/target/*/TEST-*.xml
expire_in: 1 week
reports:
junit:
- $OSDU_GCP_TEST_SUBDIR/target/*/TEST-*.xml
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