From 8d4eea2bee94026aaa1d2ed0fe3913ae790ca5c1 Mon Sep 17 00:00:00 2001 From: Mikhail S Medvedev Date: Tue, 9 Jan 2018 15:53:16 -0600 Subject: [PATCH] Lay groundwork for zuulv2/v3 coexisting Both v2 and v3 deployments need to be supported for a bit after zuulv3 feature is merged. The architectures are different, with some parts missing (jenkins), while new parts being added (zuul-exector). It is logical to split the configuration into two using zuulv2 flag. Setting zuulv2 to true would use the old configuration. The choice to use zuulv2 = true instead of zuulv3 = false is made so that it would be easier to remove the flag once v2 support is removed. The support for v3 is not added with this patch. It merely allows for feature/zuulv3 to be merged to master without forcing users of puppet-openstackci to pickup the new version. For zuulv2 using zuul@2.6.0 and nodepool@0.5.0 which represent the latest master state as of this patch. The default used to be 'master' for both in single_node_ci class, so this should minimize unintended consequences for those who used the class with defaults. Change-Id: I2e7cd8d1c8e662b7e21fa80d4fa62846e2d44a70 Story: #2001367 Task: #5951 --- contrib/single_node_ci_site.pp | 1 + manifests/single_node_ci.pp | 48 ++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/contrib/single_node_ci_site.pp b/contrib/single_node_ci_site.pp index 8dae153..c56c624 100644 --- a/contrib/single_node_ci_site.pp +++ b/contrib/single_node_ci_site.pp @@ -51,6 +51,7 @@ node default { smtp_host => hiera('smtp_host', 'localhost'), smtp_default_from => hiera('smtp_default_from', "zuul@${vhost_name}"), smtp_default_to => hiera('smtp_default_to', "zuul.reports@${vhost_name}"), + zuulv2 => hiera('zuulv2', true), zuul_revision => hiera('zuul_revision', 'master'), zuul_git_source_repo => hiera('zuul_git_source_repo', 'https://git.openstack.org/openstack-infra/zuul'), diff --git a/manifests/single_node_ci.pp b/manifests/single_node_ci.pp index 8496b90..e726394 100644 --- a/manifests/single_node_ci.pp +++ b/manifests/single_node_ci.pp @@ -113,6 +113,9 @@ # The default 'to' e-mail address zuul will use when it sends # notification e-mails. # +# [*zuulv2*] +# Set to true to deploy zuul v2 (incompatible with zuul v3). +# # [*zuul_revision*] # The branch name used to install zuul. # @@ -184,7 +187,8 @@ class openstackci::single_node_ci ( $smtp_host = 'localhost', $smtp_default_from = "zuul@${vhost_name}", $smtp_default_to = "zuul.reports@${vhost_name}", - $zuul_revision = 'master', + $zuulv2 = true, + $zuul_revision = undef, $zuul_git_source_repo = 'https://git.openstack.org/openstack-infra/zuul', # Nodepool configurations @@ -194,10 +198,24 @@ class openstackci::single_node_ci ( $nodepool_jenkins_target = undef, $jenkins_api_key = undef, $jenkins_credentials_id = undef, - $nodepool_revision = 'master', + $nodepool_revision = undef, $nodepool_git_source_repo = 'https://git.openstack.org/openstack-infra/nodepool', ) { + if $zuulv2 { + + if $nodepool_revision == undef { + $nodepool_revision_ = '0.5.0' + } else { + $nodepool_revision_ = $nodepool_revision + } + + if $zuul_revision == undef { + $zuul_revision_ = '2.6.0' + } else { + $zuul_revision_ = $zuul_revision + } + class { '::openstackci::jenkins_master': vhost_name => $jenkins_vhost_name, serveradmin => $serveradmin, @@ -227,7 +245,7 @@ class openstackci::single_node_ci ( git_email => $git_email, git_name => $git_name, manage_common_zuul => false, - revision => $zuul_revision, + revision => $zuul_revision_, git_source_repo => $zuul_git_source_repo, } @@ -248,14 +266,14 @@ class openstackci::single_node_ci ( smtp_host => $smtp_host, smtp_default_from => $smtp_default_from, smtp_default_to => $smtp_default_to, - revision => $zuul_revision, + revision => $zuul_revision_, } class { '::openstackci::nodepool': mysql_root_password => $mysql_root_password, mysql_password => $mysql_nodepool_password, nodepool_ssh_private_key => $jenkins_ssh_private_key, - revision => $nodepool_revision, + revision => $nodepool_revision_, git_source_repo => $nodepool_git_source_repo, oscc_file_contents => $oscc_file_contents, environment => { @@ -274,4 +292,24 @@ class openstackci::single_node_ci ( }, ], } + + } else { + # Zuul V3 + + if $nodepool_revision == undef { + $nodepool_revision_ = 'master' + } else { + $nodepool_revision_ = $nodepool_revision + } + + if $zuul_revision == undef { + $zuul_revision_ = 'master' + } else { + $zuul_revision_ = $zuul_revision + } + + # TODO v3 all in one + fail('zuul v3 all in one deployment is not supported') + } + }