ci: fix helm again

This commit is contained in:
Ivan Dyachkov 2023-08-02 16:18:51 +02:00
parent a03dd42283
commit d75f65deae
2 changed files with 18 additions and 18 deletions

View File

@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.profile[0] }}-docker
name: ${{ env.EMQX_NAME }}-docker
path: /tmp
- name: load docker image
run: |
@ -86,7 +86,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.profile }}-docker
name: ${{ env.EMQX_NAME }}-docker
path: /tmp
- name: load docker image
run: |

View File

@ -23,9 +23,9 @@ on:
jobs:
helm_test:
runs-on: ubuntu-22.04
env:
EMQX_NAME: ${{ matrix.profile }}
PKG_VSN: ${{ matrix.profile == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }}
env:
EMQX_NAME: ${{ matrix.profile }}
PKG_VSN: ${{ matrix.profile == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }}
strategy:
fail-fast: false
@ -43,7 +43,7 @@ jobs:
path: source
- uses: actions/download-artifact@v3
with:
name: "${{ matrix.profile }}-docker"
name: "${{ env.EMQX_NAME }}-docker"
path: /tmp
- name: load docker image
run: |
@ -56,10 +56,10 @@ jobs:
if: matrix.discovery == 'k8s'
working-directory: source
run: |
helm install ${{ matrix.profile }} \
helm install ${EMQX_NAME} \
--set emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY="k8s" \
--set emqxConfig.EMQX_CLUSTER__K8S__APISERVER="https://kubernetes.default.svc:443" \
--set emqxConfig.EMQX_CLUSTER__K8S__SERVICE_NAME="${{ matrix.profile }}-headless" \
--set emqxConfig.EMQX_CLUSTER__K8S__SERVICE_NAME="${EMQX_NAME}-headless" \
--set emqxConfig.EMQX_CLUSTER__K8S__NAMESPACE="default" \
--set image.repository=$TARGET \
--set image.pullPolicy=Never \
@ -69,16 +69,16 @@ jobs:
--set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 \
--set emqxConfig.EMQX_AUTHORIZATION__SOURCES=[] \
--set emqxConfig.EMQX_AUTHORIZATION__NO_MATCH=allow \
deploy/charts/${{ matrix.profile }} \
deploy/charts/${EMQX_NAME} \
--debug
- name: run emqx on chart (dns)
if: matrix.discovery == 'dns'
working-directory: source
run: |
helm install ${{ matrix.profile }} \
helm install ${EMQX_NAME} \
--set emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY="dns" \
--set emqxConfig.EMQX_CLUSTER__DNS__RECORD_TYPE="srv" \
--set emqxConfig.EMQX_CLUSTER__DNS__NAME="${{ matrix.profile }}-headless.default.svc.cluster.local" \
--set emqxConfig.EMQX_CLUSTER__DNS__NAME="${EMQX_NAME}-headless.default.svc.cluster.local" \
--set image.repository=$TARGET \
--set image.pullPolicy=Never \
--set image.tag=$EMQX_TAG \
@ -87,13 +87,13 @@ jobs:
--set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 \
--set emqxConfig.EMQX_AUTHORIZATION__SOURCES=[] \
--set emqxConfig.EMQX_AUTHORIZATION__NO_MATCH=allow \
deploy/charts/${{ matrix.profile }} \
deploy/charts/${EMQX_NAME} \
--debug
- name: waiting emqx started
timeout-minutes: 10
run: |
while [ "$(kubectl get StatefulSet -l app.kubernetes.io/instance=${{ matrix.profile }} -o jsonpath='{.items[0].status.replicas}')" \
!= "$(kubectl get StatefulSet -l app.kubernetes.io/instance=${{ matrix.profile }} -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
while [ "$(kubectl get StatefulSet -l app.kubernetes.io/instance=${EMQX_NAME} -o jsonpath='{.items[0].status.replicas}')" \
!= "$(kubectl get StatefulSet -l app.kubernetes.io/instance=${EMQX_NAME} -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
echo "==============================";
kubectl get pods;
echo "==============================";
@ -103,7 +103,7 @@ jobs:
- name: Get Token
timeout-minutes: 1
run: |
kubectl port-forward service/${{ matrix.profile }} 18083:18083 > /dev/null &
kubectl port-forward service/${EMQX_NAME} 18083:18083 > /dev/null &
while
[ "$(curl --silent -X 'GET' 'http://127.0.0.1:18083/api/v5/status' | tail -n1)" != "emqx is running" ]
@ -120,7 +120,7 @@ jobs:
while
[ "$(curl --silent -H "Authorization: Bearer $TOKEN" -X GET http://127.0.0.1:18083/api/v5/cluster| jq '.nodes|length')" != "3" ];
do
echo "waiting ${{ matrix.profile }} cluster scale"
echo "waiting ${EMQX_NAME} cluster scale"
sleep 1
done
- uses: actions/checkout@v3
@ -141,7 +141,7 @@ jobs:
echo > /dev/tcp/${server}/${port} 2>/dev/null
}
kubectl port-forward service/${{ matrix.profile }} 1883:1883 > /dev/null &
kubectl port-forward service/${EMQX_NAME} 1883:1883 > /dev/null &
while ! port_connected localhost 1883; do
echo server not listening yet...
@ -150,4 +150,4 @@ jobs:
pytest --retries 3 -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"
- if: failure()
run: kubectl logs -l "app.kubernetes.io/instance=${{ matrix.profile }}" -c emqx --tail=1000
run: kubectl logs -l "app.kubernetes.io/instance=${EMQX_NAME}" -c emqx --tail=1000