-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
144 lines (144 loc) · 4.69 KB
/
Copy pathaction.yml
File metadata and controls
144 lines (144 loc) · 4.69 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: 'Deploy apps'
description: 'Update charts for deploy'
inputs:
app-name:
description: 'Application id'
required: false
default: ''
aws-role:
description: 'Aws role to apply changes'
required: true
aws-region:
description: 'Aws region'
default: 'eu-central-1'
debug:
description: 'Debug mode'
default: "false"
github-ssh:
description: 'Github ssh key to pull terragrunt from github api'
required: true
github-token:
description: 'Github token to pull package to avoid limit rate'
default: ''
helm-git-url:
description: 'Git url to use for pulling repo ArgoCD'
default: 'git@gitlab.com:orisha-group/construction/advae/finalcad-one/infrastructure/eks-apps.git'
helm-ref:
description: 'Ref to use for pulling helm repo'
default: ''
registry:
description: 'Registry name for app'
default: ''
sqitch:
description: 'Only trigger sqitch deploy'
default: "false"
environment:
description: 'Finalcad envrionment: production, staging, sandbox'
required: true
regions:
description: 'Regions: eu, ap'
default: 'eu,ap'
tag:
description: 'Tag to deploy'
default: ''
override-file:
description: 'Path relative to project SCM root for override configuration file'
default: '.finalcad/overrides.yaml'
additional-override-files:
description: 'Comma-separated list of additional override files relative to current directory'
default: ''
dry-run:
description: "Don't modify any thing, just print generated files"
default: 'false'
runs:
using: 'composite'
steps:
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ inputs.github-ssh }}
- name: Setup SSH known hosts
shell: bash
run: |
echo '::group::Setup SSH known hosts'
[[ -d ~/.ssh ]] || mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
echo '::endgroup::'
- name: Checkout app repository
uses: actions/checkout@v7
with:
path: 'app'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-region: ${{ inputs.aws-region }}
role-to-assume: ${{ inputs.aws-role }}
role-session-name: OIDCSession
- name: "Checkout ArgoCD repository"
shell: bash
run: |
echo '::group::Checkout ArgoCD repository'
clone_args=(
--progress
)
[[ -z '${{ inputs.helm-ref }}' ]] || clone_args+=(--branch '${{ inputs.helm-ref }}')
clone_args+=(
--depth 1
--no-tags
'${{ inputs.helm-git-url }}'
'helm'
)
git clone "${clone_args[@]}"
echo '::endgroup::'
- name: Setup go
uses: actions/setup-go@v7
with:
token: ${{ inputs.github-token }}
go-version: 1.18
- name: Setup helm
uses: azure/setup-helm@v5
with:
token: ${{ inputs.github-token }}
- name: Setup kubeconform & yq & cue
shell: bash
run: |
go install github.com/yannh/kubeconform/cmd/kubeconform@v0.6.1
go install cuelang.org/go/cmd/cue@v0.6.0
mkdir -p ${RUNNER_TEMP}/yq
wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${RUNNER_TEMP}/yq/yq"
chmod +x "${RUNNER_TEMP}/yq/yq"
echo "${RUNNER_TEMP}/yq" >> $GITHUB_PATH
- name: Get username & email of actor
id: actor
shell: bash
run: |
echo "actor-email=$(git log -1 --pretty=format:'%ae')" >> $GITHUB_OUTPUT
echo "actor-name=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT
- name: Update deployment manifest
shell: bash
working-directory: ./helm
env:
REGIONS: ${{ inputs.regions }}
REGISTRY: ${{ inputs.registry }}
AWS_REGION: ${{ inputs.aws-region }}
ENVIRONMENT: ${{ inputs.environment }}
APPNAME: ${{ inputs.app-name }}
SQITCH: ${{ inputs.sqitch }}
DEBUG: ${{ inputs.debug }}
REF: ${{ inputs.tag }}
ACTOR_EMAIL: ${{ steps.actor.outputs.actor-email }}
ACTOR_NAME: ${{ steps.actor.outputs.actor-name }}
OVERRIDE_PATH: ${{ github.workspace }}/app/${{ inputs.override-file }}
OVERRIDE_ADDITIONAL_PATHES: "${{ inputs.additional-override-files }}"
DEFAULT_FILE: ${{ github.action_path }}/default.yaml
DRY_RUN: ${{ inputs.dry-run }}
DEFAULT_KUBEVERSION: "1.35.0"
run: |
bash ${GITHUB_ACTION_PATH}/update.sh
- name: Clear local repositories
shell: bash
run: |
echo '::group::Clear local repositories'
rm -rf './helm'
echo '::endgroup::'