osdu-gcp-cloudrun.yml 10.9 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
# Global Protected Variables:
#
# OSDU_GCP
# OSDU_GCP_DEPLOY_FILE
# OSDU_GCP_SERVICE_ACCOUNT
# OSDU_GCP_INTEGRATION_TESTER
# OSDU_GCP_NO_DATA_ACCESS_TESTER
24

25
.osdu-gcp-variables:
26
  variables:
27
    # services' urls
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
28
29
    OSDU_GCP_STORAGE_HOSTNAME: os-storage-attcrcktoa-uc.a.run.app
    OSDU_GCP_LEGALTAG_API: https://os-legal-attcrcktoa-uc.a.run.app/api/legal/v1
30
    OSDU_GCP_CRS_API: https://crs-converter-attcrcktoa-uc.a.run.app/api/crs/v2
31
    OSDU_GCP_REGISTER_URL: https://os-register-attcrcktoa-uc.a.run.app/
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
32
    OSDU_GCP_ENTITLEMENTS_URL: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
33
    OSDU_GCP_AUTHORIZE_API: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
34
35
36
37
    OSDU_GCP_STORAGE_URL: https://os-storage-attcrcktoa-uc.a.run.app/api/storage/v2/
    OSDU_GCP_RECORDS_ROOT_URL: https://os-storage-attcrcktoa-uc.a.run.app/api/storage/v2/
    OSDU_GCP_LEGAL_HOST_URL: https://os-legal-attcrcktoa-uc.a.run.app/api/legal/v1/
    OSDU_GCP_LEGAL_HOSTNAME: https://os-legal-attcrcktoa-uc.a.run.app/
38
    OSDU_GCP_AIRFLOW_URL: https://c410714dc037b0e02p-tp.appspot.com/
39
    OSDU_GCP_DELIVERY_SERVICE_URL: https://os-delivery-attcrcktoa-uc.a.run.app/api/delivery/v2/
40
41
    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/
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
42
    OSDU_GCP_SEARCH_HOST: https://os-search-attcrcktoa-uc.a.run.app/api/search/v2/
43
    OSDU_GCP_BACKUP_HOST: https://backup-attcrcktoa-uc.a.run.app
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
44
    OSDU_GCP_SEARCH_QUERY_URL: https://os-search-attcrcktoa-uc.a.run.app/api/search/v2/query/
45
46
    OSDU_GCP_INDEXER_HOST: https://os-indexer-attcrcktoa-uc.a.run.app/
    OSDU_GCP_INDEXER_HOST_SEARCH: https://os-indexer-attcrcktoa-uc.a.run.app/api/indexer/v2/
47
    OSDU_GCP_FILE_URL: https://os-file-attcrcktoa-uc.a.run.app
48
    OSDU_GCP_NOTIFICATION_URL: https://os-notification-attcrcktoa-uc.a.run.app/
49
50
51
52
    OSDU_GCP_STORAGE_QUERY_RECORD_HOST: https://os-storage-attcrcktoa-uc.a.run.app/api/storage/v2/query/records
    OSDU_GCP_STORAGE_SCHEMA_HOST: https://os-storage-attcrcktoa-uc.a.run.app/api/storage/v2/schemas
    OSDU_GCP_STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST: https://os-storage-attcrcktoa-uc.a.run.app/api/storage/v2/query/records:batch
    OSDU_GCP_INDEXER_QUEUE_HOST: https://indexer-queue-attcrcktoa-uc.a.run.app/api/indexer/v1/_dps/task-handlers/enqueue
53
    OSDU_GCP_UNIT_HOSTNAME: os-unit-attcrcktoa-uc.a.run.app
54
    OSDU_GCP_CRS_CONVERTER_HOSTNAME: crs-converter-attcrcktoa-uc.a.run.app
55
    OSDU_GCP_CRS_CATALOG_HOSTNAME: os-crs-catalog-attcrcktoa-uc.a.run.app
56
    OSDU_GCP_SCHEMA_URL: https://os-schema-attcrcktoa-uc.a.run.app
57
58
59
60
    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
61
    OSDU_GCP_REDIS_SEARCH_PORT: 6379
62
    OSDU_GCP_SPRING_PROFILES_ACTIVE: dev
63
64
    # variables for unit deployment
    OSDU_GCP_UNIT_CATALOG_BUCKET: nice-etching-277309-unit-catalog-bucket
65
    # common variables
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
66
67
68
    OSDU_GCP_CLOUDRUN_REGION: us-central1
    OSDU_GCP_PROJECT: nice-etching-277309
    OSDU_GCP_VPC_CONNECTOR: osdu-connector
69
    OSDU_GCP_PORT: 8080
70
71
72
    # common variables for tests
    GOOGLE_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
73
    LEGAL_TAG: osdu-demo-legaltag
