Skip to content

fix: check EMQX condition before revert sts/rs #2400

fix: check EMQX condition before revert sts/rs

fix: check EMQX condition before revert sts/rs #2400

Workflow file for this run

name: Upgrade Test Suite
concurrency:
group: upgrade-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
upgrade:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
emqx:
- [EmqxBroker, emqx, "config/samples/emqx/v1beta3/emqxbroker-slim.yaml"]
# - [EmqxBroker, emqx, "config/samples/emqx/v1beta3/emqxbroker-full.yaml"]
- [EmqxEnterprise, emqx-ee, "config/samples/emqx/v1beta3/emqxenterprise-slim.yaml"]
# - [EmqxEnterprise, emqx-ee, "config/samples/emqx/v1beta3/emqxenterprise-full.yaml"]
- [EMQX, emqx, "config/samples/emqx/v2alpha1/emqx-slim.yaml"]
- [EMQX, emqx, "config/samples/emqx/v2alpha1/emqx-full.yaml"]
steps:
- run: minikube start
- name: install cert-manager
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--set installCRDs=true
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get pre stable version
## Just get the last stable version, ignore the pre-release version
run: |
echo "PRE_VERSION=$(git tag -l | grep -oE "^[0-9]+.[0-9]+.[0-9]+$" | sed -n '$p' )" >> $GITHUB_ENV
- name: Install storage operator
run: |
helm repo add emqx https://repos.emqx.io/charts
helm repo update
helm install emqx-operator emqx/emqx-operator \
--namespace emqx-operator-system \
--create-namespace \
--version ${{ env.PRE_VERSION }}
- name: Check operator
timeout-minutes: 5
run: kubectl wait --for=condition=Ready pods -l "control-plane=controller-manager" -n emqx-operator-system
- name: Deployment emqx
timeout-minutes: 5
uses: ./.github/actions/deploy-emqx
with:
kind: ${{ matrix.emqx[0] }}
name: ${{ matrix.emqx[1] }}
file: https://raw.githubusercontent.com/emqx/emqx-operator/${{ env.PRE_VERSION }}/${{ matrix.emqx[2] }}
- name: Build image
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
run: eval $(minikube docker-env) && docker build -t $IMG .
- name: Deploy controller
run: |
helm upgrade --install emqx-operator deploy/charts/emqx-operator \
--namespace emqx-operator-system \
--create-namespace \
--set image.tag=${{ github.sha }} \
--set development=true \
--debug
- name: Check operator
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
timeout-minutes: 5
run: kubectl wait --for=condition=Ready pods -l "control-plane=controller-manager" -n emqx-operator-system
- name: Check emqx status
timeout-minutes: 5
run: |
sleep 30
while
type="$(kubectl get ${{ matrix.emqx[0] }} ${{ matrix.emqx[1] }} -o json |jq '.status.conditions[0] | select(.status == "True")' | jq --raw-output '.type')"
[[ "$type" != "Ready" ]] && [[ "$type" != "Running" ]]
do
echo "waiting"
sleep 1
done
- if: failure()
run: kubectl logs -l "control-plane=controller-manager" -n emqx-operator-system -c manager --tail=1000
- if: failure()
run: kubectl get pods -l "control-plane=controller-manager" -n emqx-operator-system -o json
- if: failure()
run: kubectl get ${{ matrix.emqx[0] }} ${{ matrix.emqx[1] }} -o json
- if: failure()
run: kubectl get event