From 259820571cf0413cb737eaeca5d7e6c3fdc7cafe Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 20 Dec 2021 14:26:37 +0100 Subject: [PATCH] write reservation ID to file (#333) Signed-off-by: Max Brenner --- .github/workflows/quali-advanced.yml | 25 ++++++++++++------------ .github/workflows/quali-basic-manual.yml | 17 ++++++++-------- .github/workflows/quali.yml | 25 ++++++++++++------------ .quali/start_reservation.py | 4 +++- 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.github/workflows/quali-advanced.yml b/.github/workflows/quali-advanced.yml index 3a1ea8f20..b4202173e 100644 --- a/.github/workflows/quali-advanced.yml +++ b/.github/workflows/quali-advanced.yml @@ -116,14 +116,15 @@ jobs: run: pip install -r wlan-testing/.quali/requirements.txt - name: start reservation - id: start run: | - RES_ID=$(python wlan-testing/.quali/start_reservation.py --openwifi-version "${{ needs.vars.outputs.openwifi_revision }}" --ap-model "${{ matrix.ap_model }}" --blueprint "Advance Lab") - echo ::set-output name=res_id::"$RES_ID" + python wlan-testing/.quali/start_reservation.py --openwifi-version "${{ needs.vars.outputs.openwifi_revision }}" --ap-model "${{ matrix.ap_model }}" --blueprint "Advance Lab" - - name: set reservation identifier + - name: set reservation outputs + if: always() id: reservation - run: echo ::set-output name=identifier::$(echo ${{ steps.start.outputs.res_id }} | cut -d "-" -f 1) + run: | + echo ::set-output name=identifier::"$(cat ./reservation_id.txt)" + echo ::set-output name=namespace::"$(cat ./reservation_id.txt | cut -d "-" -f 1)" - name: get EKS access credentials run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} @@ -151,7 +152,7 @@ jobs: Customer = "" server = "" CONFIGURATION = { - "advanced": $(python wlan-testing/.quali/get_configuration.py ${{ steps.start.outputs.res_id }}) + "advanced": $(python wlan-testing/.quali/get_configuration.py ${{ steps.reservation.outputs.identifier }}) } open_flow = {} @@ -470,7 +471,7 @@ jobs: - -x - -c - | - HOSTS="sec-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build" + HOSTS="sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build" for HOST in \$HOSTS; do HOST_ENTRY="" until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done; @@ -527,19 +528,19 @@ jobs: - name: show gw logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owgw + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owgw - name: show fms logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owfms + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owfms - name: show prov logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owprov + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov - name: show sec logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owsec + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec - name: upload Allure results as artifact if: ${{ always() }} @@ -555,7 +556,7 @@ jobs: - name: stop reservation if: always() - run: python wlan-testing/.quali/stop_reservation.py ${{ steps.start.outputs.res_id }} + run: python wlan-testing/.quali/stop_reservation.py ${{ steps.reservation.outputs.identifier }} report: needs: [ vars, generate-matrix, test ] diff --git a/.github/workflows/quali-basic-manual.yml b/.github/workflows/quali-basic-manual.yml index 9341a724f..f3f8d7bd8 100644 --- a/.github/workflows/quali-basic-manual.yml +++ b/.github/workflows/quali-basic-manual.yml @@ -98,18 +98,19 @@ jobs: run: pip install -r .quali/requirements.txt - name: start reservation - id: start env: CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }} CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }} run: | - RES_ID=$(python .quali/start_reservation.py --openwifi-version "${{ github.event.inputs.openwifi_revision }}" --openwifi-gw-version "${{ github.event.inputs.openwifi_gw_revision }}" --openwifi-sec-version "${{ github.event.inputs.openwifi_sec_revision }}" --openwifi-fms-version "${{ github.event.inputs.openwifi_fms_revision }}" --openwifi-ui-version "${{ github.event.inputs.openwifi_ui_revision }}" --ap-model "${{ github.event.inputs.ap_model }}") - echo ::set-output name=res_id::"$RES_ID" + python .quali/start_reservation.py --openwifi-version "${{ github.event.inputs.openwifi_revision }}" --openwifi-gw-version "${{ github.event.inputs.openwifi_gw_revision }}" --openwifi-sec-version "${{ github.event.inputs.openwifi_sec_revision }}" --openwifi-fms-version "${{ github.event.inputs.openwifi_fms_revision }}" --openwifi-ui-version "${{ github.event.inputs.openwifi_ui_revision }}" --ap-model "${{ github.event.inputs.ap_model }}" - - name: set reservation identifier + - name: set reservation outputs + if: always() id: reservation - run: echo ::set-output name=identifier::$(echo ${{ steps.start.outputs.res_id }} | cut -d "-" -f 1) + run: | + echo ::set-output name=identifier::"$(cat ./reservation_id.txt)" + echo ::set-output name=namespace::"$(cat ./reservation_id.txt | cut -d "-" -f 1)" - name: install JRE run: | @@ -157,7 +158,7 @@ jobs: Customer = "" server = "" CONFIGURATION = { - "basic": $(python .quali/get_configuration.py ${{ steps.start.outputs.res_id }}) + "basic": $(python .quali/get_configuration.py ${{ steps.reservation.outputs.identifier }}) } open_flow = {} @@ -474,7 +475,7 @@ jobs: - -x - -c - | - HOSTS="sec-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build" + HOSTS="sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build" for HOST in \$HOSTS; do HOST_ENTRY="" until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done; @@ -548,7 +549,7 @@ jobs: - name: stop reservation if: always() - run: python .quali/stop_reservation.py ${{ steps.start.outputs.res_id }} + run: python .quali/stop_reservation.py ${{ steps.reservation.outputs.identifier }} env: CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }} diff --git a/.github/workflows/quali.yml b/.github/workflows/quali.yml index a2646bdbb..6e8dc6f6e 100644 --- a/.github/workflows/quali.yml +++ b/.github/workflows/quali.yml @@ -125,14 +125,15 @@ jobs: run: pip install -r .quali/requirements.txt - name: start reservation - id: start run: | - RES_ID=$(python .quali/start_reservation.py --openwifi-version "${{ needs.vars.outputs.openwifi_revision }}" --openwifi-gw-version "${{ needs.vars.outputs.openwifi_gw_revision }}" --openwifi-sec-version "${{ needs.vars.outputs.openwifi_sec_revision }}" --openwifi-fms-version "${{ needs.vars.outputs.openwifi_fms_revision }}" --openwifi-ui-version "${{ needs.vars.outputs.openwifi_ui_revision }}" --ap-model "${{ matrix.ap_model }}") - echo ::set-output name=res_id::"$RES_ID" + python .quali/start_reservation.py --openwifi-version "${{ needs.vars.outputs.openwifi_revision }}" --openwifi-gw-version "${{ needs.vars.outputs.openwifi_gw_revision }}" --openwifi-sec-version "${{ needs.vars.outputs.openwifi_sec_revision }}" --openwifi-fms-version "${{ needs.vars.outputs.openwifi_fms_revision }}" --openwifi-ui-version "${{ needs.vars.outputs.openwifi_ui_revision }}" --ap-model "${{ matrix.ap_model }}" - - name: set reservation identifier + - name: set reservation outputs + if: always() id: reservation - run: echo ::set-output name=identifier::$(echo ${{ steps.start.outputs.res_id }} | cut -d "-" -f 1) + run: | + echo ::set-output name=identifier::"$(cat ./reservation_id.txt)" + echo ::set-output name=namespace::"$(cat ./reservation_id.txt | cut -d "-" -f 1)" - name: get EKS access credentials run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} @@ -160,7 +161,7 @@ jobs: Customer = "" server = "" CONFIGURATION = { - "basic": $(python .quali/get_configuration.py ${{ steps.start.outputs.res_id }}) + "basic": $(python .quali/get_configuration.py ${{ steps.reservation.outputs.identifier }}) } open_flow = {} @@ -496,7 +497,7 @@ jobs: - -x - -c - | - HOSTS="sec-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build" + HOSTS="sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build" for HOST in \$HOSTS; do HOST_ENTRY="" until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done; @@ -553,19 +554,19 @@ jobs: - name: show gw logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owgw + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owgw - name: show fms logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owfms + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owfms - name: show prov logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owprov + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov - name: show sec logs if: failure() - run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owsec + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec - name: upload Allure results as artifact if: always() @@ -581,7 +582,7 @@ jobs: - name: stop reservation if: always() - run: python .quali/stop_reservation.py ${{ steps.start.outputs.res_id }} + run: python .quali/stop_reservation.py ${{ steps.reservation.outputs.identifier }} report: runs-on: ubuntu-latest diff --git a/.quali/start_reservation.py b/.quali/start_reservation.py index 7669a1bff..44a0bf8f8 100644 --- a/.quali/start_reservation.py +++ b/.quali/start_reservation.py @@ -19,6 +19,7 @@ def main(): parser.add_argument('--ap-model', default='[Any]') parser.add_argument('--wifi-type', default='[Any]') parser.add_argument('--blueprint', default='Basic Lab') + parser.add_argument('--reservation-id-file', default='./reservation_id.txt') args = parser.parse_args() session = get_session() @@ -44,7 +45,8 @@ def main(): ] ).Reservation - print(reservation.Id) + with open(args.reservation_id_file, 'w') as f: + f.write(reservation.Id) wait_for_provisioning_status(session, reservation.Id, 'Ready')