74
75
76
    OTHER_RELEVANT_DATA_COUNTRIES: US
    DEFAULT_DATA_PARTITION_ID_TENANT1: osdu
    GCLOUD_PROJECT: nice-etching-277309
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
77
78
    # variables for storage tests
    TENANT_NAME: osdu
79
    # variables for workflow tests
Oleksandr Kosse (EPAM)'s avatar
Oleksandr Kosse (EPAM) committed
80
    FINISHED_WORKFLOW_ID: fad778da-fbc4-4261-8b3e-deb48be44969
81
    OSDU_GCP_TEST_DAG_NAME: airflow_monitoring
82
    # variables for ingestion tests
83
    TEST_OSDU_FILE_PATH: gs://nice-etching-277309-file/r1/data/provided/well-logs/1013_akm11_1978_comp.las
84
85
86
87
88
    # variables for file deployment and tests
    OSDU_GCP_DATASTORE_NAMESPACE: osdu-namespace
    FILE_BUCKET: nice-etching-277309-file
    ACL_OWNERS: data.default.owners
    ACL_VIEWERS: data.default.viewers
89
90
91
92
93
94
95
    TARGET_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    DATA_PARTITION_ID: osdu
    USER_ID: common-user
    TIME_ZONE: UTC+0
    # variables for delivery tests
    ENTITLEMENTS_DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
    TENANT: osdu
96
    #DEFAULT_DATA_PARTITION_ID_TENANT2: osdu
97
    INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
98
99
    # variables for register tests, and deployment
    SERVICE_IDENTITY: osdu-gcp-sa
100
    RECORDS_CHANGE_PUBSUB_ENDPOINT: https://os-notification-attcrcktoa-uc.a.run.app/push-handlers/records-changed
101
    CRON_JOB_EXPECTED_IP: 0:0:0:0:0:0:0:1
102
103
104
    SUBSCRIBER_PRIVATE_KEY_ID: $OSDU_GCP_SUBSCRIBER_PRIVATE_KEY_ID
    SUBSCRIBER_SECRET: $OSDU_GCP_SUBSCRIBER_SECRET
    SUBSCRIPTION_ID: $OSDU_GCP_REGISTER_SUBSCRIPTION_ID
105
    REGISTER_CUSTOM_PUSH_URL: https://os-register-attcrcktoa-uc.a.run.app/api/register/v1/test/challenge/1
106
107
108
    CLIENT_TENANT: nonexistenttenant
    OSDU_TENANT: osdu
    REGISTER_BASE_URL: https://os-register-attcrcktoa-uc.a.run.app/
109
    ENVIRONMENT: dev
110
111
112
113
114
    # variables for notification tests
    HMAC_SECRET: $OSDU_GCP_SUBSCRIBER_SECRET
    REGISTER_CUSTOM_PUSH_URL_HMAC: https://os-register-attcrcktoa-uc.a.run.app/api/register/v1/test/challenge/hmac-integration-test
    TOPIC_ID: records-changed
    NOTIFICATION_BASE_URL: $OSDU_GCP_NOTIFICATION_URL
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
115
116
117
118
119
    # variables for legal tests
    MY_TENANT_PROJECT: osdu
    MY_TENANT: osdu
    ENABLE_FULL_BUCKET_NAME: "true"
    SKIP_HTTP_TESTS: "true"
120
121
122
123
124
125
126
127
    # variables for search tests
    DATA_GROUP: osdu
    ENTITLEMENTS_HOST: $OSDU_GCP_ENTITLEMENTS_URL
    ELASTIC_PASSWORD: $OSDU_GCP_ELASTIC_PASSWORD
    ELASTIC_USER_NAME: $OSDU_GCP_ELASTIC_USER
    ELASTIC_HOST: $OSDU_GCP_ELASTIC_HOST
    ELASTIC_PORT: $OSDU_GCP_ELASTIC_PORT
    DATA_PARTITION_ID_TENANT1: osdu
128
129
130
131
132
133
    # variables for schema tests
    VENDOR: $OSDU_GCP_VENDOR
    HOST: $OSDU_GCP_SCHEMA_URL
    PRIVATE_TENANT1: osdu
    PRIVATE_TENANT2: osdu
    SHARED_TENANT: osdu
134
    # variables for partition tests
135
    PARTITION_BASE_URL: https://os-partition-attcrcktoa-uc.a.run.app/
136
137
    # variables for backup tests
    BACKUP_SERVICE_HOST: $OSDU_GCP_BACKUP_HOST
138

Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
139
osdu-gcp-containerize:
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
140
  stage: containerize
141
  needs: ["compile-and-unit-test"]
142
  extends: .osdu-gcp-variables
143
  image: gcr.io/google.com/cloudsdktool/cloud-sdk
144
  cache: {}
145
  script:
146
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
147
    - gcloud config set project $OSDU_GCP_PROJECT
148
    - touch .gcloudignore
