osdu-gcp-cloudrun.yml 6.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Copyright 2020 Google LLC
# Copyright 2017-2019, Schlumberger
# Copyright 2020 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.

17
18
19
20
21
22
23
24
# Global Protected Variables:
#
# OSDU_GCP
# OSDU_GCP_DEPLOY_FILE
# OSDU_GCP_SERVICE_ACCOUNT
# OSDU_GCP_INTEGRATION_TESTER
# OSDU_GCP_NO_DATA_ACCESS_TESTER

25
.osdu-gcp-variables:
26
  variables:
27
    #services' urls
28
29
    # placeholder(stub) for register service
    OSDU_GCP_REGISTER_URL: https://os-register-dot-opendes.appspot.com/api/register/v1/
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
30
    OSDU_GCP_ENTITLEMENTS_URL: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
31
    OSDU_GCP_AUTHORIZE_API: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
32
    OSDU_GCP_STORAGE_URL: https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2/
33
    OSDU_GCP_RECORDS_ROOT_URL: https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2/
34
    OSDU_GCP_LEGAL_HOST_URL: https://os-legal-dot-nice-etching-277309.uc.r.appspot.com/api/legal/v1/
35
    OSDU_GCP_AIRFLOW_URL: https://c410714dc037b0e02p-tp.appspot.com/
36
    OSDU_GCP_DELIVERY_SERVICE_URL: https://os-delivery-attcrcktoa-uc.a.run.app/api/delivery/v2/
37
38
    OSDU_GCP_INGEST_HOST: https://os-ingest-attcrcktoa-uc.a.run.app/
    OSDU_GCP_WORKFLOW_SERVICE_URL: https://os-workflow-attcrcktoa-uc.a.run.app/
39
    OSDU_GCP_SEARCH_HOST: https://os-search-dot-nice-etching-277309.uc.r.appspot.com/api/search/v2/
40
    OSDU_GCP_SEARCH_QUERY_URL: https://os-search-dot-nice-etching-277309.uc.r.appspot.com//api/search/v2/query/
41
    OSDU_GCP_INDEXER_HOST: https://os-indexer-dot-nice-etching-277309.uc.r.appspot.com/
42
    OSDU_GCP_FILE_URL: https://os-file-attcrcktoa-uc.a.run.app/
43
44
45
46
    REDIS_GROUP_HOST: 10.234.198.27
    REDIS_SEARCH_HOST: 10.99.138.107
    REDIS_STORAGE_HOST: 10.16.59.203
    REDIS_SYNC_HOST: 10.116.62.35
47
    # common variables
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
48
49
50
    OSDU_GCP_CLOUDRUN_REGION: us-central1
    OSDU_GCP_PROJECT: nice-etching-277309
    OSDU_GCP_VPC_CONNECTOR: osdu-connector
51
    OSDU_GCP_PORT: 8080
52
53
54
    # common variables for tests
    GOOGLE_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
55
    LEGAL_TAG: osdu-demo-legaltag
56
57
58
59
    OTHER_RELEVANT_DATA_COUNTRIES: US
    DEFAULT_DATA_PARTITION_ID_TENANT1: osdu
    GCLOUD_PROJECT: nice-etching-277309
    # variables for workflow tests
Oleksandr Kosse (EPAM)'s avatar
Oleksandr Kosse (EPAM) committed
60
    FINISHED_WORKFLOW_ID: fad778da-fbc4-4261-8b3e-deb48be44969
61
    # variables for ingestion tests
62
    TEST_OSDU_FILE_PATH: gs://nice-etching-277309-file/r1/data/provided/well-logs/1013_akm11_1978_comp.las
63
64
65
66
67
68
69
70
71
72
73
    # variables for file tests
    TARGET_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    DATA_PARTITION_ID: osdu
    USER_ID: common-user
    TIME_ZONE: UTC+0
    FILE_BUCKET: nice-etching-277309-file
    # variables for delivery tests
    ENTITLEMENTS_DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
    TENANT: osdu
    DEFAULT_DATA_PARTITION_ID_TENANT2: osdu
    INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
74
75
76
77
78
79
    # variables for register tests, and deployment
    SERVICE_IDENTITY: osdu-gcp-sa
    RECORDS_CHANGE_PUBSUB_ENDPOINT: https://os-notification-attcrcktoa-uc.a.run.app/push-handlers/records-changed
    CRON_JOB_EXPECTED_IP: 0:0:0:0:0:0:0:1
    SUBSCRIBER_PRIVATE_KEY_ID: ${OSDU_GCP_SUBSCRIBER_PRIVATE_KEY_ID}
    SUBSCRIBER_SECRET: ${OSDU_GCP_SUBSCRIBER_SECRET}
