-
Notifications
You must be signed in to change notification settings - Fork 9
129 lines (113 loc) · 4.41 KB
/
push.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
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
name: Install applications on Kubernets
on:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
jobs:
install:
strategy:
matrix:
K3S_VERSION: ["v1.27.14+k3s1", "v1.28.10+k3s1", "v1.29.5+k3s1", "v1.30.1+k3s1"]
exclude:
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.27.14+k3s1' }}
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.28.10+k3s1' }}
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.29.5+k3s1' }}
runs-on: self-hosted
steps:
- name: Cleanup
continue-on-error: true
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v3
- name: Install dependencies
env:
HELM_VERSION: "v3.11.3"
HELM_DIFF_VERSION: "3.6.0"
HELMFILE_VERSION: "v0.152.0"
YQ_VERSION: "v4.33.3"
run: |
./.github/ci_config/bin/install-dependencies
- name: Prepare the environment (add secrets and enable installation of all components)
run: |
DNAME='CN=CI,O=TheHyve,L=Utrecht,C=NL' ./bin/init
helmfile_mods='\ \ \ \ \ \ - ../.github/ci_config/ci-config.yaml\n'
helmfile_mods+='\ \ \ \ \ \ - ../.github/ci_config/secrets.yaml.gotmpl'
sed -i "/secrets.yaml/a $helmfile_mods" environments.yaml
sed -i '/_install: /s/false/true/' etc/production.yaml
sed -i '/enable_logging_monitoring: /s/false/true/' etc/production.yaml
- name: Run helmfile template
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
helmfile template
- name: Reinstall K3S
env:
INSTALL_K3S_VERSION: ${{ matrix.K3S_VERSION }}
K3S_KUBECONFIG_MODE: "644"
run: |
/usr/local/bin/k3s-uninstall.sh || true
curl -sfL https://get.k3s.io | sh -s - --disable traefik --disable-helm-controller
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Install RADAR-Kubernetes
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
echo "kubeconfig: $KUBECONFIG"
kubectl get pods --all-namespaces
helmfile sync --concurrency 1
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Manually triggered tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
- name: Slack Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ci-notifications
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: 'The job has failed, go to https://github.com/RADAR-base/RADAR-Kubernetes/actions and use SSH for more information'
SLACK_TITLE: Post Title
SLACK_USERNAME: rtCamp
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Setup tmate session if jobs have failed
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
with:
limit-access-to-actor: true
- name: Report cluster state
if: always()
run: |
kubectl get pods --all-namespaces
# TODO We can remove the k3s uninstallation once the k3d PR is merged.
- name: Delete clusters when job was canceled
if: cancelled()
run: |
k3d cluster delete --all || true
k3s-uninstall.sh || true
check-gitignore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check gitignore
run: |
echo "Checking whether any files that should be ignored are uploaded"
echo
if find . -not -path './.git/*' -type f | git check-ignore --stdin --no-index; then
echo
echo "Remove the above files from this branch"
exit 1
else
echo "No ignored files have been added"
fi