Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to Workflow Dispatch to reset Dev #754

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: CICD

on:
workflow_dispatch:
inputs:
reset-deployments:
description: "Reset deployment: Clean start"
required: false
default: false
type: boolean
push:
branches:
- master
Expand Down Expand Up @@ -340,6 +346,7 @@ jobs:
cancel-in-progress: false
environment:
name: ${{
github.event.inputs.reset-deployments == 'true' && 'dev' ||
github.event_name == 'release' && 'prod' ||
(github.event_name == 'push' && github.event.repository.default_branch == github.ref_name) && 'stage' ||
'dev'
Expand Down Expand Up @@ -394,6 +401,36 @@ jobs:
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: ${{ env.TAILSCALE_VERSION }}
- name: Helmfile Destroy
if: github.event.inputs.reset-deployments == 'true'
uses: helmfile/helmfile-action@v1.9.0
with:
helmfile-args: |
destroy \
--environment dev
helm-plugins: |
https://github.com/databus23/helm-diff,
https://github.com/jkroepke/helm-secrets,
https://github.com/aslafy-z/helm-git
helmfile-version: ${{ env.HELMFILE_VERSION }}
helm-version: ${{ env.HELM_VERSION }}
- name: Delete Pods and PVCs
if: github.event.inputs.reset-deployments == 'true'
run: kubectl delete pods,pvc --all --namespace yoma-v3-dev
- name: Deploy fresh DBs
if: github.event.inputs.reset-deployments == 'true'
uses: helmfile/helmfile-action@v1.9.0
with:
helmfile-args: |
apply \
--environment dev \
--selector=app=postgresql-keycloak \
--selector=app=postgresql \
--selector=app=redis
helm-plugins: |
https://github.com/databus23/helm-diff,
https://github.com/jkroepke/helm-secrets,
https://github.com/aslafy-z/helm-git
# Diff on PR draft, otherwise Apply
- name: Helmfile Apply/Diff Keycloak
if: (
Expand Down
4 changes: 3 additions & 1 deletion helm/keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ keycloak:

serviceAccount:
create: true
allowReadPods: true
# This creates a ClusterRole and ClusterRolebinding which is not needed
allowReadPods: false

# This creates a Role and Rolebinding which makes the above ClusterRole and ClusterRolebinding redundant
rbac:
create: true
rules:
Expand Down
13 changes: 9 additions & 4 deletions helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ releases:
namespace: {{ .Values.namespace }}
# https://github.com/bitnami/charts/tree/main/bitnami/postgresql
chart: oci://registry-1.docker.io/bitnamicharts/postgresql
version: "14.3.1"
version: "15.2.5"
installed: {{ .Values.postgresEnabled }}
set:
- name: fullnameOverride
Expand All @@ -81,6 +81,8 @@ releases:
value: keycloak
- name: auth.database
value: keycloak
- name: primary.resourcesPreset
value: medium
secrets:
- ./helm/postgresql-keycloak/conf/{{ .Environment.Name }}/secrets.yaml

Expand All @@ -90,7 +92,7 @@ releases:
namespace: {{ .Values.namespace }}
# https://github.com/bitnami/charts/tree/main/bitnami/postgresql
chart: oci://registry-1.docker.io/bitnamicharts/postgresql
version: "14.3.1"
version: "15.2.5"
installed: {{ .Values.postgresEnabled }}
set:
- name: fullnameOverride
Expand All @@ -99,6 +101,8 @@ releases:
value: yoma
- name: auth.database
value: yoma-dev
- name: primary.resourcesPreset
value: medium
# - name: primary.extendedConfiguration
# value: |
# log_statement = 'all'
Expand All @@ -110,8 +114,9 @@ releases:
labels:
app: redis
namespace: {{ .Values.namespace }}
# https://github.com/bitnami/charts/tree/main/bitnami/redis
chart: oci://registry-1.docker.io/bitnamicharts/redis
version: "19.1.0"
version: "19.1.3"
installed: {{ .Values.redisEnabled }}
values:
- fullnameOverride: redis
Expand Down Expand Up @@ -176,7 +181,7 @@ releases:
- ./helm/yoma-web/conf/{{ .Environment.Name }}/secrets.yaml
---
helmDefaults:
timeout: 180
timeout: 300
wait: true
atomic: true
cleanupOnFail: true
Expand Down
Loading