80

Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
81
osdu-gcp-containerize:
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
82
  stage: containerize
83
  needs: ["compile-and-unit-test"]
84
  extends: .osdu-gcp-variables
85
86
87
  image: google/cloud-sdk
  cache: {}
  script:
88
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
89
    - gcloud config set project $OSDU_GCP_PROJECT
90
    - touch .gcloudignore
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
91
    - gcloud builds submit --config provider/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR/cloudbuild/cloudbuild.yaml --substitutions=_PROVIDER_NAME=$OSDU_GCP_VENDOR,_SHORT_SHA=$CI_COMMIT_SHORT_SHA,_PORT=$OSDU_GCP_PORT
92
93
94
95
  only:
    variables:
      - $OSDU_GCP == 'true'

96
osdu-gcp-deploy:
97
  image: google/cloud-sdk
98
  needs: ["osdu-gcp-containerize"]
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
99
  stage: deploy
100
  extends: .osdu-gcp-variables
101
102
  cache: {}
  script:
103
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
104
    - gcloud config set project $OSDU_GCP_PROJECT
105
    - gcloud run deploy $OSDU_GCP_APPLICATION_NAME --image gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA --platform managed --region $OSDU_GCP_CLOUDRUN_REGION --allow-unauthenticated --service-account $OSDU_GCP_SERVICE_ACCOUNT --memory 512M --set-env-vars=$OSDU_GCP_ENV_VARS
106
107
  only:
    variables:
108
      - $OSDU_GCP == 'true'
109
110

osdu-gcp-test:
111
  image: maven:3.3.9-jdk-8
112
113
114
115
  extends:
    - .osdu-gcp-variables
  stage: integration
  needs: ["osdu-gcp-deploy"]
116
  allow_failure: true
117
118
119
120
121
122
123
124
  variables:
    WORKFLOW_HOST: $OSDU_GCP_WORKFLOW_SERVICE_URL
    INGEST_HOST: $OSDU_GCP_INGEST_HOST
    TEST_FILE_ID: $OSDU_GCP_TEST_FILE_ID
    FILE_SERVICE_HOST: $OSDU_GCP_FILE_URL
    DELIVERY_HOST: $OSDU_GCP_DELIVERY_SERVICE_URL
    SEARCH_HOST: $OSDU_GCP_SEARCH_HOST
    STORAGE_HOST: $OSDU_GCP_STORAGE_URL
125
  script:
126
127
128
    - echo $TEST_FILE_ID
    - echo $INGEST_HOST
    - echo $DELIVERY_HOST
129
    - export INTEGRATION_TESTER=$(echo $OSDU_GCP_R3_INTEGRATION_TESTER)
130
    - export NO_DATA_ACCESS_TESTER=$(echo $OSDU_GCP_R3_NO_DATA_ACCESS_TESTER)
131
    - export GCP_DEPLOY_FILE=$(echo $OSDU_GCP_DEPLOY_FILE)
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
132
    - export SEARCH_INTEGRATION_TESTER=$(echo $OSDU_GCP_R3_INTEGRATION_TESTER)
133
134
135
136
137
138
139
140
141
    - >
        mvn
        --batch-mode
        --settings=$CI_PROJECT_DIR/.mvn/community-maven.settings.xml
        -f testing/pom.xml
        verify
        --projects $OSDU_GCP_SERVICE-test-core,$OSDU_GCP_SERVICE-test-gcp
        2>&1 | tee test-results.log

142
143
  only:
    variables:
144
      - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE != 'python'
145
146
147
148
149
  artifacts:
    when: always
    paths:
      - test-results.log
    expire_in: 1 week
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

osdu-gcp-test-python:
  extends:
    - .osdu-gcp-variables
  variables:
    INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
    BASE_URL: /api/unit
    VIRTUAL_SERVICE_HOST_NAME: os-unit-attcrcktoa-uc.a.run.app
    MY_TENANT: osdu
  stage: integration
  image: python:3.7
  needs: ["osdu-gcp-deploy"]
  allow_failure: false
  script:
    - cd testing/unit_test_gcp
    - chmod +x ./run-integration-tests.sh
    - ./run-integration-tests.sh
  only:
    variables:
      - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE == 'python'