This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodefresh.yml
103 lines (93 loc) · 2.96 KB
/
codefresh.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
version: "1.0"
steps:
# Set up some environment variables. These could be stored as secret vars in codefresh.
set-production-vars:
image: alpine:latest
commands:
- cf_export K8S_CLUSTER=prod-credimi-com
- cf_export BUILD_IMAGE="credimi/${{CF_REPO_NAME}}:${{CF_SHORT_REVISION}}"
- cf_export HOST="block.credimi.com"
- cf_export NAMESPACE="prod"
- cf_export MIAOW="prod"
- cf_export PORT="80"
- cf_export LOGGING_LEVEL="info"
- cf_export INGRESS_CLASS=public-ingress
when:
condition:
all:
semverTag: 'match("${{CF_BRANCH}}", "^release-[0-9]{8}|[a-z]\b", true) == true'
set-staging-vars:
image: alpine:latest
environment:
- TLD=qa.credimi.com
commands:
- cf_export K8S_CLUSTER=qa-credimi-com
- cf_export BUILD_IMAGE="credimi/${{CF_REPO_NAME}}:${{CF_SHORT_REVISION}}"
- cf_export HOST="${{CF_BRANCH_TAG_NORMALIZED}}-block.$TLD"
- cf_export NAMESPACE="${{CF_BRANCH_TAG_NORMALIZED}}"
- cf_export MIAOW="staging"
- cf_export PORT="80"
- cf_export LOGGING_LEVEL="debug"
- cf_export INGRESS_CLASS=internal-ingress
when:
condition:
any:
semverTag: 'match("${{CF_BRANCH}}", "^release-[0-9]{8}|[a-z]\b", true) == false'
# It's often very useful to see what vars are available in the build environment
see-them-vars:
image: alpine:latest
commands:
- env
build:
type: build
image-name: credimi/${{CF_REPO_NAME}}
tag: ${{CF_SHORT_REVISION}}
publish:
type: push
candidate: ${{build}}
tag: ${{CF_SHORT_REVISION}}
credentials:
username: ${{DOCKERHUB_USERNAME}}
password: ${{DOCKERHUB_PWD}}
fail-fast: false
running-namespace-script:
type: deploy
kind: kubernetes
cluster: ${{K8S_CLUSTER}}
namespace: ${{NAMESPACE}}
file_path: ./k8s/namespace.yaml
when:
condition:
any:
semverTag: 'match("${{CF_BRANCH}}", "^release-[0-9]{8}|[a-z]\b", true) == false'
running-deploy-script:
type: deploy
kind: kubernetes
cluster: ${{K8S_CLUSTER}}
namespace: ${{NAMESPACE}}
file_path: ./k8s/deployment.yaml
running-service-script:
type: deploy
kind: kubernetes
cluster: ${{K8S_CLUSTER}}
namespace: ${{NAMESPACE}}
file_path: ./k8s/service.yaml
running-ingress-script:
type: deploy
kind: kubernetes
cluster: ${{K8S_CLUSTER}}
namespace: ${{NAMESPACE}}
file_path: ./k8s/ingress.yaml
# Report status and review app URL back to Github.
notify-git-hub-pr-env-creating:
image: cloudposse/github-status-updater
environment:
- GITHUB_ACTION=update_state
- GITHUB_TOKEN=${{GITHUB_TOKEN}}
- GITHUB_OWNER=${{CF_REPO_OWNER}}
- GITHUB_REPO=${{CF_REPO_NAME}}
- GITHUB_REF=${{CF_REVISION}}
- GITHUB_CONTEXT=Pull Request Environment
- GITHUB_STATE=success
- GITHUB_DESCRIPTION=Creating Pull Request Environment
- GITHUB_TARGET_URL=http://${{HOST}}