osdu-gcp-cloudrun.yml 3.19 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
.osdu-gcp-variables:
18
  variables:
19
    # service accounts
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
20
21
22
    OSDU_GCP_SERVICE_ACCOUNT: osdu-gcp-sa@nice-etching-277309.iam.gserviceaccount.com
    OSDU_GCP_INTEGRATION_TESTER: $OSDU_GCP_INTEGRATION_TESTER  # $OSDU_GCP_INTEGRATION_TESTER
    OSDU_GCP_NO_DATA_ACCESS_TESTER: $EPAM_GCP_NO_DATA_ACCESS_TESTER  # $OSDU_GCP_NO_DATA_ACCESS_TESTER
23
    #services' urls
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
24
25
26
27
28
29
    OSDU_GCP_STORAGE_URL: https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2/
    OSDU_GCP_AUTHORIZE_API: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
    OSDU_GCP_ENTITLEMENTS_URL: https://os-entitlements-gcp-attcrcktoa-uc.a.run.app/entitlements/v1/
    OSDU_GCP_LEGAL_HOST_URL: https://os-legal-dot-nice-etching-277309.uc.r.appspot.com/api/legal/v1/ 
    OSDU_GCP_AIRFLOW_URL: https://c410714dc037b0e02p-tp.appspot.com
    OSDU_GCP_DELIVERY_SERVICE_URL: https://os-file-attcrcktoa-uc.a.run.app
30
    # env parameters
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
31
32
33
34
35
36
37
38
39
    OSDU_GCP_INTEGRATION_TEST_AUDIENCE: 689762842995-pv217jo3k8j803kk6gqf52qb5amos3a9.apps.googleusercontent.com
    OSDU_GCP_DEPLOY_ENV: dev
    OSDU_GCP_DOMAIN: osdu-gcp.go3-nrg.projects.epam.com 
    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
40
41


Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
42
osdu-gcp-containerize:
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
43
  stage: containerize
44
  needs: ['compile-and-unit-test']
45
  extends: .osdu-gcp-variables
46
47
48
49
  image: google/cloud-sdk
  cache: {}
  script:
    - gcloud auth activate-service-account --key-file $EPAM_GCP_DEPLOY_FILE # $OSDU_GCP_DEPLOY_FILE 
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
50
    - gcloud config set project $OSDU_GCP_PROJECT
51
    - touch .gcloudignore
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
52
    - 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
53
54
55
56
  only:
    variables:
      - $OSDU_GCP == 'true'

57

58
osdu-gcp-deploy:
59
  image: google/cloud-sdk
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
60
  needs: ['osdu-gcp-containerize']
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
61
  stage: deploy
62
  extends: .osdu-gcp-variables
63
64
65
  cache: {}
  script:
    - gcloud auth activate-service-account --key-file $EPAM_GCP_DEPLOY_FILE # $OSDU_GCP_DEPLOY_FILE
Aliaksandr Ramanovich (EPAM)'s avatar
Aliaksandr Ramanovich (EPAM) committed
66
67
    - gcloud config set project $OSDU_GCP_PROJECT
    - 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 --region $OSDU_GCP_CLOUDRUN_REGION --allow-unauthenticated --service-account $OSDU_GCP_SERVICE_ACCOUNT --memory 512M --set-env-vars=$OSDU_GCP_ENV_VARS
68
69
70
  only:
    variables:
      - $OSDU_GCP == 'true'