← Back to team overview

sts-sponsors team mailing list archive

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

 

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

Commit message:
[systemtests{,_snap,_wip}] Remove redundant script{} blocks



Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~adam-collard/maas-ci/+git/maas-ci-config/+merge/437489
-- 
Your team MAAS Committers is requested to review the proposed merge of ~adam-collard/maas-ci/+git/maas-ci-config:de-script-systemtests into ~maas-committers/maas-ci/+git/maas-ci-config:master.
diff --git a/jenkins/jobs/systemtests.yaml b/jenkins/jobs/systemtests.yaml
index 5462809..280f93c 100644
--- a/jenkins/jobs/systemtests.yaml
+++ b/jenkins/jobs/systemtests.yaml
@@ -22,15 +22,13 @@
         stages {
           stage('Checkout') {
             steps {
-              script {
               sh """
                 lxc list
                 pgrep -a qemu || true
                 rm -rf system-tests
                 git clone ${params.GIT_REPO} --branch ${params.GIT_BRANCH} --depth 10 system-tests
-                cd system-tests && git show --no-patch
+                env -C system-tests git show --no-patch
               """
-              }
             }
           }
           stage('Clean') {
@@ -40,27 +38,22 @@
               }
             }
             steps {
-              script {
               sh """
                 lxc delete maas-system-build --force || true
                 lxc delete maas-system-maas --force || true
                 lxc delete maas-client --force || true
               """
-              }
             }
           }
           stage('Setup') {
             steps {
-              script {
               sh """
                 sudo apt-get install -y tox
               """
-              }
             }
           }
           stage('System Tests') {
             steps {
-              script {
                 writeFile file: 'system-tests/config.yaml', text: """
       proxy:
           use_internal: true
@@ -259,19 +252,17 @@
                           HXvIdwLsUASyKB/LlM6dESXr9K4r/im3sn+9oza9mbwsRnBIJ9YU9llTw9j5aUlw
                           Xwjk99gnvag+HswBDB7A7DCTEqhkUQ==
                           -----END PRIVATE KEY-----
-      """
-              }
-              script {
-              sh """
-                cd system-tests
-                cat config.yaml
-                export http_proxy=http://squid.internal:3128/
-                export https_proxy=http://squid.internal:3128/
-                export TOX_PARALLEL_NO_SPINNER=1
-                tox -e cog
-                tox -e env_builder,general_tests -- ${params.PYTEST_ARGS}
-                tox -p all -e vm1,natasha -- ${params.PYTEST_ARGS}
-                tox -p all -e opelt,arm64,ppc64le,vm2 -- ${params.PYTEST_ARGS}
+              """
+              dir("system-tests") {
+                sh """
+                  cat config.yaml
+                  export http_proxy=http://squid.internal:3128/
+                  export https_proxy=http://squid.internal:3128/
+                  export TOX_PARALLEL_NO_SPINNER=1
+                  tox -e cog
+                  tox -e env_builder,general_tests -- ${params.PYTEST_ARGS}
+                  tox -p all -e vm1,natasha -- ${params.PYTEST_ARGS}
+                  tox -p all -e opelt,arm64,ppc64le,vm2 -- ${params.PYTEST_ARGS}
                 """
               }
             }
diff --git a/jenkins/jobs/systemtests_snap.yaml b/jenkins/jobs/systemtests_snap.yaml
index 06c6799..b5312ed 100644
--- a/jenkins/jobs/systemtests_snap.yaml
+++ b/jenkins/jobs/systemtests_snap.yaml
@@ -14,15 +14,14 @@
           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: 'PYTEST_ARGS', defaultValue: '--log-cli-level info', description: 'Additional args to pytest')
-          booleanParam(name: 'REMOVE_CONTAINERS', defaultValue: true, description: 'Should existing containers be torn down before we run?')
           string(name: 'MAAS_SNAP_CHANNEL', defaultValue: 'latest/edge', description: 'Channel of maas snap.')
           string(name: 'TEST_DB_SNAP_CHANNEL', defaultValue: '', description: 'Channel of maas-test-db snap. Leave empty to use same channel of maas snap.')
           string(name: 'CONTAINERS_IMAGE', defaultValue: 'ubuntu:22.04', description: 'LXD image for containers used in tests')
+          booleanParam(name: 'REMOVE_CONTAINERS', defaultValue: true, description: 'Should existing containers be torn down before we run?')
         }
         stages {
           stage('Checkout') {
             steps {
-              script {
               sh """
                 lxc list
                 pgrep -a qemu || true
@@ -30,7 +29,6 @@
                 git clone ${params.GIT_REPO} --branch ${params.GIT_BRANCH} --depth 10 system-tests
                 env -C system-tests git show --no-patch
               """
-              }
             }
           }
           stage('Clean') {
@@ -40,28 +38,23 @@
               }
             }
             steps {
-              script {
               sh """
                 lxc delete maas-system-build --force || true
                 lxc delete maas-system-maas --force || true
                 lxc delete maas-client --force || true
               """
-              }
             }
           }
           stage('Setup') {
             steps {
-              script {
               sh """
                 sudo apt-get install -y tox
               """
-              }
             }
           }
           stage('System Tests') {
             steps {
-              script {
-                writeFile file: 'system-tests/config.yaml', text: """
+              writeFile file: 'system-tests/config.yaml', text: """
       proxy:
           use_internal: true
           http: http://squid.internal:3128
@@ -258,21 +251,19 @@
       snap:
           maas_channel: ${params.MAAS_SNAP_CHANNEL}
           test_db_channel: ${params.TEST_DB_SNAP_CHANNEL}
-      """
-              }
-              script {
-              sh """
-                cd system-tests
-                cat config.yaml
-                export http_proxy=http://squid.internal:3128/
-                export https_proxy=http://squid.internal:3128/
-                export TOX_PARALLEL_NO_SPINNER=1
-                tox -e cog
-                tox -e env_builder,general_tests -- ${params.PYTEST_ARGS}
-                tox -p all -e vm1,natasha -- ${params.PYTEST_ARGS}
-                tox -p all -e opelt,arm64,ppc64le,vm2 -- ${params.PYTEST_ARGS}
+              """
+              dir("system-tests") {
+                sh """
+                  cat config.yaml
+                  export http_proxy=http://squid.internal:3128/
+                  export https_proxy=http://squid.internal:3128/
+                  export TOX_PARALLEL_NO_SPINNER=1
+                  tox -e cog
+                  tox -e env_builder,general_tests -- ${params.PYTEST_ARGS}
+                  tox -p all -e vm1,natasha -- ${params.PYTEST_ARGS}
+                  tox -p all -e opelt,arm64,ppc64le,vm2 -- ${params.PYTEST_ARGS}
                 """
-              }
+	      }
             }
           }
         }
diff --git a/jenkins/jobs/systemtests_v3.yaml b/jenkins/jobs/systemtests_v3.yaml
index c0796fc..60e618f 100644
--- a/jenkins/jobs/systemtests_v3.yaml
+++ b/jenkins/jobs/systemtests_v3.yaml
@@ -42,7 +42,6 @@
         stages {
           stage('Checkout') {
             steps {
-              script {
               sh """
                 lxc list
                 pgrep -a qemu || true
@@ -50,7 +49,6 @@
                 git clone ${params.SYSTEMTESTS_GIT_REPO} --branch ${params.SYSTEMTESTS_GIT_BRANCH} --depth 10 system-tests
                 cd system-tests && git show --no-patch
               """
-              }
             }
           }
           stage('Clean') {
@@ -60,24 +58,19 @@
               }
             }
             steps {
-              script {
               sh """
                 lxc delete maas-system-build --force || true
                 lxc delete maas-system-maas --force || true
                 lxc delete maas-client --force || true
               """
-              }
             }
           }
           stage('Setup') {
             steps {
-              script {
               sh """
                 sudo apt-get install -y tox
               """
-              }
-              script {
-                writeFile file: 'system-tests/base_config.yaml', text: """
+              writeFile file: 'system-tests/base_config.yaml', text: """
       proxy:
           use_internal: true
           http: http://squid.internal:3128
@@ -270,38 +263,35 @@
                           HXvIdwLsUASyKB/LlM6dESXr9K4r/im3sn+9oza9mbwsRnBIJ9YU9llTw9j5aUlw
                           Xwjk99gnvag+HswBDB7A7DCTEqhkUQ==
                           -----END PRIVATE KEY-----
-      """
-              }
+            """
             }
           }
           stage('Generate configuration') {
             steps {
-              script {
-                if (params.INSTALLATION_METTHOD == 'SNAP') {
-                  gen_config_cmd = "${gen_config_cmd} --snap --snap-channel ${params.MAAS_SNAP_CHANNEL}"
-                  if (params.TEST_DB_SNAP_CHANNEL) {
-                    gen_config_cmd ="${gen_config_cmd} --test-db-channel ${params.TEST_DB_SNAP_CHANNEL}"
-                  }
-                } else {
-                  gen_config_cmd = "${gen_config_cmd} --deb --git-repo ${params.MAAS_GIT_REPO} --git-branch ${params.MAAS_GIT_BRANCH} --ppa ${params.MAAS_PPA}"
-                }
-                if (params.ENABLE_TLS) {
-                  gen_config_cmd = "${gen_config_cmd} --tls"
-                }
-                if (params.ENABLE_OBSERVABILITY) {
-                  gen_config_cmd = "${gen_config_cmd} --o11y"
-                }
-                if (params.ENABLE_HW_SYNC_TEST) {
-                  gen_config_cmd = "${gen_config_cmd} --hw-sync"
-                }
-                if (params.GEN_CONFIG_ARGS) {
-                  gen_config_cmd = "${gen_config_cmd} ${params.GEN_CONFIG_ARGS}"
-                }
+               if (params.INSTALLATION_METTHOD == 'SNAP') {
+                 gen_config_cmd = "${gen_config_cmd} --snap --snap-channel ${params.MAAS_SNAP_CHANNEL}"
+                 if (params.TEST_DB_SNAP_CHANNEL) {
+                   gen_config_cmd ="${gen_config_cmd} --test-db-channel ${params.TEST_DB_SNAP_CHANNEL}"
+                 }
+               } else {
+                 gen_config_cmd = "${gen_config_cmd} --deb --git-repo ${params.MAAS_GIT_REPO} --git-branch ${params.MAAS_GIT_BRANCH} --ppa ${params.MAAS_PPA}"
+               }
+               if (params.ENABLE_TLS) {
+                 gen_config_cmd = "${gen_config_cmd} --tls"
+               }
+               if (params.ENABLE_OBSERVABILITY) {
+                 gen_config_cmd = "${gen_config_cmd} --o11y"
+               }
+               if (params.ENABLE_HW_SYNC_TEST) {
+                 gen_config_cmd = "${gen_config_cmd} --hw-sync"
+               }
+               if (params.GEN_CONFIG_ARGS) {
+                 gen_config_cmd = "${gen_config_cmd} ${params.GEN_CONFIG_ARGS}"
+               }
 
-                sh """
-                  ${gen_config_cmd} --containers-image=${params.CONTAINERS_IMAGE} base_config.yaml config.yaml
-                  """
-              }
+               sh """
+                 ${gen_config_cmd} --containers-image=${params.CONTAINERS_IMAGE} base_config.yaml config.yaml
+                 """
             }
           }
           stage('System Tests') {
@@ -312,7 +302,6 @@
             }
 
             steps {
-              script {
                 sh """
                 cd system-tests
                 cat config.yaml
@@ -327,8 +316,7 @@
                 sh """
                     ${cd_tox} -p all -e ${ENVS2} -- ${params.PYTEST_ARGS}
                 """
-                  }
-              }
+                }
             }
           }
         }

Follow ups