Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2017-06-22 14:02:11 -0400
committerFrank Becker2017-06-23 12:22:37 -0400
commit3c5b71e8c12fc034f8e390c96feaf75bf7169dff (patch)
tree985680786d735bcc12d233aaa6b6bbf4572c9954
parent5b879295c019c0b2fecc2e585cfdaddf55075ba0 (diff)
downloadorg.eclipse.mylyn.reviews-3c5b71e8c12fc034f8e390c96feaf75bf7169dff.tar.gz
org.eclipse.mylyn.reviews-3c5b71e8c12fc034f8e390c96feaf75bf7169dff.tar.xz
org.eclipse.mylyn.reviews-3c5b71e8c12fc034f8e390c96feaf75bf7169dff.zip
485981: add support for Gerrit 2.13.8 (update test instances)
Change-Id: Iab74dc103175a5921dc4d1f8ea6f9c293156d9e6 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=485981 Signed-off-by: Frank Becker <eclipse@frank-becker.de>
-rw-r--r--org.eclipse.mylyn.gerrit.releng/modules/gerrit/files/All-Users.git.tarbin0 -> 3453 bytes
-rw-r--r--org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/defaultsites.pp31
-rw-r--r--org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/site.pp97
-rw-r--r--org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/adduser.sql.erb17
-rw-r--r--org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/gerrit.config.erb2
5 files changed, 103 insertions, 44 deletions
diff --git a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/files/All-Users.git.tar b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/files/All-Users.git.tar
new file mode 100644
index 000000000..212679d0b
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/files/All-Users.git.tar
Binary files differ
diff --git a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/defaultsites.pp b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/defaultsites.pp
index 5d70ea6b0..b55796695 100644
--- a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/defaultsites.pp
+++ b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/defaultsites.pp
@@ -17,32 +17,14 @@ define gerrit::defaultsites ($base = $gerrit::base, $userOwner = $gerrit::userOw
/* Instances */
- gerrit { "2.9.4":
- }
-
- gerrit { "2.10":
- }
-
gerrit { "2.11.10":
}
-
- /* Sites */
- gerrit::site { "gerrit-2.9.4":
- version => "2.9.4",
- port => 28294,
- sshport => 29294,
- require => Gerrit["2.9.4"],
+ gerrit { "2.13.8":
}
- gerrit::site { "gerrit-2.10":
- version => "2.10",
- port => 28210,
- sshport => 29210,
- envdefault => true,
- require => Gerrit["2.10"],
- }
-
+ /* Sites */
+
gerrit::site { "gerrit-2.11.10":
version => "2.11.10",
port => 28211,
@@ -50,4 +32,11 @@ define gerrit::defaultsites ($base = $gerrit::base, $userOwner = $gerrit::userOw
require => Gerrit["2.11.10"],
}
+ gerrit::site { "gerrit-2.13.8":
+ version => "2.13.8",
+ port => 28213,
+ sshport => 29213,
+ require => Gerrit["2.13.8"],
+ }
+
}
diff --git a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/site.pp b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/site.pp
index a319255cb..7ffe120f2 100644
--- a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/site.pp
+++ b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/manifests/site.pp
@@ -16,6 +16,8 @@ define gerrit::site (
$envbase = "$base/$envid"
$conf = "$base/conf.d"
$envhost = regsubst(file("/etc/hostname"), '\n', '')
+ $versionArray = split($version, '[.]')
+ $Setup213 = (($versionArray[0] == "2") and ($versionArray[1] >= "13")) or ($versionArray[0] > "2")
/* can't use cwd => $envbase since that may not yet exist and would cause a cyclic dependency */
exec { "stop $envid":
@@ -24,37 +26,42 @@ define gerrit::site (
user => "$gerrit::userOwner",
onlyif => "test -x $envbase/bin/gerrit.sh && $envbase/bin/gerrit.sh check | grep -q 'Gerrit running'",
}
+
+ $gerritUserPassword = 'mylyntest'
exec { "clear $envid":
command => "rm -rf $envbase",
require => Exec["stop $envid"],
user => "$gerrit::userOwner",
- onlyif => "test -e $base/clearexisting",
+ onlyif => "grep -qe '^clear' /etc/gerrit_clear_mode",
}
- exec { "configure $envid":
- command => "/usr/bin/java -jar $base/archive/gerrit-$version.war init --batch --site-path $envbase --no-auto-start",
- require => Exec["clear $envid"],
- user => "$gerrit::userOwner",
- creates => "$envbase",
+ file { "$envbase":
+ ensure => "directory",
+ owner => "$gerrit::userOwner",
+ group => "$gerrit::userGroup",
+ require => Exec["clear $envid"]
}
- file { "$envbase/etc/gerrit.config":
- content => template('gerrit/gerrit.config.erb'),
- require => Exec["configure $envid"],
+ file { "$envbase/etc":
+ ensure => "directory",
+ owner => "$gerrit::userOwner",
+ group => "$gerrit::userGroup",
+ require => [Exec["clear $envid"],File["$envbase"]],
}
- file { "$envbase":
- ensure => "directory",
+ file { "$envbase/etc/gerrit.config":
+ content => template('gerrit/gerrit.config.erb'),
owner => "$gerrit::userOwner",
group => "$gerrit::userGroup",
- require => Exec["configure $envid"]
+ require => File["$envbase/etc"],
}
file { "$conf/$envid.conf":
content => template('gerrit/gerrit.conf.erb'),
owner => "$gerrit::userOwner",
group => "$gerrit::userGroup",
+ require => [Exec["clear $envid"],File["$envbase"]],
notify => Service["apache2"],
}
@@ -86,6 +93,7 @@ define gerrit::site (
owner => "$gerrit::userOwner",
group => "$gerrit::userGroup",
require => File["$envbase"],
+ mode => 0600,
}
file { "$envbase/tests.id_rsa":
@@ -93,6 +101,14 @@ define gerrit::site (
owner => "$gerrit::userOwner",
group => "$gerrit::userGroup",
require => File["$envbase"],
+ mode => 0600,
+ }
+
+ exec { "configure $envid":
+ command => "/usr/bin/java -jar $base/archive/gerrit-$version.war init --batch --site-path $envbase --no-auto-start",
+ require => [Exec["clear $envid"],File["$envbase/etc/gerrit.config"]],
+ user => "$gerrit::userOwner",
+ creates => "$envbase/git",
}
gerrit::user { "admin user for $envid":
@@ -117,28 +133,73 @@ define gerrit::site (
require => [Exec["configure $envid"],]
}
+ exec { "reindex $envid":
+ command => "/usr/bin/java -jar $base/archive/gerrit-$version.war reindex --site-path $envbase",
+ user => "$gerrit::userOwner",
+ require => [Exec["configure $envid"], Gerrit::User["admin user for $envid"], Gerrit::User["tests user for $envid"], File["$envbase/etc/gerrit.config"]],
+ }
+
+ if $Setup213 {
+ file { "$envbase/git/All-Users.git.tar":
+ source => "puppet:///modules/gerrit/All-Users.git.tar",
+ owner => "$gerrit::userOwner",
+ group => "$gerrit::userGroup",
+ require => [Exec["reindex $envid"], Gerrit::User["admin user for $envid"], Gerrit::User["tests user for $envid"], File["$envbase/etc/gerrit.config"]],
+ }
+
+ exec { "del $envbase/git/All-Users.git":
+ command => "rm -R $envbase/git/All-Users.git",
+ cwd => "$envbase/git",
+ user => "$gerrit::userOwner",
+ require => File["$envbase/git/All-Users.git.tar"],
+ onlyif => "test -e $envbase/git/All-Users.git",
+ logoutput => true,
+ }
+
+ exec { "untar $envbase/git/All-Users.git.tar":
+ command => "tar zxvf $envbase/git/All-Users.git.tar",
+ cwd => "$envbase/git",
+ user => "$gerrit::userOwner",
+ require => Exec["del $envbase/git/All-Users.git"],
+ notify => Exec["end prepare setup $envbase"],
+ creates => "$envbase/git/All-Users.git",
+ logoutput => true,
+ }
+ } else {
+ exec { "dummy $envbase/git/All-Users.git.tar":
+ command => "echo $envbase",
+ require => [Exec["reindex $envid"], Gerrit::User["admin user for $envid"], Gerrit::User["tests user for $envid"], File["$envbase/etc/gerrit.config"]],
+ notify => Exec["end prepare setup $envbase"],
+ logoutput => true,
+ }
+ }
+
+ exec { "end prepare setup $envbase":
+ command => "echo 'end prepare setup $envbase'",
+ logoutput => true,
+ }
exec { "start $envid":
command => "$envbase/bin/gerrit.sh start",
cwd => "$envbase",
user => "$gerrit::userOwner",
- require => [Gerrit::User["admin user for $envid"], Gerrit::User["tests user for $envid"], File["$envbase/etc/gerrit.config"]],
creates => "$envbase/log/gerrit.pid",
+ require => Exec["end prepare setup $envbase"],
+ logoutput => true,
}
$ssh = "ssh -p $sshport -i $envbase/admin.id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no admin@localhost"
exec { "create project for $envid":
- command => "$ssh gerrit create-project --name org.eclipse.mylyn.test --empty-commit",
- # user => "$gerrit::userOwner",
+ command => "$ssh gerrit create-project --empty-commit org.eclipse.mylyn.test",
+ user => "root",
require => [Exec["start $envid"], File["$envbase/admin.id_rsa"]],
creates => "$envbase/git/org.eclipse.mylyn.test.git"
}
exec { "add $envbase to apache":
command => "echo 'Include $base/conf.d/[^.#]*\n' >> /etc/apache2/conf-enabled/gerrit.conf",
- require => File["$conf/$envid.conf"],
+ require => [File["$conf/$envid.conf"], Package["apache2"], ],
notify => Service["apache2"],
onlyif => "grep -qe '^Include $base/conf.d' /etc/apache2/conf-enabled/gerrit.conf; test $? != 0"
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/adduser.sql.erb b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/adduser.sql.erb
index f63ce0757..339dcba2d 100644
--- a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/adduser.sql.erb
+++ b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/adduser.sql.erb
@@ -1,4 +1,4 @@
-INSERT INTO accounts
+INSERT INTO accounts
(account_id,preferred_email,registered_on)
VALUES
(<%= @userid %>,'<%= @useremail %>',now());
@@ -9,18 +9,27 @@ VALUES (
(SELECT group_id FROM account_groups WHERE name='<%= @usergroup %>')
);
INSERT INTO account_external_ids
+ (account_id, external_id, email_address, password)
+VALUES (
+ (SELECT account_id FROM accounts WHERE preferred_email='<%= @useremail %>'),
+ 'mailto:<%= @useremail %>',
+ '<%= @useremail %>',
+ 'mylyntest'
+);
+
+INSERT INTO account_external_ids
(account_id, external_id)
VALUES (
(SELECT account_id FROM accounts WHERE preferred_email='<%= @useremail %>'),
'gerrit:<%= @useremail %>'
);
+
INSERT INTO account_external_ids
- (account_id, external_id, email_address, password)
+ (account_id, external_id, password)
VALUES (
(SELECT account_id FROM accounts WHERE preferred_email='<%= @useremail %>'),
'username:<%= @username %>',
- '<%= @useremail %>',
- 'mylyntest'
+ '<%= @gerritUserPassword %>'
);
INSERT INTO account_ssh_keys
(ssh_public_key,valid,account_id)
diff --git a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/gerrit.config.erb b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/gerrit.config.erb
index 332ccbc86..0d31babf7 100644
--- a/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/gerrit.config.erb
+++ b/org.eclipse.mylyn.gerrit.releng/modules/gerrit/templates/gerrit.config.erb
@@ -1,6 +1,6 @@
[gerrit]
basePath = <%= @envbase %>/git
-<% if @envhost == "precise32" %>
+<% if @envhost == "localhost" %>
canonicalWebUrl = http://localhost:2080/<%= @envid %>
<% else %>
canonicalWebUrl = http://<%= @envhost %>/<%= @envid %>

Back to the top