-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
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
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 |