[openqa-tests/sam/ci] CI: add job to test s3-image




commit 8cfc491efd68032262a71955053b30d4769fa48a
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Tue Nov 9 11:56:48 2021 +0100

    CI: add job to test s3-image
    
    We need some way to gate merge requests for this repo now
    the tests are separate from gnome-build-meta. Running the
    tests against the prebuilt s3-image seems a good way.
    
    See also: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/404

 .gitlab-ci.yml     | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 utils/start_job.sh |  2 +-
 2 files changed, 65 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..bccc8bd
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,64 @@
+variables:
+  OPENQA_HOST: https://openqa.gnome.org
+  OPENQA_TESTS_GIT: https://gitlab.gnome.org/gnome/openqa-tests
+  OPENQA_TESTS_BRANCH: master
+  OPENQA_NEEDLES_GIT: https://gitlab.gnome.org/gnome/openqa-needles
+  OPENQA_NEEDLES_BRANCH: master
+  S3_IMAGE_URL: https://os.gnome.org/download/latest/gnome_os_installer.iso
+
+
+stages:
+- test
+
+
+test-s3-image-x86_64:
+  stage: test
+  image:
+    name: registry.opensuse.org/devel/openqa/containers15.2/openqa_worker:latest
+    entrypoint: ["/bin/bash", "-c"]
+  variables:
+    IMAGE: gnome_os_installer.iso
+    # CI needs to be set so OPENQA_TEST_TIMEOUT_SCALE_CI has an effect.
+    CI: 1
+    OPENQA_TEST_TIMEOUT_SCALE_CI: 4
+  script:
+  - |
+    curl --get --location $S3_IMAGE_URL --output $IMAGE
+  - |
+    mkdir -p /data/factory/iso/
+    ln -s $(pwd)/image/installer.iso /data/factory/iso/installer.iso
+  - |
+    rm /etc/openqa/*
+    cat >/etc/openqa/client.conf <<EOF
+    [openqa.gnome.org]
+    key = $OPENQA_API_KEY
+    secret = $OPENQA_API_SECRET
+    EOF
+  - |
+    worker_class=qemu_x86_64-${CI_JOB_ID}
+    openqa/utils/setup_worker.sh ${worker_class} > /tmp/machine_id
+    /run_openqa_worker.sh &> worker.log &
+  - |
+    openqa/utils/start_job.sh ${worker_class} master > /tmp/job_id
+    echo "Test job has been started, visit $OPENQA_HOST/tests/$(cat /tmp/job_id) to see the progress"
+  - openqa/utils/wait_for_job.sh $(cat /tmp/job_id) > /tmp/exit_code
+  - exit $(cat /tmp/exit_code)
+  after_script:
+  - |
+    if [ -e /tmp/machine_id ]; then
+        echo "Cleaning up worker"
+        openqa/utils/teardown_worker.sh $(cat /tmp/machine_id)
+        rm /tmp/machine_id
+    fi
+  - if [ ! -e /tmp/exit_code ]; then
+        echo "Job creation failed, log below."
+        cat openqa.log
+  - fi
+  artifacts:
+    when: always
+    paths:
+    - openqa.log
+    - worker.log
+    expire_in: '1 week'
+  tags:
+  - x86_64
diff --git a/utils/start_job.sh b/utils/start_job.sh
index 05c7229..0924e12 100755
--- a/utils/start_job.sh
+++ b/utils/start_job.sh
@@ -18,5 +18,5 @@ openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
   FLAVOR=iso \
   ARCH=x86_64 \
   WORKER_CLASS=$worker_class \
-  CASEDIR=$(pwd)/openqa \
+  CASEDIR=$(pwd) \
   NEEDLES_DIR=$OPENQA_NEEDLES_GIT#$OPENQA_NEEDLES_SHA | tee --append openqa.log | jq -e .ids[0]


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