diff --git a/pmm/aws-staging-start.groovy b/pmm/aws-staging-start.groovy index 79229057f3..3418c63006 100644 --- a/pmm/aws-staging-start.groovy +++ b/pmm/aws-staging-start.groovy @@ -50,13 +50,9 @@ pipeline { description: 'Which Version of PMM-Server', name: 'PMM_VERSION') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable Experimental Repo, for dev-latest', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['no', 'yes'], description: 'Enable Pull Mode, if you are using this instance as Client Node', @@ -328,9 +324,9 @@ pipeline { } } } - stage('Enable Testing Repo') { + stage("Enable ${env.REPO_TO_ENABLE} Repo") { when { - expression { env.ENABLE_TESTING_REPO == "yes" && env.PMM_VERSION == "pmm2" && env.CLIENT_INSTANCE == "no" } + expression { env.PMM_VERSION == "pmm2" && env.CLIENT_INSTANCE == "no" } } steps { script { @@ -343,31 +339,8 @@ pipeline { # exclude unavailable mirrors docker exec ${VM_NAME}-server bash -c "echo exclude=mirror.es.its.nyu.edu | tee -a /etc/yum/pluginconf.d/fastestmirror.conf" docker exec ${VM_NAME}-server yum update -y percona-release - docker exec ${VM_NAME}-server sed -i'' -e 's^/release/^/testing/^' /etc/yum.repos.d/pmm2-server.repo - docker exec ${VM_NAME}-server percona-release enable pmm2-client testing - docker exec ${VM_NAME}-server yum clean all - docker exec ${VM_NAME}-server yum clean metadata - """ - } - } - } - } - } - stage('Enable Experimental Repo') { - when { - expression { env.PMM_VERSION == "pmm2" && env.CLIENT_INSTANCE == "no" && env.ENABLE_EXPERIMENTAL_REPO == "yes" && env.ENABLE_TESTING_REPO == "no" } - } - steps { - script { - withEnv(['JENKINS_NODE_COOKIE=dontKillMe']) { - node(env.VM_NAME){ - sh """ - set -o errexit - set -o xtrace - docker exec ${VM_NAME}-server bash -c "echo exclude=mirror.es.its.nyu.edu | tee -a /etc/yum/pluginconf.d/fastestmirror.conf" - docker exec ${VM_NAME}-server yum update -y percona-release - docker exec ${VM_NAME}-server sed -i'' -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo - docker exec ${VM_NAME}-server percona-release enable pmm2-client experimental + docker exec ${VM_NAME}-server sed -i'' -e 's^/release/^/${REPO_TO_ENABLE}/^' /etc/yum.repos.d/pmm2-server.repo + docker exec ${VM_NAME}-server percona-release enable pmm2-client ${REPO_TO_ENABLE} docker exec ${VM_NAME}-server yum clean all docker exec ${VM_NAME}-server yum clean metadata """ @@ -379,7 +352,7 @@ pipeline { stage('Run Clients') { steps { node(env.VM_NAME){ - setupPMMClient(SERVER_IP, CLIENT_VERSION.trim(), PMM_VERSION, ENABLE_PULL_MODE, ENABLE_TESTING_REPO, CLIENT_INSTANCE, 'aws-staging', ADMIN_PASSWORD) + setupPMMClient(SERVER_IP, CLIENT_VERSION.trim(), PMM_VERSION, ENABLE_PULL_MODE, REPO_TO_ENABLE, CLIENT_INSTANCE, 'aws-staging', ADMIN_PASSWORD) script { env.PMM_REPO="experimental" if(env.CLIENT_VERSION == "pmm2-rc") { diff --git a/pmm/pmm2-ami-staging-start.groovy b/pmm/pmm2-ami-staging-start.groovy index e25aa629df..86362b5b02 100644 --- a/pmm/pmm2-ami-staging-start.groovy +++ b/pmm/pmm2-ami-staging-start.groovy @@ -23,13 +23,9 @@ pipeline { description: 'Stop the instance after, days ("0" value disables autostop and recreates instance in case of AWS failure)', name: 'DAYS') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable Experimental Repo, for dev-latest', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['false', 'true'], description: 'Enable to setup Docker-compose for remote instances', @@ -221,34 +217,14 @@ pipeline { archiveArtifacts 'INSTANCE_ID' } } - stage('Enable Testing Repo') { - when { - expression { env.ENABLE_TESTING_REPO == "yes" } - } - steps { - withCredentials([sshUserPrivateKey(credentialsId: 'aws-jenkins-admin', keyFileVariable: 'KEY_PATH', passphraseVariable: '', usernameVariable: 'USER')]) { - sh ''' - ssh -i "${KEY_PATH}" -o ConnectTimeout=1 -o StrictHostKeyChecking=no admin@${PUBLIC_IP} ' - sudo yum update -y percona-release - sudo sed -i'' -e 's^/release/^/testing/^' /etc/yum.repos.d/pmm2-server.repo - sudo percona-release enable pmm2-client testing - sudo yum clean all - ' - ''' - } - } - } - stage('Enable Experimental Repo') { - when { - expression { env.ENABLE_EXPERIMENTAL_REPO == "yes" && env.ENABLE_TESTING_REPO == "no" } - } + stage("Enable ${env.REPO_TO_ENABLE} Repo") { steps { withCredentials([sshUserPrivateKey(credentialsId: 'aws-jenkins-admin', keyFileVariable: 'KEY_PATH', passphraseVariable: '', usernameVariable: 'USER')]) { sh ''' ssh -i "${KEY_PATH}" -o ConnectTimeout=1 -o StrictHostKeyChecking=no admin@${PUBLIC_IP} ' sudo yum update -y percona-release - sudo sed -i'' -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo - sudo percona-release enable pmm2-client experimental + sudo sed -i'' -e 's^/release/^/${REPO_TO_ENABLE}/^' /etc/yum.repos.d/pmm2-server.repo + sudo percona-release enable pmm2-client ${REPO_TO_ENABLE} sudo yum clean all sudo yum clean metadata ' diff --git a/pmm/pmm2-ami-upgrade-tests-matrix.groovy b/pmm/pmm2-ami-upgrade-tests-matrix.groovy index 33ddec9eae..b28a9ea7b6 100644 --- a/pmm/pmm2-ami-upgrade-tests-matrix.groovy +++ b/pmm/pmm2-ami-upgrade-tests-matrix.groovy @@ -3,13 +3,13 @@ library changelog: false, identifier: 'lib@master', retriever: modernSCM([ remote: 'https://github.com/Percona-Lab/jenkins-pipelines.git' ]) _ -void runAMIUpgradeJob(String PMM_UI_TESTS_BRANCH, String PMM_VERSION, String PMM_SERVER_LATEST, String ENABLE_TESTING_REPO, PMM_QA_BRANCH) { +void runAMIUpgradeJob(String PMM_UI_TESTS_BRANCH, String PMM_VERSION, String PMM_SERVER_LATEST, String REPO_TO_ENABLE, PMM_QA_BRANCH) { upgradeJob = build job: 'pmm2-ami-upgrade-tests', parameters: [ string(name: 'GIT_BRANCH', value: PMM_UI_TESTS_BRANCH), string(name: 'CLIENT_VERSION', value: PMM_VERSION), string(name: 'SERVER_VERSION', value: PMM_VERSION), string(name: 'PMM_SERVER_LATEST', value: PMM_SERVER_LATEST), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_BRANCH) ] } @@ -19,20 +19,13 @@ String pmmServerLatestVersion List amiVersions = pmmVersion('ami').keySet() as List List versions = amiVersions[-5..-1] def parallelStagesMatrix = versions.collectEntries {String it -> - if ("${params.UPGRADE_TO}" == "dev-latest") { - enableTestingRepo = 'no' - pmmServerLatestVersion = pmmVersion() - } else { - enableTestingRepo = 'yes' - pmmServerLatestVersion = pmmVersion('rc') - } - ["${it} -> ${pmmServerLatestVersion}" : generateStage(it, pmmServerLatestVersion, enableTestingRepo)] + ["${it} -> ${pmmServerLatestVersion}" : generateStage(it, PMM_SERVER_LATEST, REPO_TO_ENABLE)] } -def generateStage(String version, String latest, String enableRepo) { +def generateStage(String version, String latest, String repoToEnable) { return { stage("${version}") { - runAMIUpgradeJob(PMM_UI_TESTS_BRANCH, version, latest, enableRepo, PMM_QA_BRANCH) + runAMIUpgradeJob(PMM_UI_TESTS_BRANCH, version, latest, repoToEnable, PMM_QA_BRANCH) } } } @@ -50,10 +43,14 @@ pipeline { defaultValue: 'main', description: 'Tag/Branch for pmm-qa repository', name: 'PMM_QA_BRANCH') + string( + defaultValue: latestVersion, + description: 'latest PMM Server Version', + name: 'PMM_SERVER_LATEST') choice( - choices: ['dev-latest', 'release candidate'], - description: 'Upgrade to:', - name: 'UPGRADE_TO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') } options { skipDefaultCheckout() diff --git a/pmm/pmm2-ami-upgrade-tests.groovy b/pmm/pmm2-ami-upgrade-tests.groovy index 9116bce4fe..6f54d06a90 100644 --- a/pmm/pmm2-ami-upgrade-tests.groovy +++ b/pmm/pmm2-ami-upgrade-tests.groovy @@ -3,10 +3,10 @@ library changelog: false, identifier: 'lib@master', retriever: modernSCM([ remote: 'https://github.com/Percona-Lab/jenkins-pipelines.git' ]) _ -void runAMIStagingStart(AMI_ID, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, AMI_UPGRADE_TESTING_INSTANCE) { +void runAMIStagingStart(AMI_ID, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, AMI_UPGRADE_TESTING_INSTANCE) { amiStagingJob = build job: 'pmm2-ami-staging-start', parameters: [ string(name: 'AMI_ID', value: AMI_ID), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_GIT_BRANCH), string(name: 'AMI_UPGRADE_TESTING_INSTANCE', value: AMI_UPGRADE_TESTING_INSTANCE) ] @@ -34,13 +34,13 @@ void customSetupAMIInstance(INSTANCE_IP) { } } -void runStagingClient(CLIENT_VERSION, CLIENTS, CLIENT_INSTANCE, SERVER_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, NODE_TYPE) { +void runStagingClient(CLIENT_VERSION, CLIENTS, CLIENT_INSTANCE, SERVER_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, NODE_TYPE) { stagingJob = build job: 'aws-staging-start', parameters: [ string(name: 'CLIENT_VERSION', value: CLIENT_VERSION), string(name: 'CLIENTS', value: CLIENTS), string(name: 'CLIENT_INSTANCE', value: CLIENT_INSTANCE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_GIT_BRANCH), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'SERVER_IP', value: SERVER_IP), string(name: 'NOTIFY', value: 'false'), string(name: 'DAYS', value: '1'), @@ -195,9 +195,9 @@ pipeline { description: 'Tag/Branch for pmm-qa repository', name: 'PMM_QA_GIT_BRANCH') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['true', 'false'], description: 'Enable to setup Docker-compose for remote instances', @@ -232,7 +232,7 @@ pipeline { } stage('Start AMI Server') { steps { - runAMIStagingStart(amiID, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, AMI_UPGRADE_TESTING_INSTANCE) + runAMIStagingStart(amiID, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, AMI_UPGRADE_TESTING_INSTANCE) customSetupAMIInstance(AMI_INSTANCE_IP) } } @@ -250,12 +250,12 @@ pipeline { parallel { stage('Start Client Instance Remote Instance') { steps { - runStagingClient(CLIENT_VERSION, '--setup-remote-db', 'yes', AMI_INSTANCE_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, 'remote-node') + runStagingClient(CLIENT_VERSION, '--setup-remote-db', 'yes', AMI_INSTANCE_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, 'remote-node') } } stage('Start Client Instance DB connect Instance') { steps { - runStagingClient(CLIENT_VERSION, '--addclient=modb,1 --addclient=pgsql,1 --addclient=ps,1 --setup-with-custom-queries', 'yes', AMI_INSTANCE_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, 'db-node') + runStagingClient(CLIENT_VERSION, '--addclient=modb,1 --addclient=pgsql,1 --addclient=ps,1 --setup-with-custom-queries', 'yes', AMI_INSTANCE_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, 'db-node') } } } diff --git a/pmm/pmm2-ovf-image-test.groovy b/pmm/pmm2-ovf-image-test.groovy index 67d8460585..fd1670a63c 100644 --- a/pmm/pmm2-ovf-image-test.groovy +++ b/pmm/pmm2-ovf-image-test.groovy @@ -221,7 +221,7 @@ pipeline { currentBuild.description = "VM_NAME: ${VM_NAME}, IP: ${PUBLIC_IP}, OWNER: ${OWNER}" } - setupPMMClient(env.PUBLIC_IP, params.CLIENT_VERSION, 'pmm2', 'yes', 'no', 'yes', 'ovf_setup', env.ADMIN_PASSWORD) + setupPMMClient(env.PUBLIC_IP, params.CLIENT_VERSION, 'pmm2', 'yes', 'experimental', 'yes', 'ovf_setup', env.ADMIN_PASSWORD) sh """ set -o errexit diff --git a/pmm/pmm2-ovf-staging-start.groovy b/pmm/pmm2-ovf-staging-start.groovy index 9ff6470e40..1fec87e00e 100644 --- a/pmm/pmm2-ovf-staging-start.groovy +++ b/pmm/pmm2-ovf-staging-start.groovy @@ -38,13 +38,9 @@ pipeline { description: 'OVA Image version, for installing already released version, pass 2.x.y ex. 2.28.0', name: 'OVA_VERSION') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable Experimental, for Dev Latest testing', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') string( defaultValue: 'main', description: 'Tag/Branch for pmm-qa repository', @@ -147,40 +143,10 @@ pipeline { } } } - stage('Enable Testing Repo') { - when { - expression { env.ENABLE_TESTING_REPO == "yes" && env.ENABLE_EXPERIMENTAL_REPO == "no" } - } + stage("Enable ${env.REPO_TO_ENABLE} Repo") { steps { node(env.VM_NAME){ - enableRepo('testing', env.IP) - } - } - } - stage('Enable Experimental Repo') { - when { - expression { env.ENABLE_EXPERIMENTAL_REPO == "yes" && env.ENABLE_TESTING_REPO == "no" } - } - steps { - node(env.VM_NAME){ - enableRepo('experimental', env.IP) - } - } - } - stage('Enable Release Repo') { - when { - expression { env.ENABLE_EXPERIMENTAL_REPO == "no" && env.ENABLE_TESTING_REPO == "no" } - } - steps { - node(env.VM_NAME) { - withCredentials([sshUserPrivateKey(credentialsId: 'OVF_VM_TESTQA', keyFileVariable: 'KEY_PATH', passphraseVariable: '', usernameVariable: 'USER')]) { - sh ''' - ssh -i "${KEY_PATH}" -p 3022 -o ConnectTimeout=1 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null admin@${IP} ' - sudo yum update -y percona-release || true - sudo yum clean all - ' - ''' - } + enableRepo(env.REPO_TO_ENABLE, env.IP) } } } diff --git a/pmm/pmm2-ovf-upgrade-tests-matrix.groovy b/pmm/pmm2-ovf-upgrade-tests-matrix.groovy index 64d4073615..d10e43498d 100644 --- a/pmm/pmm2-ovf-upgrade-tests-matrix.groovy +++ b/pmm/pmm2-ovf-upgrade-tests-matrix.groovy @@ -8,8 +8,7 @@ void runOVFUpgradeJob(String GIT_BRANCH, PMM_VERSION, PMM_SERVER_LATEST, ENABLE_ string(name: 'SERVER_VERSION', value: PMM_VERSION), string(name: 'CLIENT_VERSION', value: PMM_VERSION), string(name: 'PMM_SERVER_LATEST', value: PMM_SERVER_LATEST), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), - string(name: 'ENABLE_EXPERIMENTAL_REPO', value: 'no'), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_GIT_BRANCH) ] } @@ -29,7 +28,7 @@ def generateStage(VERSION) { GIT_BRANCH, VERSION, PMM_SERVER_LATEST, - ENABLE_TESTING_REPO, + REPO_TO_ENABLE, PMM_QA_GIT_BRANCH ) } @@ -54,9 +53,9 @@ pipeline { description: 'dev-latest PMM Server Version', name: 'PMM_SERVER_LATEST') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo for RC', - name: 'ENABLE_TESTING_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') } options { skipDefaultCheckout() diff --git a/pmm/pmm2-ovf-upgrade-tests.groovy b/pmm/pmm2-ovf-upgrade-tests.groovy index ab493d53e9..210a1537fa 100644 --- a/pmm/pmm2-ovf-upgrade-tests.groovy +++ b/pmm/pmm2-ovf-upgrade-tests.groovy @@ -9,12 +9,11 @@ library changelog: false, identifier: 'lib@master', retriever: modernSCM([ remote: 'https://github.com/Percona-Lab/jenkins-pipelines.git' ]) _ -void runOVFStagingStart(SERVER_VERSION, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, ENABLE_EXPERIMENTAL_REPO) { +void runOVFStagingStart(SERVER_VERSION, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE) { ovfStagingJob = build job: 'pmm2-ovf-staging-start', parameters: [ string(name: 'OVA_VERSION', value: SERVER_VERSION), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_GIT_BRANCH), - string(name: 'ENABLE_EXPERIMENTAL_REPO', value: ENABLE_EXPERIMENTAL_REPO) ] env.OVF_INSTANCE_NAME = ovfStagingJob.buildVariables.VM_NAME env.OVF_INSTANCE_IP = ovfStagingJob.buildVariables.IP @@ -36,13 +35,13 @@ void customSetupOVFInstance(INSTANCE_IP, OVF_INSTANCE_NAME) { } } -void runStagingClient(CLIENT_VERSION, CLIENTS, CLIENT_INSTANCE, SERVER_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, NODE_TYPE) { +void runStagingClient(CLIENT_VERSION, CLIENTS, CLIENT_INSTANCE, SERVER_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, NODE_TYPE) { stagingJob = build job: 'aws-staging-start', parameters: [ string(name: 'CLIENT_VERSION', value: CLIENT_VERSION), string(name: 'CLIENTS', value: CLIENTS), string(name: 'CLIENT_INSTANCE', value: CLIENT_INSTANCE), string(name: 'PMM_QA_GIT_BRANCH', value: PMM_QA_GIT_BRANCH), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'SERVER_IP', value: SERVER_IP), string(name: 'NOTIFY', value: 'false'), string(name: 'DAYS', value: '1'), @@ -195,13 +194,9 @@ pipeline { description: 'Tag/Branch for pmm-qa repository', name: 'PMM_QA_GIT_BRANCH') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable Experimental, for Dev Latest testing', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['true', 'false'], description: 'Enable to setup Docker-compose for remote instances', @@ -232,7 +227,7 @@ pipeline { } stage('Start OVF Server') { steps { - runOVFStagingStart(SERVER_VERSION, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, ENABLE_EXPERIMENTAL_REPO) + runOVFStagingStart(SERVER_VERSION, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE) script { SSHLauncher ssh_connection = new SSHLauncher(OVF_INSTANCE_IP, 22, 'e54a801f-e662-4e3c-ace8-0d96bec4ce0e') DumbSlave node = new DumbSlave(OVF_INSTANCE_NAME, "OVA staging instance: ${OVF_INSTANCE_NAME}", "/root", "1", Mode.EXCLUSIVE, "", ssh_connection, RetentionStrategy.INSTANCE) @@ -250,12 +245,12 @@ pipeline { parallel { stage('Start Client Instance Remote Instance') { steps { - runStagingClient(CLIENT_VERSION, '--setup-remote-db', 'yes', OVF_INSTANCE_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, 'remote-node') + runStagingClient(CLIENT_VERSION, '--setup-remote-db', 'yes', OVF_INSTANCE_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, 'remote-node') } } stage('Start Client Instance DB connect Instance') { steps { - runStagingClient(CLIENT_VERSION, '--addclient=modb,1 --addclient=pgsql,1 --addclient=ps,1 --setup-with-custom-queries', 'yes', OVF_INSTANCE_IP, PMM_QA_GIT_BRANCH, ENABLE_TESTING_REPO, 'db-node') + runStagingClient(CLIENT_VERSION, '--addclient=modb,1 --addclient=pgsql,1 --addclient=ps,1 --setup-with-custom-queries', 'yes', OVF_INSTANCE_IP, PMM_QA_GIT_BRANCH, REPO_TO_ENABLE, 'db-node') } } } diff --git a/pmm/pmm2-release-tests.groovy b/pmm/pmm2-release-tests.groovy index fb6a471c1b..e048c01a12 100644 --- a/pmm/pmm2-release-tests.groovy +++ b/pmm/pmm2-release-tests.groovy @@ -15,8 +15,7 @@ void runPackageTest(String PMM_VERSION, String REPO) { void runUpgradeTest(String FROM_VERSION, String CURRENT_VERSION) { build job: 'pmm2-upgrade-tests', propagate: false, parameters: [ - string(name: 'ENABLE_EXPERIMENTAL_REPO', value: 'no'), - string(name: 'ENABLE_TESTING_REPO', value: 'no'), + string(name: 'REPO_TO_ENABLE', value: 'release'), string(name: 'DOCKER_VERSION', value: FROM_VERSION), string(name: 'CLIENT_VERSION', value: FROM_VERSION), string(name: 'PMM_SERVER_LATEST', value: CURRENT_VERSION), @@ -69,7 +68,7 @@ pipeline { } stage('Test: Upgrade from pmm2-client-main repo') { steps { - runPackageTest(VERSION, 'pmm2-client-main') + runPackageTest(VERSION, 'pmm2-client') } } } diff --git a/pmm/pmm2-ui-tests.groovy b/pmm/pmm2-ui-tests.groovy index 494ce02988..8772473fdd 100644 --- a/pmm/pmm2-ui-tests.groovy +++ b/pmm/pmm2-ui-tests.groovy @@ -286,7 +286,7 @@ pipeline { } stage('Setup Client for PMM-Server') { steps { - setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', ENABLE_PULL_MODE, 'no', 'yes', 'compose_setup', ADMIN_PASSWORD) + setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', ENABLE_PULL_MODE, 'experimental', 'yes', 'compose_setup', ADMIN_PASSWORD) sh """ set -o errexit set -o xtrace diff --git a/pmm/pmm2-upgrade-tests-matrix.groovy b/pmm/pmm2-upgrade-tests-matrix.groovy index b1f373b546..6ad828f09f 100644 --- a/pmm/pmm2-upgrade-tests-matrix.groovy +++ b/pmm/pmm2-upgrade-tests-matrix.groovy @@ -3,14 +3,13 @@ library changelog: false, identifier: 'lib@master', retriever: modernSCM([ remote: 'https://github.com/Percona-Lab/jenkins-pipelines.git' ]) _ -void runUpgradeJob(String PMM_UI_GIT_BRANCH, PMM_VERSION, PMM_SERVER_LATEST, ENABLE_TESTING_REPO, ENABLE_EXPERIMENTAL_REPO, PERFORM_DOCKER_WAY_UPGRADE, PMM_SERVER_TAG) { +void runUpgradeJob(String PMM_UI_GIT_BRANCH, PMM_VERSION, PMM_SERVER_LATEST, REPO_TO_ENABLE, PERFORM_DOCKER_WAY_UPGRADE, PMM_SERVER_TAG) { upgradeJob = build job: 'pmm2-upgrade-tests', parameters: [ string(name: 'PMM_UI_GIT_BRANCH', value: PMM_UI_GIT_BRANCH), string(name: 'CLIENT_VERSION', value: PMM_VERSION), string(name: 'DOCKER_VERSION', value: PMM_VERSION), string(name: 'PMM_SERVER_LATEST', value: PMM_SERVER_LATEST), - string(name: 'ENABLE_TESTING_REPO', value: ENABLE_TESTING_REPO), - string(name: 'ENABLE_EXPERIMENTAL_REPO', value: ENABLE_EXPERIMENTAL_REPO), + string(name: 'REPO_TO_ENABLE', value: REPO_TO_ENABLE), string(name: 'PERFORM_DOCKER_WAY_UPGRADE', value: PERFORM_DOCKER_WAY_UPGRADE), string(name: 'PMM_SERVER_TAG', value: PMM_SERVER_TAG) ] @@ -28,8 +27,7 @@ def generateStage(VERSION) { PMM_UI_GIT_BRANCH, VERSION, PMM_SERVER_LATEST, - ENABLE_TESTING_REPO, - ENABLE_EXPERIMENTAL_REPO, + REPO_TO_ENABLE, PERFORM_DOCKER_WAY_UPGRADE, PMM_SERVER_TAG ) @@ -57,13 +55,9 @@ pipeline { description: 'RC PMM Server Version', name: 'PMM_SERVER_RC') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo for RC', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable EXPERIMENTAL Repo for Dev-latest', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['no', 'yes'], description: 'Perform Docker way Upgrade using this option', diff --git a/pmm/pmm2-upgrade-tests.groovy b/pmm/pmm2-upgrade-tests.groovy index cdf6e501c0..22908cd87a 100644 --- a/pmm/pmm2-upgrade-tests.groovy +++ b/pmm/pmm2-upgrade-tests.groovy @@ -107,13 +107,9 @@ pipeline { description: 'Tag/Branch for pmm-qa repository', name: 'PMM_QA_GIT_BRANCH') choice( - choices: ['no', 'yes'], - description: 'Enable Testing Repo, for RC testing', - name: 'ENABLE_TESTING_REPO') - choice( - choices: ['yes', 'no'], - description: 'Enable Experimental, for Dev Latest testing', - name: 'ENABLE_EXPERIMENTAL_REPO') + choices: ['experimental', 'testing', 'release'], + description: 'Repo to enable (experimental - dev-latest, testing - rc, release - stable)', + name: 'REPO_TO_ENABLE') choice( choices: ['no', 'yes'], description: 'Perform Docker-way Upgrade?', @@ -221,58 +217,19 @@ pipeline { ''' } } - stage('Enable Testing Repo') { - when { - expression { env.ENABLE_TESTING_REPO == "yes" && env.ENABLE_EXPERIMENTAL_REPO == "no" } - } - steps { - script { - sh """ - set -o errexit - set -o xtrace - docker exec pmm-server yum update -y percona-release || true - docker exec pmm-server sed -i'' -e 's^/release/^/testing/^' /etc/yum.repos.d/pmm2-server.repo - docker exec pmm-server percona-release enable pmm2-client testing - docker exec pmm-server yum clean all - docker exec pmm-server yum clean metadata - """ - setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', 'no', 'yes', 'yes', 'compose_setup', params.ADMIN_PASSWORD) - } - } - } - stage('Enable Experimental Repo') { - when { - expression { env.ENABLE_EXPERIMENTAL_REPO == "yes" && env.ENABLE_TESTING_REPO == "no" } - } - steps { - script { - sh """ - set -o errexit - set -o xtrace - docker exec pmm-server yum update -y percona-release || true - docker exec pmm-server sed -i'' -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo - docker exec pmm-server percona-release enable pmm2-client experimental - docker exec pmm-server yum clean all - docker exec pmm-server yum clean metadata - """ - setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', 'no', 'no', 'yes', 'compose_setup', params.ADMIN_PASSWORD) - } - } - } - stage('Enable Release Repo') { - when { - expression { env.ENABLE_EXPERIMENTAL_REPO == "no" && env.ENABLE_TESTING_REPO == "no" } - } + stage("Enable ${env.REPO_TO_ENABLE} Repo") { steps { script { sh """ set -o errexit set -o xtrace docker exec pmm-server yum update -y percona-release || true + docker exec pmm-server sed -i'' -e 's^/release/^/${REPO_TO_ENABLE}/^' /etc/yum.repos.d/pmm2-server.repo + docker exec pmm-server percona-release enable pmm2-client ${REPO_TO_ENABLE} docker exec pmm-server yum clean all docker exec pmm-server yum clean metadata """ - setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', 'no', 'release', 'yes', 'compose_setup', params.ADMIN_PASSWORD, 'no') + setupPMMClient(env.SERVER_IP, CLIENT_VERSION, 'pmm2', 'no', env.REPO_TO_ENABLE, 'yes', 'compose_setup', params.ADMIN_PASSWORD) } } } diff --git a/vars/setupPMMClient.groovy b/vars/setupPMMClient.groovy index 0db42edf34..39b634d402 100644 --- a/vars/setupPMMClient.groovy +++ b/vars/setupPMMClient.groovy @@ -1,4 +1,4 @@ -def call(String SERVER_IP, String CLIENT_VERSION, String PMM_VERSION, String ENABLE_PULL_MODE, String ENABLE_TESTING_REPO, String CLIENT_INSTANCE, String SETUP_TYPE, String ADMIN_PASSWORD, String ENABLE_EXPERIMENTAL_REPO = 'yes') { +def call(String SERVER_IP, String CLIENT_VERSION, String PMM_VERSION, String ENABLE_PULL_MODE, String REPO_TO_ENABLE, String CLIENT_INSTANCE, String SETUP_TYPE, String ADMIN_PASSWORD) { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AMI/OVF', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { sh ''' set -o errexit @@ -9,8 +9,7 @@ def call(String SERVER_IP, String CLIENT_VERSION, String PMM_VERSION, String ENA export SERVER_IP=${SERVER_IP} export CLIENT_VERSION=${CLIENT_VERSION} export ENABLE_PULL_MODE=${ENABLE_PULL_MODE} - export ENABLE_TESTING_REPO=${ENABLE_TESTING_REPO} - export ENABLE_EXPERIMENTAL_REPO=${ENABLE_EXPERIMENTAL_REPO} + export REPO_TO_ENABLE=${REPO_TO_ENABLE} export CLIENT_INSTANCE=${CLIENT_INSTANCE} export SETUP_TYPE=${SETUP_TYPE} export ADMIN_PASSWORD=${ADMIN_PASSWORD} @@ -45,13 +44,7 @@ def call(String SERVER_IP, String CLIENT_VERSION, String PMM_VERSION, String ENA sudo percona-release enable-only pmm2-client experimental elif [[ "$CLIENT_VERSION" = 2* ]]; then sudo yum -y install "pmm2-client-$CLIENT_VERSION-6.el9.x86_64" - if [[ "$ENABLE_TESTING_REPO" = yes ]]; then - sudo percona-release enable-only pmm2-client testing - elif [[ "$ENABLE_TESTING_REPO" = no ]] && [[ "$ENABLE_EXPERIMENTAL_REPO" = yes ]]; then - sudo percona-release enable-only pmm2-client experimental - else - sudo percona-release enable-only pmm2-client release - fi + sudo percona-release enable-only pmm2-client ${REPO_TO_ENABLE} sleep 10 else if [[ "$CLIENT_VERSION" = http* ]]; then