[gnome-build-meta/sthursfield/james/openqa-master: 13/22] openqa: order test job correctly




commit b0bcb38600fbb0a574678cd3a18f81b04bd18bc8
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Aug 2 19:34:42 2021 +0200

    openqa: order test job correctly

 .gitlab-ci.yml | 202 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 102 insertions(+), 100 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ef280e49..831c469c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -284,106 +284,6 @@ iso-installer-x86_64:
   - job: 'build-x86_64'
     artifacts: false
 
-test-iso-installer-x86_64:
-  stage: test
-  image:
-    # Source repo: https://github.com/os-autoinst/openQA
-    # name: registry.opensuse.org/devel/openqa/containers15.2/openqa_worker:latest
-    #   2021-07-29: The 'latest' tag leads to 
@sha256:4469f2f4d1a93caaddcb3efb10471d2045f7ff230c5455b4ad9aa99efe90a8d7
-    #      This doesn't contain qemu-img and breaks during testing with error: "no kvm-img/qemu-img found"
-    #
-    # For now, using a version built locally, from openQA.git commit ceabc2be82e1f1c6c3c51bf017c1b79494ace869
-    name: quay.io/ssssam/openqa_worker
-    entrypoint: [ "/bin/bash", "-c" ]
-  when: manual
-  variables:
-    IMAGE: iso/image.bst
-    # CI needs to be set so OPENQA_TEST_TIMEOUT_SCALE_CI has an effect.
-    CI: 1
-    OPENQA_TEST_TIMEOUT_SCALE_CI: 4
-  needs:
-  - job: 'track'
-    optional: true
-  - job: 'iso-installer-x86_64'
-    artifacts: true
-  script:
-  - mkdir -p /data/factory/iso/
-  - rm /etc/openqa/*
-  - |
-    cat >/etc/openqa/client.conf <<EOF
-    [openqa.gnome.org]
-    key = $OPENQA_API_KEY
-    secret = $OPENQA_API_SECRET
-    EOF
-  - |
-    # To ensure we create a unique worker for each ad-hoc test run, create a new
-    # uniqe machine class, which can only be used for this test
-    worker_class=qemu_x86_64-${CI_JOB_ID}
-    cat >/etc/openqa/workers.ini <<EOF
-    [global]
-    WORKER_CLASS=$worker_class
-    BACKEND = qemu
-    HOST = $OPENQA_HOST
-    EOF
-    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
-      --host $OPENQA_HOST \
-      -X POST machines/ \
-      name=gitlab-runner-$worker_class \
-      backend=qemu \
-      settings[ARCH]=x86_64 \
-      settings[PART_TABLE_TYPE]=gpt \
-      settings[QEMUCPUS]=2 \
-      settings[QEMURAM]=2560 \
-      settings[QEMUVGA]=virtio \
-      settings[UEFI]=1 \
-      settings[UEFI_PFLASH_CODE]=/usr/share/qemu/ovmf-x86_64-code.bin \
-      settings[WORKER_CLASS]=$worker_class | jq .id > /tmp/machine_id
-  - ln -s $(pwd)/image/installer.iso /data/factory/iso/installer.iso
-  - /run_openqa_worker.sh &> worker.log &
-  - |
-    # Start the job and monitor it
-    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
-      --host $OPENQA_HOST \
-      -X POST isos \
-      ISO=installer.iso \
-      DISTRI=gnomeos \
-      VERSION=${CI_COMMIT_REF_NAME} \
-      FLAVOR=dvd \
-      ARCH=x86_64 \
-      WORKER_CLASS=$worker_class \
-      CASEDIR=$(pwd)/tests \
-      NEEDLES_DIR=$OPENQA_NEEDLES_GIT#$OPENQA_NEEDLES_SHA | jq .ids[0] > /tmp/job_id
-  - echo "Test job has been started, vist $OPENQA_HOST/tests/$(cat /tmp/job_id) to see the progress"
-  - |
-    alias job_check="openqa-cli api --apikey $OPENQA_API_KEY \
-      --apisecret $OPENQA_API_KEY \
-      --host $OPENQA_HOST \
-      jobs/$(cat /tmp/job_id)"
-    state=$(job_check | jq .job.state)
-    while [ "$state" != "\"done\"" ]; do sleep 10 && state=$(job_check | jq .job.state); done
-    echo "Tests finished"
-
-    result=$(job_check | jq .job.result)
-    if [ "$result" != "\"passed\"" ]; then
-      echo "Test job $(cat /tmp/job_id) *FAILED*"
-      echo 1 > /tmp/exit_code
-    else
-      echo "Test job $(cat /tmp/job_id) *PASSED*"
-      echo 0 > /tmp/exit_code
-    fi
-  - |
-    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
-      --host $OPENQA_HOST -X DELETE machines/$(cat /tmp/machine_id)
-  - exit $(cat /tmp/exit_code)
-  artifacts:
-    when: always
-    paths:
-    - worker.log
-    expire_in: '1 week'
-  tags:
-  - x86_64
-  - gnome-build-meta
-
 s3-image:
   extends: .x86_64
   stage: deploy
@@ -502,6 +402,108 @@ cve_report:
   rules:
   - if: $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^gnome-\d\d$/
 
+
+test-iso-installer-x86_64:
+  stage: test
+  image:
+    # Source repo: https://github.com/os-autoinst/openQA
+    # name: registry.opensuse.org/devel/openqa/containers15.2/openqa_worker:latest
+    #   2021-07-29: The 'latest' tag leads to 
@sha256:4469f2f4d1a93caaddcb3efb10471d2045f7ff230c5455b4ad9aa99efe90a8d7
+    #      This doesn't contain qemu-img and breaks during testing with error: "no kvm-img/qemu-img found"
+    #
+    # For now, using a version built locally, from openQA.git commit ceabc2be82e1f1c6c3c51bf017c1b79494ace869
+    name: quay.io/ssssam/openqa_worker
+    entrypoint: [ "/bin/bash", "-c" ]
+  when: manual
+  variables:
+    IMAGE: iso/image.bst
+    # CI needs to be set so OPENQA_TEST_TIMEOUT_SCALE_CI has an effect.
+    CI: 1
+    OPENQA_TEST_TIMEOUT_SCALE_CI: 4
+  needs:
+  - job: 'track'
+    optional: true
+  - job: 'iso-installer-x86_64'
+    artifacts: true
+  script:
+  - mkdir -p /data/factory/iso/
+  - rm /etc/openqa/*
+  - |
+    cat >/etc/openqa/client.conf <<EOF
+    [openqa.gnome.org]
+    key = $OPENQA_API_KEY
+    secret = $OPENQA_API_SECRET
+    EOF
+  - |
+    # To ensure we create a unique worker for each ad-hoc test run, create a new
+    # uniqe machine class, which can only be used for this test
+    worker_class=qemu_x86_64-${CI_JOB_ID}
+    cat >/etc/openqa/workers.ini <<EOF
+    [global]
+    WORKER_CLASS=$worker_class
+    BACKEND = qemu
+    HOST = $OPENQA_HOST
+    EOF
+    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
+      --host $OPENQA_HOST \
+      -X POST machines/ \
+      name=gitlab-runner-$worker_class \
+      backend=qemu \
+      settings[ARCH]=x86_64 \
+      settings[PART_TABLE_TYPE]=gpt \
+      settings[QEMUCPUS]=2 \
+      settings[QEMURAM]=2560 \
+      settings[QEMUVGA]=virtio \
+      settings[UEFI]=1 \
+      settings[UEFI_PFLASH_CODE]=/usr/share/qemu/ovmf-x86_64-code.bin \
+      settings[WORKER_CLASS]=$worker_class | jq .id > /tmp/machine_id
+  - ln -s $(pwd)/image/installer.iso /data/factory/iso/installer.iso
+  - /run_openqa_worker.sh &> worker.log &
+  - |
+    # Start the job and monitor it
+    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
+      --host $OPENQA_HOST \
+      -X POST isos \
+      ISO=installer.iso \
+      DISTRI=gnomeos \
+      VERSION=${CI_COMMIT_REF_NAME} \
+      FLAVOR=dvd \
+      ARCH=x86_64 \
+      WORKER_CLASS=$worker_class \
+      CASEDIR=$(pwd)/tests \
+      NEEDLES_DIR=$OPENQA_NEEDLES_GIT#$OPENQA_NEEDLES_SHA | jq .ids[0] > /tmp/job_id
+  - echo "Test job has been started, vist $OPENQA_HOST/tests/$(cat /tmp/job_id) to see the progress"
+  - |
+    alias job_check="openqa-cli api --apikey $OPENQA_API_KEY \
+      --apisecret $OPENQA_API_KEY \
+      --host $OPENQA_HOST \
+      jobs/$(cat /tmp/job_id)"
+    state=$(job_check | jq .job.state)
+    while [ "$state" != "\"done\"" ]; do sleep 10 && state=$(job_check | jq .job.state); done
+    echo "Tests finished"
+
+    result=$(job_check | jq .job.result)
+    if [ "$result" != "\"passed\"" ]; then
+      echo "Test job $(cat /tmp/job_id) *FAILED*"
+      echo 1 > /tmp/exit_code
+    else
+      echo "Test job $(cat /tmp/job_id) *PASSED*"
+      echo 0 > /tmp/exit_code
+    fi
+  - |
+    openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
+      --host $OPENQA_HOST -X DELETE machines/$(cat /tmp/machine_id)
+  - exit $(cat /tmp/exit_code)
+  artifacts:
+    when: always
+    paths:
+    - worker.log
+    expire_in: '1 week'
+  tags:
+  - x86_64
+  - gnome-build-meta
+
+
 pages:
   stage: 'reports'
   needs:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]