feat(discourse): add delete sidekiq jobs cronjob (#168) #225
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint & Test Charts | |
on: | |
push: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.4.0 | |
# helm/chart-testing-action requires python version 3.7 | |
# see: https://github.com/helm/chart-testing-action/issues/65 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --config .github/ct.yaml) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Run chart-testing (lint) | |
run: ct lint --config .github/ct.yaml | |
test: | |
needs: "lint" | |
env: | |
NAMESPACE: "chart-ci-e2e" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
k8s_version: ["v1.19.16", "v1.20.15"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.4.0 | |
# helm/chart-testing-action requires python version 3.7 | |
# see: https://github.com/helm/chart-testing-action/issues/65 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --config .github/ct.yaml) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Create kind cluster | |
uses: helm/[email protected] | |
if: steps.list-changed.outputs.changed == 'true' | |
with: | |
node_image: "kindest/node:${{ matrix.k8s_version }}" | |
kubectl_version: "${{ matrix.k8s_version }}" | |
- name: Install Dependencies | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
set -e | |
kubectl create ns ${{ env.NAMESPACE }} | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo update | |
#### CAREERS POSTGRES #### | |
helm upgrade --install \ | |
--version 11.6.15 \ | |
--namespace ${{ env.NAMESPACE }} \ | |
--set postgresqlPassword=defaultpassword \ | |
--set postgresqlUsername=careers \ | |
--set postgresqlDatabase=careers \ | |
--set fullnameOverride=careers-psql \ | |
careers-psql bitnami/postgresql | |
#### CTMS POSTGRES #### | |
helm upgrade --install \ | |
--version 11.6.15 \ | |
--namespace ${{ env.NAMESPACE }} \ | |
--set postgresqlPassword=defaultpassword \ | |
--set postgresqlUsername=ctms \ | |
--set postgresqlDatabase=ctms \ | |
--set fullnameOverride=postgres \ | |
postgresql bitnami/postgresql | |
#### DISCOURSE POSTGRES, REDIS #### | |
helm upgrade --install \ | |
--version 11.6.15 \ | |
--namespace ${{ env.NAMESPACE }} \ | |
--set fullnameOverride=discourse-psql \ | |
--set persistence.enabled=false \ | |
--set postgresqlDatabase=discourse \ | |
--set postgresqlPassword=discourse-psql-password \ | |
--set postgresqlUsername=postgres \ | |
postgresql-discourse bitnami/postgresql | |
helm upgrade --install \ | |
--version 16.13.2 \ | |
--namespace ${{ env.NAMESPACE }} \ | |
--set auth.enabled=true \ | |
--set auth.password=discourse-redis-password \ | |
--set fullnameOverride=discourse-redis \ | |
--set persistence.enabled=false \ | |
redis-discourse bitnami/redis | |
#### PROMETHEUS-CUSTOMIZATIONS CONFIGMAPSECRETS #### | |
helm upgrade --install \ | |
--namespace ${{ env.NAMESPACE }} \ | |
configmapsecrets charts/configmapsecrets | |
- name: Configure AWS credentials | |
if: steps.list-changed.outputs.changed == 'true' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::783633885093:role/ecr-readonly-iam | |
aws-region: us-west-2 | |
- name: Install ECR Secret | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
# Gets a valid token to pull from ECR and creates a secret with it | |
REGION=us-west-2 | |
SECRET_NAME=ecr-registry | |
[email protected] | |
# Fetch token (which will expire in 12 hours) | |
TOKEN=$(aws ecr --region=${REGION} get-authorization-token --output text --query authorizationData[].authorizationToken | base64 -d | cut -d: -f2) | |
# Create or replace secret | |
kubectl delete secret -n ${{ env.NAMESPACE }} --ignore-not-found "$SECRET_NAME" | |
kubectl create secret -n ${{ env.NAMESPACE }} docker-registry "$SECRET_NAME" \ | |
--docker-server="https://783633885093.dkr.ecr.${REGION}.amazonaws.com" \ | |
--docker-username=AWS \ | |
--docker-password="${TOKEN}" \ | |
--docker-email="${EMAIL}" | |
- name: Run chart-testing (install) | |
run: ct install --config .github/ct.yaml --namespace=${{ env.NAMESPACE }} |