Commit 5f7346cf authored by Yunhua Koglin's avatar Yunhua Koglin
Browse files

add cicd for aws

parent c7b54159
......@@ -15,13 +15,13 @@
variables:
PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt"
# OSDU_GCP_APPLICATION_NAME: wellbore-ddms
# OSDU_GCP_VENDOR: gcp
OSDU_GCP_APPLICATION_NAME: wellbore-ddms
OSDU_GCP_VENDOR: gcp
# AZURE_SERVICE: wellbore-ddms
# AZURE_DOCKER_SUBDIR: build/Dockerfile
# AZURE_TEST_SUBDIR: tests/integration
# AZURE_TEST_TYPE: python
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
......@@ -42,17 +42,17 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
file: "scanners/gitlab-ultimate.yml"
# - project: 'osdu/platform/ci-cd-pipelines'
# file: 'cloud-providers/osdu-gcp-cloudrun.yml'
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/osdu-gcp-cloudrun.yml'
# - project: 'osdu/platform/ci-cd-pipelines'
# file: 'cloud-providers/ibm-wellbore.yml'
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/ibm-wellbore.yml'
# - local: "/devops/azure/azure-wellbore.yml"
- local: "/devops/azure/azure-wellbore.yml"
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/aws.yml'
ref: "awswellboreddms"
# --------------------------------------------------------------------------------
containerize:
......@@ -87,58 +87,58 @@ containerize:
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:latest
# osdu-gcp-containerize:
# script:
# - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
# - gcloud config set project $OSDU_GCP_PROJECT
# - touch .gcloudignore
# - docker build -t gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA --rm . -f ./build/Dockerfile
# - gcloud docker -- push gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA
# cache: { }
# tags: [ 'osdu-medium' ]
# osdu-gcp-deploy:
# image: gcr.io/google.com/cloudsdktool/cloud-sdk
# needs: ["osdu-gcp-containerize"]
# stage: deploy
# variables:
# OSDU_GCP_PROJECT: nice-etching-277309
# script:
# - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
# - gcloud config set project $OSDU_GCP_PROJECT
# - gcloud container clusters get-credentials wb --zone us-central1-c --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 wellbore devops/gcp
# --install
# --create-namespace
# --namespace=wellbore
# --wait
# --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
# --set secret.gcpSA=$OS_WELLBORE_DDMS_DATA_PROJECT_CREDENTIALS
# - status_code=$(curl -X GET --write-out '%{http_code}' --silent --output /dev/null https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms/healthz)
# - if [[ "$status_code" -ne 200 ]] ; then echo exit 1 ; else echo health check OK! ; fi
# osdu-gcp-test-python:
# image: gcr.io/google.com/cloudsdktool/cloud-sdk
# variables:
# OSDU_GCP_WELLBORE_DDMS_URL: https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms
# 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 | base64 -d > file.json
# - gcloud auth activate-service-account --key-file file.json
# - gcloud config set project $OSDU_GCP_PROJECT
# - 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_TENANT --acl_domain $DOMAIN --legal_tag $LEGAL_TAG
# - pytest ./functional --environment="./generated/postman_environment.json" --filter-tag=basic
# allow_failure: true
# osdu-gcp-test:
# extends: []
osdu-gcp-containerize:
script:
- gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
- gcloud config set project $OSDU_GCP_PROJECT
- touch .gcloudignore
- docker build -t gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA --rm . -f ./build/Dockerfile
- gcloud docker -- push gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA
cache: { }
tags: [ 'osdu-medium' ]
osdu-gcp-deploy:
image: gcr.io/google.com/cloudsdktool/cloud-sdk
needs: ["osdu-gcp-containerize"]
stage: deploy
variables:
OSDU_GCP_PROJECT: nice-etching-277309
script:
- gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
- gcloud config set project $OSDU_GCP_PROJECT
- gcloud container clusters get-credentials wb --zone us-central1-c --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 wellbore devops/gcp
--install
--create-namespace
--namespace=wellbore
--wait
--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
--set secret.gcpSA=$OS_WELLBORE_DDMS_DATA_PROJECT_CREDENTIALS
- status_code=$(curl -X GET --write-out '%{http_code}' --silent --output /dev/null https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms/healthz)
- if [[ "$status_code" -ne 200 ]] ; then echo exit 1 ; else echo health check OK! ; fi
osdu-gcp-test-python:
image: gcr.io/google.com/cloudsdktool/cloud-sdk
variables:
OSDU_GCP_WELLBORE_DDMS_URL: https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms
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 | base64 -d > file.json
- gcloud auth activate-service-account --key-file file.json
- gcloud config set project $OSDU_GCP_PROJECT
- 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_TENANT --acl_domain $DOMAIN --legal_tag $LEGAL_TAG
- pytest ./functional --environment="./generated/postman_environment.json" --filter-tag=basic
allow_failure: true
osdu-gcp-test:
extends: []
#!/usr/bin/env bash
# echo "**********Current Dir ***********************"
# echo $(pwd)
# echo $(ls)
# echo "*********Am I at tests dir???**********"
# from tests/aws-test/build-aws/ goes up to the tests dir.
cd ../../../
# echo $(pwd)
# echo $(ls)
# Install venv for python3
which apt-get && sudo apt-get install -y python3 python3-pip python3-venv || echo "Not Ubuntu, skipping"
which yum && sudo yum install -y python3 python3-pip python3-venv || echo "Not RHEL, skipping"
python3 -m venv env
# sed -i 's/$1/${1:-}/' env/bin/activate # Fix deactivation bug '$1 unbound variable'
source env/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
......
Supports Markdown
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