Skip to content

Commit

Permalink
add multi env initial workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamloe committed May 22, 2024
1 parent 023fc61 commit 1ebd28d
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/logzio-monitoring-multi-env-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Test Logzio Monitoring Helm Chart on EKS Kubernetes Environments

on:
pull_request:
branches:
- main
paths:
- 'charts/logzio-monitoring/**'
jobs:
test-helm-chart:
name: Test Helm Chart
runs-on: ubuntu-latest
strategy:
matrix:
environment: [eks-fargate, eks-linux, eks-windows]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'

- name: Set up Helm
uses: azure/setup-helm@v4.2.0

- name: Set up kubectl
uses: azure/setup-kubectl@v3

- name: Set up eksctl
run: |
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
# (Optional) Verify checksum
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
sudo mv /tmp/eksctl /usr/local/bin
- name: Provision Cluster
id: provision
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NUMBER_OF_NODES: 2
AWS_REGION: us-east-1
run: |
case ${{ matrix.environment }} in
eks-linux)
eksctl create cluster --name ${{ github.run_id }}-${{ matrix.environment }} --region $AWS_REGION --nodes $NUMBER_OF_NODES
aws eks --region $AWS_REGION update-kubeconfig --name ${{ github.run_id }}-${{ matrix.environment }}
;;
eks-windows)
eksctl create cluster --name ${{ github.run_id }}-${{ matrix.environment }} --region $AWS_REGION --nodes $NUMBER_OF_NODES --node-ami-family WindowsServer2019FullContainer
aws eks --region $AWS_REGION update-kubeconfig --name ${{ github.run_id }}-${{ matrix.environment }}
;;
eks-fargate)
eksctl create cluster --name ${{ github.run_id }}-${{ matrix.environment }} --region $AWS_REGION --fargate
aws eks --region $AWS_REGION update-kubeconfig --name ${{ github.run_id }}-${{ matrix.environment }}
;;
esac
- name: Deploy Helm Chart
run: |
cd charts/logzio-monitoring
helm upgrade --install \
logzio-monitoring-${{ github.run_id }} .
- name: Run Go Tests
env:
KUBERNETES_ENV: ${{ matrix.environment }}
ENV_ID: ${{ github.run_id }}-${{ matrix.environment }}
run: |
go test -v ./tests
- name: Cleanup Environment
run: |
helm uninstall my-release
- name: Delete Cluster
if: always()
run: |
case ${{ matrix.environment }} in
eks-linux)
eksctl delete cluster --name ${{ github.run_id }}-${{ matrix.environment }}
;;
eks-windows)
eksctl delete cluster --name ${{ github.run_id }}-${{ matrix.environment }}
;;
eks-fargate)
eksctl delete cluster --name ${{ github.run_id }}-${{ matrix.environment }}
;;
esac

0 comments on commit 1ebd28d

Please sign in to comment.