149
    - gcloud builds submit --config provider/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR/cloudbuild/cloudbuild.yaml --substitutions=_GCP_SERVICE=$OSDU_GCP_SERVICE,_APPLICATION_NAME=$OSDU_GCP_APPLICATION_NAME,_PROVIDER_NAME=$OSDU_GCP_VENDOR,_SHORT_SHA=$CI_COMMIT_SHORT_SHA,_PORT=$OSDU_GCP_PORT
150
151
152
153
  only:
    variables:
      - $OSDU_GCP == 'true'

154
osdu-gcp-deploy:
155
  image: gcr.io/google.com/cloudsdktool/cloud-sdk
156
  needs: ["osdu-gcp-containerize"]
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
157
  stage: deploy
158
  extends: .osdu-gcp-variables
159
  cache: {}
160
  script:
161
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
162
    - gcloud config set project $OSDU_GCP_PROJECT
163
    - >
164
165
166
      gcloud beta 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
167
      --region $OSDU_GCP_CLOUDRUN_REGION
168
169
170
171
      --allow-unauthenticated
      --service-account $OSDU_GCP_SERVICE_ACCOUNT
      --memory 512M
      $OSDU_GCP_CLOUD_RUN_PARAMETERS
172
      --set-env-vars=$OSDU_GCP_ENV_VARS
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
173
    - gcloud run services update-traffic $OSDU_GCP_APPLICATION_NAME --platform managed --region $OSDU_GCP_CLOUDRUN_REGION --to-latest
174
175
  only:
    variables:
176
      - $OSDU_GCP == 'true'
177
178

osdu-gcp-test:
179
  image: maven:3.3.9-jdk-8
180
181
  extends:
    - .osdu-gcp-variables
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
182
    - .maven
183
  stage: integration
184
  needs: ["osdu-gcp-deploy"]
185
  allow_failure: false
186
187
188
189
190
191
192
193
  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
194
195
196
197
    DE_OPS_TESTER: $OSDU_GCP_R3_OPS_TESTER
    DE_ADMIN_TESTER: $OSDU_GCP_R3_ADMIN_TESTER
    DE_EDITOR_TESTER: $OSDU_GCP_R3_EDITOR_TESTER
    DE_NO_ACCESS_TESTER: $OSDU_GCP_R3_NO_ACCESS_TESTER
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
198
199
200
201
202
203
204
205
    STORAGE_URL: $OSDU_GCP_STORAGE_URL
    DEPLOY_ENV: empty
    LEGAL_URL: $OSDU_GCP_LEGAL_HOST_URL
    PUBSUB_TOKEN: $GCP_PUBSUB_TOKEN
    INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
    NO_DATA_ACCESS_TESTER: $OSDU_GCP_NO_DATA_ACCESS_TESTER
    SEARCH_INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
    HOST_URL: $OSDU_GCP_LEGAL_HOST_URL
206
207
    INDEXER_HOST: $OSDU_GCP_INDEXER_HOST_SEARCH
    OSDU_GCP_TESTING_DIR: testing
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
208
    TEST_DAG_NAME: $OSDU_GCP_TEST_DAG_NAME
209
  script:
210
    - export GCP_DEPLOY_FILE=$(echo $OSDU_GCP_DEPLOY_FILE)
211
    - >
212
213
214
      mvn
      --batch-mode
      --settings=$CI_PROJECT_DIR/.mvn/community-maven.settings.xml
215
      -f $OSDU_GCP_TESTING_DIR/pom.xml
216
217
218
      verify
      --projects $OSDU_GCP_SERVICE-test-core,$OSDU_GCP_SERVICE-test-gcp
      2>&1 | tee test-results.log
219
220
  only:
    variables:
221
      - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE != 'python'
222
223
224
225
226
  artifacts:
    when: always
    paths:
      - test-results.log
    expire_in: 1 week
227
228
229
230
231
232
233

osdu-gcp-test-python:
  extends:
    - .osdu-gcp-variables
  variables:
    INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
    MY_TENANT: osdu
234
    GOOGLE_AUDIENCES: $GOOGLE_AUDIENCE
235
236
  stage: integration
  image: python:3.7
237
  needs: ["osdu-gcp-deploy"]
238
239
  allow_failure: false
  script:
240
    - cd $OSDU_GCP_PYTHON_INT_TEST_SUBDIR
241
242
243
244
245
    - chmod +x ./run-integration-tests.sh
    - ./run-integration-tests.sh
  only:
    variables:
      - $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE == 'python'
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
246
247
248
249
250
251
252
253
254
255
256
257

osdu-gcp-tagging:
  image: google/cloud-sdk
  needs: ["osdu-gcp-deploy"]
  stage: integration
  extends: .osdu-gcp-variables
  cache: {}
  script:
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
    - gcloud config set project $OSDU_GCP_PROJECT
    - gcloud container images add-tag gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_SERVICE-$OSDU_GCP_VENDOR:$CI_COMMIT_TAG
  only:
258
    - tags