Skip to content

Commit 014d39d

Browse files
authored
Merge pull request #1 from getindata/dev_prod_separation
New templates for DEV/PROD separation
2 parents 1f01476 + d331b52 commit 014d39d

File tree

2 files changed

+61
-11
lines changed

2 files changed

+61
-11
lines changed

dataops/dev_cicd_template.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
11
variables:
22
GITLAB_CICD_IMAGE_REPO: gcr.io/getindata-images-public/cicd-dataops
3-
GITLAB_CICD_IMAGE_TAG: gcp-0.1.1
3+
GITLAB_CICD_IMAGE_TAG: gcp-0.1.4
44
BLOB_CONFIG_PATH: blob_args.json
5+
GIT_KEY_PATH: TBS
56

67
dev:
78
image: $GITLAB_CICD_IMAGE_REPO:$GITLAB_CICD_IMAGE_TAG
9+
environment: DEVELOPMENT
810
stage: execute-dev
911
extends:
10-
- .setup
12+
- .dev_setup
1113
script:
12-
- dp compile --docker-build
14+
- dp compile --docker-build --env dev
1315
- dp deploy --blob-args $BLOB_CONFIG_PATH --datahub-ingest --docker-push
14-
- dp publish --key-path $GIT_KEY_PATH
16+
rules:
17+
- if: '$CI_COMMIT_BRANCH != "master"'
18+
- if: '$CI_COMMIT_BRANCH != "main"'
19+
20+
release-dev:
21+
image: $GITLAB_CICD_IMAGE_REPO:$GITLAB_CICD_IMAGE_TAG
22+
environment: DEVELOPMENT
23+
stage: execute-release
24+
extends:
25+
- .dev_setup
26+
script:
27+
- dp compile --help
28+
- dp compile --docker-build --env dev --docker-tag $CI_COMMIT_TAG
29+
- dp deploy --blob-args $BLOB_CONFIG_PATH --datahub-ingest --docker-push
30+
rules:
31+
- if: '$CI_COMMIT_TAG'
32+
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/' #expects 'vX.Y.Z'
33+
34+
release-prod:
35+
image: $GITLAB_CICD_IMAGE_REPO:$GITLAB_CICD_IMAGE_TAG
36+
environment: PRODUCTION
37+
dependencies:
38+
- release-dev
39+
stage: execute-release
40+
extends:
41+
- .prod_setup
42+
script:
43+
- dp compile --env prod --docker-tag CI_COMMIT_TAG
44+
- dp deploy --env prod --blob-args $BLOB_CONFIG_PATH --datahub-ingest
45+
- dp publish --key-path $GIT_KEY_PATH
46+
rules:
47+
- if: '$CI_COMMIT_TAG'
48+
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/' #expects 'vX.Y.Z'

dataops/gcp/gcp_setup_template.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
variables:
2+
GCP_KEY_PATH: TBS
3+
GCP_DOCKER_KEY_PATH: TBS
4+
GIT_KEY_PATH: TBD
25
DOCKER_REGISTRY: europe-central2-docker.pkg.dev
36
BLOB_CONFIG_PATH: blob_args.json
47

5-
.setup:
8+
.gcp_setup: &gcp_setup
9+
- gcloud --quiet components update
10+
- gcloud auth activate-service-account --key-file ${GCP_KEY_PATH}
11+
- echo "{\"token\":\"$GCP_KEY_PATH\"}" > $BLOB_CONFIG_PATH
12+
13+
.docker_setup: &docker_setup
14+
- gcloud auth configure-docker $DOCKER_REGISTRY
15+
16+
.git_setup: &git_setup
17+
- chmod 600 $GIT_KEY_PATH
18+
19+
.dev_setup:
20+
before_script:
21+
- *gcp_setup
22+
- *docker_setup
23+
24+
.prod_setup:
625
before_script:
7-
- gcloud --quiet components update
8-
- gcloud auth configure-docker $DOCKER_REGISTRY
9-
- gcloud auth activate-service-account --key-file ${GCP_KEY_PATH}
10-
- docker login -u _json_key -p "$(cat ${GCP_KEY_PATH})" "https://$DOCKER_REGISTRY"
11-
- chmod 600 $GIT_KEY_PATH
12-
- echo "{\"token\":\"$GCP_KEY_PATH\"}" > $BLOB_CONFIG_PATH
26+
- *gcp_setup
27+
- *docker_setup
28+
- *git_setup

0 commit comments

Comments
 (0)