← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~dmascialino/maas-ci/+git/maas-ci-config:systemtests_with_gen_config into ~maas-committers/maas-ci/+git/maas-ci-config:master

 

Review: Approve

+1

Diff comments:

> diff --git a/jenkins/jobs/systemtests_config_generator.groovy b/jenkins/jobs/systemtests_config_generator.groovy
> new file mode 100644
> index 0000000..bd27fb7
> --- /dev/null
> +++ b/jenkins/jobs/systemtests_config_generator.groovy
> @@ -0,0 +1,114 @@
> +def gen_config_cmd = 'tox -e generate_config --'
> +pipeline {
> +  agent {
> +    label 'ci-lab'
> +  }
> +  parameters {
> +    string(name: 'SYSTEMTESTS_GIT_REPO', defaultValue: 'https://git.launchpad.net/~maas-committers/maas-ci/+git/system-tests', description: 'Git repo to pull system tests from')
> +    string(name: 'SYSTEMTESTS_GIT_BRANCH', defaultValue: 'master', description: 'Branch in the repo to use')
> +
> +    choice(name: 'INSTALLATION_METHOD', choices: ['SNAP', 'DEB'], description: 'Which MAAS installation method use for this execution.')
> +    string(name: 'MAAS_GIT_REPO', defaultValue: 'https://git.launchpad.net/maas', description: 'Git repo to pull MAAS of.')
> +    string(name: 'MAAS_GIT_BRANCH', defaultValue: 'master', description: 'branch of MAAS project to build from.')
> +    string(name: 'MAAS_PPA', defaultValue: 'ppa:maas-committers/latest-deps', description: 'MAAS ppa for dependencies.')
> +
> +    string(name: 'MAAS_SNAP_CHANNEL', defaultValue: 'latest/edge', description: 'Channel of MAAS snap.')
> +    string(name: 'TEST_DB_SNAP_CHANNEL', defaultValue: 'latest/edge', 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: 'ENABLE_TLS', defaultValue: false, description: 'During MAAS installation enable TLS.')
> +    booleanParam(name: 'ENABLE_OBSERVABILITY', defaultValue: false, description: 'During MAAS installation enable telemtry and send it to our O11y stack.')
> +    booleanParam(name: 'ENABLE_HW_SYNC_TEST', defaultValue: false, description: 'Execute HW SYNC feature tests')
> +
> +    string(name: 'GEN_CONFIG_ARGS', defaultValue: '', description: 'Additional args to gen_onfig (--ppa --architecture --machine etc)')
> +    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?')
> +  }

parameters definitions could be moved to the JJB yaml config, I think (that would make them a bit more readable)

> +  environment {
> +    TOX_PARALLEL_NO_SPINNER = '1'
> +  }
> +  stages {
> +    stage('Checkout') {
> +      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;
> +          cd system-tests && git show --no-patch;
> +        """
> +        }
> +      }
> +    }
> +    stage('Setup') {
> +      steps {
> +        script {
> +          sh '''
> +          sudo apt-get install -y tox;
> +        '''
> +        }
> +        script {
> +            sh '''
> +            cd system-tests
> +            tox -e cog
> +            '''
> +        }
> +        script {
> +          writeFile file: 'system-tests/base_config.yaml', text: """
> +{{ labmaas_base_config.format() }}
> +"""
> +        }
> +      }
> +    }
> +    stage('Generate configuration') {
> +      steps {
> +        script {
> +          if (params.INSTALLATION_METHOD == 'SNAP') {
> +            gen_config_cmd = "${gen_config_cmd} --snap --snap-channel ${params.MAAS_SNAP_CHANNEL} --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 """
> +            cd system-tests
> +            cat base_config.yaml
> +            ${gen_config_cmd} --containers-image=${params.CONTAINERS_IMAGE} base_config.yaml config.yaml
> +            """
> +
> +          archiveArtifacts artifacts: 'system-tests/config.yaml', fingerprint: true
> +        }
> +      }
> +    }
> +    stage('Launch System Tests') {
> +      steps {
> +        script {
> +          build(job: 'maas-system-tests-executor',
> +                wait: false,
> +                parameters: [
> +                  string(name:'SYSTEMTESTS_GIT_REPO', value:"${params.SYSTEMTESTS_GIT_REPO}"),
> +                  string(name:'SYSTEMTESTS_GIT_BRANCH', value:"${params.SYSTEMTESTS_GIT_BRANCH}"),
> +                  string(name:'PYTEST_ARGS', value:"${params.PYTEST_ARGS}"),
> +                  booleanParam(name:'REMOVE_CONTAINERS', value:"${params.REMOVE_CONTAINERS}"),
> +                ],
> +          )
> +        }
> +      }
> +    }
> +  }
> +}
> +


-- 
https://code.launchpad.net/~dmascialino/maas-ci/+git/maas-ci-config/+merge/429707
Your team MAAS Committers is subscribed to branch ~maas-committers/maas-ci/+git/maas-ci-config:master.