-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (73 loc) · 2.47 KB
/
cd.yaml
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
name: 'CD'
on:
workflow_dispatch:
push:
branches:
- master
- staging
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
prepare:
name: 'Prepare'
uses: rfcx/cicd/.github/workflows/notify-prepare.yaml@master
with:
repo: ingest-service
workflow-id: cd.yaml
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
configure:
name: 'Configure'
runs-on: ubuntu-latest
needs: [prepare]
outputs:
namespace: ${{ steps.configuration.outputs.namespace }}
steps:
- name: 'Conditional environment'
id: configuration
run: |
if [[ "${{ needs.prepare.outputs.branch-name }}" == "master" ]]; then
echo "::set-output name=namespace::production"
elif [[ "${{ needs.prepare.outputs.branch-name }}" == "staging" ]]; then
echo "::set-output name=namespace::staging"
else
echo "::set-output name=namespace::testing"
fi
build:
name: 'Build'
needs: [prepare, configure]
uses: rfcx/cicd/.github/workflows/ecr-build-push.yaml@master
with:
dockerfile: build/Dockerfile
targets: "[\"ingest-service\"]"
tag-environment: ${{ needs.configure.outputs.namespace }}
tag-latest: ${{ needs.configure.outputs.namespace == 'production' }}
secrets:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
deploy:
name: 'Deploy'
needs: [build, configure]
uses: rfcx/cicd/.github/workflows/k8s-deploy.yaml@master
with:
tag: ${{ needs.build.outputs.unique-tag }}
namespace: ${{ needs.configure.outputs.namespace }}
secrets:
kube-config: ${{ secrets.KUBE_CONFIG_SUPER }}
notify:
name: 'Notify'
if: ${{ always() }}
needs: [prepare, build, deploy]
uses: rfcx/cicd/.github/workflows/notify-send.yaml@master
with:
repo: ingest-service
branch-name: ${{ needs.prepare.outputs.branch-name }}
workflow-id: cd.yaml
previous-run-id: ${{ needs.prepare.outputs.previous-run-id }}
status: ${{ needs.deploy.result }}
always: true
notification-title: 'CD: Ingest Service'
notification-footer: "Build: ${{ needs.build.result || 'n/a' }} | Deploy: ${{ needs.deploy.result || 'n/a' }}"
notification-success-statement: '{0} deployed the build!'
secrets:
slack-webhook: ${{ secrets.SLACK_ALERT_COREDT_WEBHOOK }}
github-token: ${{ secrets.GITHUB_TOKEN }}