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

16
variables:
17
  PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt"
18
  IGNORE_PYTHON_SETUP: "wdms_client/request_builders/wdms/recursive_delete/ wdms_client/request_builders/wdms/search_apis/"
fabian serin's avatar
fabian serin committed
19

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

Mykola Zamkovyi (EPAM)'s avatar
Mykola Zamkovyi (EPAM) committed
25
  AWS_SERVICE: wellbore-ddms
Yunhua Koglin's avatar
Yunhua Koglin committed
26
  AWS_SERVICE_NAMESPACE: osdu-wellbore-ddms
Mykola Zamkovyi (EPAM)'s avatar
Mykola Zamkovyi (EPAM) committed
27
28
29
30
  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
Yunhua Koglin's avatar
Yunhua Koglin committed
31
32
  AWS_DEPLOY_TARGET: EKS
  AWS_EKS_DEPLOYMENT_NAME: os-wellbore-ddms
Mykola Zamkovyi (EPAM)'s avatar
Mykola Zamkovyi (EPAM) committed
33

Elsi Abraham's avatar
Elsi Abraham committed
34

35
36
37
38
include:
  - project: "osdu/platform/ci-cd-pipelines"
    file: "standard-setup.yml"

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

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

45
46
47
  - project: "osdu/platform/ci-cd-pipelines"
    file: "scanners/gitlab-ultimate.yml"

48
  - project: "osdu/platform/ci-cd-pipelines"
49
    file: "cloud-providers/osdu-gcp-gke.yml"
vladislav's avatar
vladislav committed
50

Oleksandr Kosse (EPAM)'s avatar
Oleksandr Kosse (EPAM) committed
51
  - project: "osdu/platform/ci-cd-pipelines"
Anuj Gupta's avatar
Anuj Gupta committed
52
    file: "cloud-providers/ibm-wellbore-git.yml"
53

Oleksandr Kosse (EPAM)'s avatar
Oleksandr Kosse (EPAM) committed
54
  - project: "osdu/platform/ci-cd-pipelines"
Yunhua Koglin's avatar
Yunhua Koglin committed
55
    file: "cloud-providers/aws-global.yml"
Mykola Zamkovyi (EPAM)'s avatar
Mykola Zamkovyi (EPAM) committed
56

57
58
59
  - project: "osdu/platform/ci-cd-pipelines"
    file: "cloud-providers/aws-python.yml"

60
  - local: "/devops/azure/azure-wellbore.yml"
61
  - local: "devops/gcp/pipeline/override-stages.yml"
62

63
64
65
66
#Override Python Image defined in python.yml
.python:
  image: python:3.8-bullseye

67
verify_existing_requirements:
68
  tags: ["osdu-small"]
69
70
71
72
73
74
75
76
77
  extends:
    - .python
    - .skipForTriggeringMergeRequests

  stage: build
  before_script:
    - pip3 install --upgrade pip-tools

  script:
78
79
    - pip-compile requirements.in
    - pip-compile requirements_dev.in
80
    - git diff
81
82
    # checking difference between existing requirements and the newly generated one
    # and using the number of lines as exit status code
83
    - exit $(git status -s | grep -e "^ M " | wc -l)
84
85
86
87

  artifacts:
    when: always
    paths:
88
      - "requirements*.txt"
89
90
91

    expire_in: 2 days

92
93
94
95
96
compile-and-unit-test:
  artifacts:
    when: always
    paths:
      - all-requirements.txt
97
      - ./**/python-*-output.txt
98
99
      - spec/generated/openapi.json

100
verify_models:
101
  tags: ["osdu-small"]
102
103
104
105
106
107
108
  extends:
    - .python
    - .skipForTriggeringMergeRequests

  stage: build

  script:
109
    - python -m doctest docs/model/model_curated.md
110

111
containerize:
112
  extends: .skipForTriggeringMergeRequests
113
114
  stage: containerize
  image: docker:19.03
115
  tags: ["osdu-small"]
116
  variables:
117
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  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

140
141
142
# Allow failure on private development deployments
ibm-deploy-devpri:
  allow_failure: true
143
144
aws-test-python:
  allow_failure: true