From a54f807a1d7dc214836c582726277d18366dfa73 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Thu, 26 Sep 2024 10:12:31 +0930 Subject: [PATCH] tidy and improve cos integration workflow also fix the juju-channel in k8s controller --- .github/workflows/cos_integration.yaml | 30 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cos_integration.yaml b/.github/workflows/cos_integration.yaml index 808c9c31..81c639bc 100644 --- a/.github/workflows/cos_integration.yaml +++ b/.github/workflows/cos_integration.yaml @@ -1,4 +1,4 @@ -name: Integration tests with COS +name: COS Integration tests on: workflow_call: @@ -11,48 +11,62 @@ on: - "**.rst" jobs: - integration-tests-with-cos: - runs-on: ubuntu-latest + integration: + runs-on: ubuntu-22.04 timeout-minutes: 120 steps: - name: Checkout uses: actions/checkout@v3 + - name: Get IP address of the host run: | # Finding preferred source ip address by trying to reach destination 2.2.2.2 # This ip address will be used while enabling metallb echo "IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')" >> $GITHUB_ENV + - name: Setup lxd controller uses: charmed-kubernetes/actions-operator@main with: # The juju version can be any stable version, as long as it is the same as libjuju version used. - # If you updated it here, update it also in tests/integration/requirements.txt + # If you update it here, update it also in tests/integration/requirements.txt and 'Setup k8s controller' step below juju-channel: 3.5/stable provider: lxd + - name: Save lxd controller name id: lxd-controller # The `CONTROLLER_NAME` envvar is set by the actions-operator action run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT + - name: Setup k8s controller uses: charmed-kubernetes/actions-operator@main with: - juju-channel: 3.1/stable + # The juju version can be any stable version, as long as it is the same as libjuju version used. + # If you update it here, update it also in tests/integration/requirements.txt and 'Setup lxd controller' step above + juju-channel: 3.5/stable provider: microk8s channel: 1.28-strict/stable microk8s-addons: "hostpath-storage dns metallb:${{ env.IPADDR }}-${{ env.IPADDR }}" + - name: Save k8s controller name id: k8s-controller # The `CONTROLLER_NAME` envvar is set by the actions-operator action run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT + - name: Fix microk8s permissions - run: | - chmod -R ugo+rwX ~/.kube + run: chmod -R ugo+rwX ~/.kube + - name: Run integration tests run: tox -e integration env: K8S_CONTROLLER: ${{ steps.k8s-controller.outputs.name }} LXD_CONTROLLER: ${{ steps.lxd-controller.outputs.name }} + - name: Dump debug log if: failure() - run: for ctl in $(juju controllers --format json | jq -r '.controllers | keys[]'); do for mdl in $(juju models --format json | jq -r '.models[].name' | grep -v "admin/controller"); do juju debug-log -m $ctl:$mdl --replay --ms --no-tail; done; done || true + run: | + for ctl in $(juju controllers --format json | jq -r '.controllers | keys[]'); do + for mdl in $(juju models --format json | jq -r '.models[].name' | grep -v "admin/controller"); do + juju debug-log -m $ctl:$mdl --replay --ms --no-tail + done + done || true shell: bash