-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (116 loc) · 3.83 KB
/
Copy pathdeployment.yaml
File metadata and controls
116 lines (116 loc) · 3.83 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Reusable Deployment
on:
workflow_call:
inputs:
appName:
required: false
type: string
author:
required: true
description: The author of the change that triggers the deployment
type: string
containerContext:
required: false
default: .
type: string
containerFile:
required: false
default: Containerfile
type: string
description:
required: true
description: The description of the change (e.g. the commit title)
type: string
env:
required: true
description: The application environment. Can be test, staging or prod.
type: string
namespace:
required: false
description: EKS namespace
type: string
pushToEnvTag:
required: false
description: Push commits to env-named tags instead of the main branch
type: boolean
default: false
ref:
required: false
description: The github ref to deploy
default: main
type: string
runner:
required: false
description: Runner type
default: ubuntu-latest
type: string
timeoutMinutes:
required: false
description: Maximum minutes before the job is cancelled
default: 40
type: number
statusUrl:
required: false
description: The url that shows the status of the application
type: string
url:
required: false
description: The url where the application is served
type: string
versionKey:
required: false
type: string
secrets:
repoAccessToken:
required: true
description: The Github token to perform operations cross-repo (not secrets.GITHUB_TOKEN!)
jobs:
kubernetes:
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeoutMinutes }}
steps:
- name: Checkout current git repository
uses: actions/checkout@v7
- name: Load k8s deployment variables
id: k8s
run: |
if [[ "${{ inputs.env }}" == 'prod' ]]
then
URL="https://${{ inputs.appName }}.parcellab.dev"
STATUS_URL="https://argocd.${{ inputs.env }}.parcellab.dev/applications/${{ inputs.appName }}"
else
URL="https://${{ inputs.appName }}.${{ inputs.env }}.parcellab.dev"
STATUS_URL="https://argocd.${{ inputs.env }}.parcellab.dev/applications/${{ inputs.appName }}"
fi
# shellcheck disable=SC2086
echo "url=$URL" >> $GITHUB_OUTPUT
# shellcheck disable=SC2086
echo "status-url=$STATUS_URL" >> $GITHUB_OUTPUT
- name: Create Github deployment
uses: chrnorm/deployment-action@v2
with:
auto-merge: false
environment: ${{ inputs.env }}
ref: ${{ inputs.ref }}
required-contexts: ""
payload: |
{
"author": ${{ toJSON(inputs.author) }},
"description": ${{ toJSON(inputs.description) }},
"env": ${{ toJSON(inputs.env) }},
"name": "${{ inputs.appName }}",
"container": {
"context": "${{ inputs.containerContext }}",
"file": "${{ inputs.Containerfile }}"
},
"kubernetes": {
"namespace": "${{ inputs.namespace }}",
"versionKey": "${{ inputs.versionKey }}"
},
"pushToEnvTag": "${{ inputs.pushToEnvTag }}",
"statusUrl": ${{ toJSON(steps.k8s.outputs.status-url) }},
"url": ${{ toJSON(steps.k8s.outputs.url) }}
}
production-environment: "${{ inputs.env == 'prod' }}"
transient-environment: "${{ inputs.env == 'test' }}"
token: ${{ secrets.repoAccessToken }}