osdu-gcp-cloudrun.yml 5.01 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
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
28
    OSDU_GCP_ENTITLEMENTS_URL: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
29
30
31
    OSDU_GCP_AUTHORIZE_API: $OSDU_GCP_ENTITLEMENTS_URL
    OSDU_GCP_STORAGE_URL: https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2/
    OSDU_GCP_RECORDS_ROOT_URL: $OSDU_GCP_STORAGE_URL
32
    OSDU_GCP_LEGAL_HOST_URL: https://os-legal-dot-nice-etching-277309.uc.r.appspot.com/api/legal/v1/
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
33
34
    OSDU_GCP_AIRFLOW_URL: https://c410714dc037b0e02p-tp.appspot.com
    OSDU_GCP_DELIVERY_SERVICE_URL: https://os-file-attcrcktoa-uc.a.run.app
35
36
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
    OSDU_GCP_SEARCH_HOST: https://os-search-dot-nice-etching-277309.uc.r.appspot.com/api/search/v2/
    OSDU_GCP_SEARCH_QUERY_URL: https://os-search-dot-nice-etching-277309.uc.r.appspot.com//api/search/v2/query
39
    # env parameters
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
40
41
    OSDU_GCP_INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    OSDU_GCP_DEPLOY_ENV: dev
42
    OSDU_GCP_DOMAIN: osdu-gcp.go3-nrg.projects.epam.com
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
43
44
45
46
47
48
    OSDU_GCP_TENANT_NAME: osdu
    OSDU_GCP_MY_TENANT_PROJECT: osdu
    OSDU_GCP_MY_TENANT: osdu
    OSDU_GCP_CLOUDRUN_REGION: us-central1
    OSDU_GCP_PROJECT: nice-etching-277309
    OSDU_GCP_VPC_CONNECTOR: osdu-connector
49
50
51
52
53
54
55
    # common integration tests variables
    GOOGLE_AUDIENCE: $OSDU_GCP_INTEGRATION_TEST_AUDIENCE
    DOMAIN: $OSDU_GCP_DOMAIN
    OTHER_RELEVANT_DATA_COUNTRIES: US
    DEFAULT_DATA_PARTITION_ID_TENANT1: $OSDU_GCP_TENANT_NAME
    LEGAL_TAG: osdu-demo-legaltag
    GCLOUD_PROJECT: $OSDU_GCP_PROJECT
56
57
    # integration test variables for ingestion workflow
    WORKFLOW_HOST: $OSDU_GCP_WORKFLOW_SERVICE_URL
58
59
    FINISHED_WORKFLOW_ID: $OSDU_GCP_FINISHED_WORKFLOW_ID
    TEST_FILE_ID: $OSDU_GCP_TEST_FILE_ID
60
    # integration test variables for ingestion service
61
62
    INGEST_HOST: $OSDU_GCP_INGEST_HOST
    TEST_OSDU_FILE_PATH: $OSDU_GCP_TEST_OSDU_FILE_PATH
63
64
65
66
67
68
69
70
71
    # integration test variables for delivery service
    STORAGE_HOST: $OSDU_GCP_STORAGE_URL
    ENTITLEMENTS_DOMAIN: $OSDU_GCP_DOMAIN
    TENANT: $OSDU_GCP_TENANT_NAME
    DEFAULT_DATA_PARTITION_ID_TENANT2: $OSDU_GCP_TENANT_NAME
    SEARCH_INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER
    INTEGRATION_TEST_AUDIENCE: $OSDU_GCP_INTEGRATION_TEST_AUDIENCE
    SEARCH_HOST: $OSDU_GCP_SEARCH_HOST
    DELIVERY_HOST: $OSDU_GCP_DELIVERY_SERVICE_URL
72
    
73

Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
74
osdu-gcp-containerize:
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
75
  stage: containerize
76
  needs: ["compile-and-unit-test"]
77
  extends: .osdu-gcp-variables
78
79
80
  image: google/cloud-sdk
  cache: {}
  script:
81
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
82
    - gcloud config set project $OSDU_GCP_PROJECT
83
    - touch .gcloudignore
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
84
    - 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
85
86
87
88
  only:
    variables:
      - $OSDU_GCP == 'true'

89
osdu-gcp-deploy:
90
  image: google/cloud-sdk
91
  needs: ["osdu-gcp-containerize"]
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
92
  stage: deploy
93
  extends: .osdu-gcp-variables
94
95
  cache: {}
  script:
96
    - gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
97
    - gcloud config set project $OSDU_GCP_PROJECT
98
    - 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
99
100
  only:
    variables:
101
      - $OSDU_GCP == 'true'
102
103

osdu-gcp-test:
104
  image: maven:3.3.9-jdk-8
105
106
107
108
  extends:
    - .osdu-gcp-variables
  stage: integration
  needs: ["osdu-gcp-deploy"]
109
  allow_failure: true
110
  script:
111
112
    - export INTEGRATION_TESTER=$(echo $OSDU_GCP_R3_INTEGRATION_TESTER) 
    - export NO_DATA_ACCESS_TESTER=$(echo $OSDU_GCP_R3_NO_DATA_ACCESS_TESTER)
113
114
    - export GCP_DEPLOY_FILE=$(echo $OSDU_GCP_DEPLOY_FILE)
    - 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
115
116
117
  only:
    variables:
      - $OSDU_GCP == 'true'