# Copyright 2021 Schlumberger # # 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. .osdu-gcp-variables-k8s: variables: # OSDU Infrastructure variables OSDU_GCP_PROJECT_NAME: osdu-service-prod OSDU_GCP_ZONE: us-central1-c OSDU_GCP_TENANT: odesprod OSDU_GCP_CLUSTER: osdu-service-prod-gke-wellbore OSDU_GCP_LEGAL_TAG: odesprod-demo-legaltag OSDU_GCP_PROJECT_SA: $OSDU_GCP_SA_PROD # OSDU Service & Int test variables OSDU_GCP_WELLBORE_DDMS_URL: https://wellbore-ddms-preship.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms OSDU_GCP_APPLICATION_HEALTH_URL: https://wellbore-ddms-preship.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms/healthz #OSDU_GCP_ENV_HELM_EXTRA_VARS: --set secret.gcpSA=$osdu_gcp_sa_encode --set namespace=$OSDU_GCP_APPLICATION_NAME --set configMap.data.projectId=$OSDU_GCP_PROJECT_NAME --set configMap.data.searchEndpoint="https://search-drgfbg5txq-uc.a.run.app/api/search" --set configMap.data.storageEndpoint="https://storage-drgfbg5txq-uc.a.run.app/api/storage" --set image.repository=gcr.io/osdu-service-prod/wellbore-ddms/wellbore-ddms-gcp --set image.tag=latest OSDU_GCP_ENV_HELM_EXTRA_VARS: --set secret.gcpSA=$osdu_gcp_sa_encode --set namespace=$OSDU_GCP_APPLICATION_NAME --set configMap.data.projectId=$OSDU_GCP_PROJECT_NAME --set configMap.data.searchEndpoint="https://search-drgfbg5txq-uc.a.run.app/api/search" --set configMap.data.storageEndpoint="https://storage-drgfbg5txq-uc.a.run.app/api/storage" #--set image.repository=$CI_REGISTRY_IMAGE --set image.tag=gcp- OSDU_GCP_APPLICATION_NAME: wellbore-ddms OSDU_GCP_HELM_DEPLOYMENT_DIR: devops/gcp OSDU_GCP_HELM_CHART: wellbore .osdu-gcp-variables-community: variables: variables: PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt" AZURE_SERVICE: wellbore-ddms AZURE_DOCKER_SUBDIR: build/Dockerfile AZURE_TEST_SUBDIR: tests/integration AZURE_TEST_TYPE: python AWS_SERVICE: wellbore-ddms AWS_ENVIRONMENT: dev AWS_BUILD_SUBDIR: provider/os-wellbore-ddms-aws/build-aws AWS_TEST_SUBDIR: tests/aws-test/build-aws AWS_INT_TEST_TYPE: python include: - project: "osdu/platform/ci-cd-pipelines" file: "standard-setup.yml" - project: "osdu/platform/ci-cd-pipelines" file: "build/python.yml" - project: "osdu/platform/ci-cd-pipelines" file: "scanners/fossa-python.yml" - project: "osdu/platform/ci-cd-pipelines" file: "scanners/gitlab-ultimate.yml" - project: 'osdu/platform/ci-cd-pipelines' ref: "GONRG-2066_release_common_pipe_k8s" file: 'cloud-providers/osdu-gcp-stateful-k8s.yml' # - project: 'osdu/platform/ci-cd-pipelines' # file: 'cloud-providers/ibm-wellbore.yml' # # - local: "/devops/azure/azure-wellbore.yml" # # - project: 'osdu/platform/ci-cd-pipelines' # file: 'cloud-providers/aws.yml' # -------------------------------------------------------------------------------- containerize: extends: - .skipForTriggeringMergeRequests stage: containerize image: docker:19.03 tags: ['osdu-medium'] variables: IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA script: - echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ---- - apk update - apk add git - echo ---- ---- ---- BUILD IMAGE ---- ---- ---- - commit_id=$(git log -n 1 --pretty="%h") - echo ---- ---- TAG NAME - tag_name="_gitlab_$commit_id" - echo $tag_name - echo ---- ---- DATE - current_utc_date=`date --utc` - echo $current_utc_date - echo ---- ---- COMMIT BRANCH - commit_branch=$commit_id - echo $commit_branch - echo ---- ---- BUILD IMAGE - docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - echo ---- ---- PUSH IMAGE - docker push $IMAGE_TAG - docker push $CI_REGISTRY_IMAGE:latest #osdu-gcp-containerize: # stage: containerize # cache: {} # tags: [ 'osdu-medium' ] # only: # variables: # - $OSDU_GCP == 'true' # script: # variables: # IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA # script: # - echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ---- # - apk update # - apk add git # - echo ---- ---- ---- BUILD IMAGE ---- ---- ---- # - commit_id=$(git log -n 1 --pretty="%h") # - echo ---- ---- TAG NAME # - tag_name="_gitlab_$commit_id" # - echo $tag_name # - echo ---- ---- DATE # - current_utc_date=`date --utc` # - echo $current_utc_date # - echo ---- ---- COMMIT BRANCH # - commit_branch=$commit_id # - echo $commit_branch # - echo ---- ---- BUILD IMAGE # - docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch # - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY # - echo ---- ---- PUSH IMAGE # - docker push $IMAGE_TAG # - docker push $CI_REGISTRY_IMAGE:gcp-latest osdu-gcp-containerize-for-release: stage: containerize image: docker:19.03 extends: - .osdu-gcp-variables-k8s cache: {} tags: [ 'osdu-medium' ] only: variables: #- $OSDU_GCP == 'true' && $RELEASE =~ /(v)(\d+\.)(\d+\.)\w+/i - $OSDU_GCP == 'true' script: variables: IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:gcp-$RELEASE script: - echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ---- - apk update - apk add git - echo ---- ---- ---- BUILD IMAGE ---- ---- ---- - commit_id=$(git log -n 1 --pretty="%h") - echo ---- ---- TAG NAME - tag_name="_gitlab_$commit_id" - echo $tag_name - echo ---- ---- DATE - current_utc_date=`date --utc` - echo $current_utc_date - echo ---- ---- COMMIT BRANCH - commit_branch=$commit_id - echo $commit_branch - echo ---- ---- BUILD IMAGE - docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - echo ---- ---- PUSH IMAGE - docker push $IMAGE_TAG #---------------------------------------------------- osdu-gcp-test-python: stage: integration image: gcr.io/google.com/cloudsdktool/cloud-sdk extends: .osdu-gcp-variables-k8s allow_failure: true only: variables: - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE == 'python' script: - apt-get install -y python3-venv - python3 -m venv env - source env/bin/activate - pip install --upgrade pip - pip install wheel pytest pytest-cov - pip install -r requirements.txt - pip install -r requirements_dev.txt - cd tests/integration - echo $OSDU_GCP_INTEGRATION_TESTER_PROD | base64 -d > file.json - gcloud auth activate-service-account --key-file file.json - gcloud config set project $OSDU_GCP_PROJECT_NAME - python gen_postman_env.py --token $(gcloud auth print-identity-token) --base_url $OSDU_GCP_WELLBORE_DDMS_URL --cloud_provider $OSDU_GCP_VENDOR --data_partition $OSDU_GCP_TENANT --acl_domain $DOMAIN --legal_tag $OSDU_GCP_LEGAL_TAG - pytest ./functional --environment="./generated/postman_environment.json" --filter-tag=basic #osdu-gcp-test: # stage: integration # extends: [] # image: gcr.io/google.com/cloudsdktool/cloud-sdk # allow_failure: true # stage: integration # needs: ["osdu-gcp-deploy"] # only: # variables: # - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE != 'python'