← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~adam-collard/maas-ci/+git/maas-ci-config:systemtests-ansible-provider into ~maas-committers/maas-ci/+git/maas-ci-config:master

 

Adam Collard has proposed merging ~adam-collard/maas-ci/+git/maas-ci-config:systemtests-ansible-provider into ~maas-committers/maas-ci/+git/maas-ci-config:master.

Commit message:
[ansible-playbook-tests] Add initial pipeline

systemtests_config_generator: Description improvements



Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~adam-collard/maas-ci/+git/maas-ci-config/+merge/437109
-- 
Your team MAAS Committers is requested to review the proposed merge of ~adam-collard/maas-ci/+git/maas-ci-config:systemtests-ansible-provider into ~maas-committers/maas-ci/+git/maas-ci-config:master.
diff --git a/jenkins/jobs/ansible_playbook.yaml b/jenkins/jobs/ansible_playbook.yaml
new file mode 100644
index 0000000..fc92ef8
--- /dev/null
+++ b/jenkins/jobs/ansible_playbook.yaml
@@ -0,0 +1,74 @@
+- job:
+    name: ansible-playbook-tests
+    description: |
+      Run the Ansible Playbook system tests
+    project-type: pipeline
+    triggers:
+      - timed: '@daily'
+    dsl: |
+      pipeline {
+        agent {
+          label 'ci-lab'
+        }
+        parameters {
+          string(name: 'GIT_REPO', defaultValue: 'https://git.launchpad.net/~maas-committers/maas-ci/+git/system-tests', description: 'Git repo to pull system tests from')
+          string(name: 'GIT_BRANCH', defaultValue: 'master', description: 'Branch in the repo to use')
+          string(name: 'ANSIBLE_REPO', defaultValue: 'https://github.com/maas/maas-ansible-playbook.git', description: 'Git repo to pull Ansible playbook from')
+          string(name: 'ANSIBLE_BRANCH', defaultValue: 'main', description: 'Branch in the Ansible playbook repo to use')
+          string(name: 'PYTEST_ARGS', defaultValue: '--log-cli-level info', description: 'Additional args to pytest')
+          string(name: 'CONTAINERS_IMAGE', defaultValue: 'ubuntu:22.04', description: 'LXD image for containers used in tests')
+        }
+        stages {
+          stage('Checkout') {
+            steps {
+              sh """
+                rm -rf system-tests
+                git clone ${params.GIT_REPO} --branch ${params.GIT_BRANCH} --depth 1 system-tests
+                env -C system-tests git show --no-patch
+              """
+            }
+          }
+          stage('Setup') {
+            steps {
+              sh """
+                sudo apt-get install -y tox
+              """
+            }
+          }
+          stage('System Tests') {
+            steps {
+              writeFile file: 'system-tests/config.yaml', text: """
+      containers-image: ${params.CONTAINERS_IMAGE}
+      ansible-playbooks:
+        git-repo: ${params.ANSIBLE_REPO}
+        git-branch: ${params.ANSIBLE_BRANCH}
+      """
+              sh """
+                cd system-tests
+                cat config.yaml
+                export http_proxy=http://squid.internal:3128/
+                export https_proxy=http://squid.internal:3128/
+                tox r -e cog
+                tox r -e ansible_tests -- ${params.PYTEST_ARGS}
+                """
+            }
+          }
+        }
+        post {
+          always {
+            archiveArtifacts artifacts:'system-tests/*.log,system-tests/config.yaml,system-tests/junit*.xml', fingerprint: true
+            junit allowEmptyResults: true, testResults: 'system-tests/junit*.xml'
+            sh """
+              lxc delete ansible-main --force || true
+              lxc delete ansible-host-1 --force || true
+              lxc delete ansible-host-2 --force || true
+            """
+          }
+          success {
+            mattermostSend (color: 'green', message: "[${env.JOB_NAME} #${env.BUILD_NUMBER}](${env.BUILD_URL}) :success: was successful")
+          }
+          failure {
+            mattermostSend (color: 'red', message: "[${env.JOB_NAME} #${env.BUILD_NUMBER}](${env.BUILD_URL}) :fire: failed")
+          }
+        }
+      }
diff --git a/jenkins/jobs/systemtests_config_generator.groovy b/jenkins/jobs/systemtests_config_generator.groovy
index 6adc37d..25113a4 100644
--- a/jenkins/jobs/systemtests_config_generator.groovy
+++ b/jenkins/jobs/systemtests_config_generator.groovy
@@ -11,10 +11,8 @@ pipeline {
       steps {
         script {
           sh """
-          lxc list;
-          pgrep -a qemu || true;
           rm -rf system-tests;
-          git clone ${params.SYSTEMTESTS_GIT_REPO} --branch ${params.SYSTEMTESTS_GIT_BRANCH} --depth 10 system-tests;
+          git clone ${params.SYSTEMTESTS_GIT_REPO} --branch ${params.SYSTEMTESTS_GIT_BRANCH} --depth 1 system-tests;
           cd system-tests && git show --no-patch;
         """
         }
diff --git a/jenkins/jobs/systemtests_config_generator.yaml b/jenkins/jobs/systemtests_config_generator.yaml
index e0b5944..f8ee769 100644
--- a/jenkins/jobs/systemtests_config_generator.yaml
+++ b/jenkins/jobs/systemtests_config_generator.yaml
@@ -10,11 +10,11 @@
     project-type: pipeline
     parameters:
       - string:
-          description: Git repo to pull system tests from
+          description: Git repo to pull system tests from.
           name: SYSTEMTESTS_GIT_REPO
           default: https://git.launchpad.net/~maas-committers/maas-ci/+git/system-tests
       - string:
-          description: Branch in the repo to use
+          description: Branch in the repo to use.
           name: SYSTEMTESTS_GIT_BRANCH
           default: master
       - choice:
@@ -24,23 +24,23 @@
             - DEB
           description: Which MAAS installation method use for this execution.
       - string:
-          description: Git repo to pull MAAS of
+          description: Git repo to pull MAAS from.
           name: MAAS_GIT_REPO
           default: https://git.launchpad.net/maas
       - string:
-          description: Branch of MAAS project to build from.
+          description: Branch in the repo to build from.
           name: MAAS_GIT_BRANCH
           default: master
       - string:
-          description: MAAS ppa for dependencies.
+          description: MAAS PPA for dependencies.
           name: MAAS_PPA
           default: ppa:maas-committers/latest-deps
       - string:
-          description: Channel of MAAS snap
+          description: Channel to use to install MAAS snap.
           name: MAAS_SNAP_CHANNEL
           default: latest/edge
       - string:
-          description: Channel of maas-test-db snap. Leave empty to use same channel of MAAS snap.
+          description: Channel for maas-test-db snap. Leave empty to use the same channel as MAAS snap.
           name: TEST_DB_SNAP_CHANNEL
           default: latest/edge
       - string:
@@ -48,15 +48,15 @@
           name: CONTAINERS_IMAGE
           default: ubuntu:22.04
       - bool:
-          description: During MAAS installation enable TLS.
+          description: Enable TLS when testing.
           name: ENABLE_TLS
           default: false
       - bool:
-          description: During MAAS installation enable telemtry and send it to our O11y stack.
+          description: Enable telemetry when testing.
           name: ENABLE_OBSERVABILITY
           default: false
       - bool:
-          description: Execute HW SYNC feature tests
+          description: Execute hardware sync feature tests
           name: ENABLE_HW_SYNC_TEST
           default: false
       - bool:
@@ -64,7 +64,7 @@
           name: REMOVE_CONTAINERS
           default: true
       - string:
-          description: Additional args to gen_onfig (--ppa --architecture --machine etc)
+          description: Additional args to gen_config (--ppa --architecture --machine etc)
           name: GEN_CONFIG_ARGS
           default: ""
       - string:

Follow ups