WIFI-13871 CGW deploy testing (#951)

Signed-off-by: Carsten Schafer <Carsten.Schafer@kinarasystems.com>
Co-authored-by: Carsten Schafer <Carsten.Schafer@kinarasystems.com>
This commit is contained in:
Carsten Schafer
2024-06-26 17:22:10 -04:00
committed by GitHub
parent c56c4f8e80
commit e96df54c02

View File

@@ -0,0 +1,126 @@
name: Update CGW01 OpenLAN Cloud Gateway on tip-wlan-main
defaults:
run:
shell: bash
env:
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: ap-south-1
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script
# # Required object fiels per environment:
# # - namespace - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'openlan-test')
# # - cgw_version - OpenLAN Cloud Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
# # - just_component - if true then deploy only cgw chart
testbeds: '[
{
"namespace": "cgw01",
"cgw_version": "main",
"just_component": "false"
}
]'
on:
workflow_dispatch:
inputs:
just_component:
default: 'false'
description: 'Just deploy component, not all the other services'
required: true
id:
description: 'run identifier'
required: false
jobs:
id:
name: Workflow ID Provider
runs-on: ubuntu-latest
steps:
- name: ${{ github.event.inputs.id }}
run: echo run identifier ${{ inputs.id }}
generate-matrix:
name: Generate matrix for build
runs-on: ubuntu-latest
needs:
- id
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: generate-matrix
id: set-matrix
run: |
cat >> $GITHUB_OUTPUT << EOF
matrix={"include":${{ env.testbeds }}}
EOF
deploy:
name: Update OpenLAN Cloud SDK instances
runs-on: ubuntu-latest
needs:
- id
- generate-matrix
strategy:
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
fail-fast: false
steps:
- name: Checkout repo with Helm values
uses: actions/checkout@v4
with:
repository: Telecominfraproject/wlan-cloud-ucentral-deploy
path: wlan-cloud-ucentral-deploy
ref: ${{ matrix.chart_version }}
- name: Fetch kubeconfig
run: |
aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: Install kubectl, helmfile and plugins
run: |
curl -s -LO "https://dl.k8s.io/release/v1.27.14/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
curl -s -LO "https://github.com/helmfile/helmfile/releases/download/v0.165.0/helmfile_0.165.0_linux_amd64.tar.gz"
tar xvzf helmfile_0.165.0_linux_amd64.tar.gz helmfile
sudo install -o root -g root -m 0755 helmfile /usr/local/bin/helmfile
helm plugin install https://github.com/aslafy-z/helm-git --version 0.16.0
helm plugin install https://github.com/databus23/helm-diff
helm plugin install https://github.com/jkroepke/helm-secrets
- name: Deploy OpenLAN Cloud Gateway and services
if: {{ github.event.inputs.just_component }} == "false"
working-directory: wlan-cloud-ucentral-deploy/cgw
run: |
helmfile --environment ${{ matrix.namespace }} apply
- name: Deploy OpenLAN Cloud Gateway only
if: {{ github.event.inputs.just_component }} == "true"
working-directory: wlan-cloud-ucentral-deploy/cgw
run: |
helmfile --environment ${{ matrix.namespace }} -l app=cgw apply
- name: Show resource state on deployment failure
if: failure()
run: |
echo "Pods:"
kubectl get pods --namespace openlan-${{ matrix.namespace }}
echo "Pod Descriptions:"
kubectl describe pods --namespace openlan-${{ matrix.namespace }}
echo "Services:"
kubectl get services --namespace openlan-${{ matrix.namespace }}
echo "Service Descriptions:"
kubectl describe services --namespace openlan-${{ matrix.namespace }}
echo "PVCs:"
kubectl get persistentvolumeclaims --namespace openlan-${{ matrix.namespace }}
echo "PVC Descriptions:"
kubectl describe persistentvolumeclaims --namespace openlan-${{ matrix.namespace }}
# - name: Rollback Cloud SDK
# if: failure()
# run: |
# helm rollback tip-openlan --namespace openlan-${{ matrix.namespace }} --wait --timeout 20m