.gitlab-ci.yml 5.74 KB
Newer Older
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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.

15
variables:
16
  PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt"
fabian serin's avatar
fabian serin committed
17

Yunhua Koglin's avatar
Yunhua Koglin committed
18
19
  # OSDU_GCP_APPLICATION_NAME: wellbore-ddms
  # OSDU_GCP_VENDOR: gcp
Vladislav Shishko (EPAM)'s avatar
Vladislav Shishko (EPAM) committed
20

Yunhua Koglin's avatar
Yunhua Koglin committed
21
22
23
24
  # AZURE_SERVICE: wellbore-ddms
  # AZURE_DOCKER_SUBDIR: build/Dockerfile
  # AZURE_TEST_SUBDIR: tests/integration
  # AZURE_TEST_TYPE: python
Yunhua Koglin's avatar
Yunhua Koglin committed
25

Yunhua Koglin's avatar
Yunhua Koglin committed
26
  AWS_SERVICE: wellbore-ddms
Yunhua Koglin's avatar
Yunhua Koglin committed
27
28
  AWS_ENVIRONMENT: dev
  AWS_BUILD_SUBDIR: provider/os-wellbore-ddms-aws/build-aws
29
  AWS_TEST_SUBDIR: tests/aws-test/build-aws
30
  AWS_INT_TEST_TYPE: python
Sumra Zafar's avatar
Sumra Zafar committed
31
 
32
33
34
35
include:
  - project: "osdu/platform/ci-cd-pipelines"
    file: "standard-setup.yml"

36
37
38
39
40
  - project: "osdu/platform/ci-cd-pipelines"
    file: "build/python.yml"

  - project: "osdu/platform/ci-cd-pipelines"
    file: "scanners/fossa-python.yml"
41

42
43
44
  - project: "osdu/platform/ci-cd-pipelines"
    file: "scanners/gitlab-ultimate.yml"

Yunhua Koglin's avatar
Yunhua Koglin committed
45
46
  # - project: 'osdu/platform/ci-cd-pipelines'
  #   file: 'cloud-providers/osdu-gcp-cloudrun.yml'
vladislav's avatar
vladislav committed
47

Yunhua Koglin's avatar
Yunhua Koglin committed
48
49
  # - project: 'osdu/platform/ci-cd-pipelines'
  #   file: 'cloud-providers/ibm-wellbore.yml'
Sumra Zafar's avatar
Sumra Zafar committed
50

Yunhua Koglin's avatar
Yunhua Koglin committed
51
  # - local: "/devops/azure/azure-wellbore.yml"
Yunhua Koglin's avatar
Yunhua Koglin committed
52
53
54

  - project: 'osdu/platform/ci-cd-pipelines'
    file: 'cloud-providers/aws.yml'
Yunhua Koglin's avatar
Yunhua Koglin committed
55
    ref: "awswellboreddms"
56
# --------------------------------------------------------------------------------
fabian serin's avatar
fabian serin committed
57

Vladislav Shishko (EPAM)'s avatar
Vladislav Shishko (EPAM) committed
58
containerize:
59
60
61
  extends:
    - .skipForTriggeringMergeRequests

62
63
64
  stage: containerize
  image: docker:19.03
  tags: ['osdu-medium']
fabian serin's avatar
fabian serin committed
65
66
  variables:
      IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
fabian serin's avatar
fabian serin committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

  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
fabian serin's avatar
fabian serin committed
84
    - 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
fabian serin's avatar
fabian serin committed
85
86
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - echo ---- ---- PUSH IMAGE
fabian serin's avatar
fabian serin committed
87
    - docker push $IMAGE_TAG
fabian serin's avatar
fabian serin committed
88
    - docker push $CI_REGISTRY_IMAGE:latest
Vladislav Shishko (EPAM)'s avatar
Vladislav Shishko (EPAM) committed
89

Yunhua Koglin's avatar
Yunhua Koglin committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# 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: []