diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst index fc190459f8..2bc92dcf05 100644 --- a/doc/source/gerrit.rst +++ b/doc/source/gerrit.rst @@ -24,7 +24,8 @@ At a Glance * :file:`modules/openstack_project/manifests/review.pp` * :file:`modules/openstack_project/manifests/review_dev.pp` :Configuration: - * :file:`modules/openstack_project/templates/review.projects.yaml.erb` + * :file:`modules/openstack_project/templates/review.projects.ini.erb` + * :file:`modules/openstack_project/files/review.projects.yaml` :Projects: * http://code.google.com/p/gerrit/ :Bugs: @@ -136,7 +137,7 @@ account name and add ssh keys - you'll need those. Once you've created your groups you should create the ``openstack-project-creator`` account by hand (the account name is referenced from -:file:`modules/openstack_project/templates/review.projects.yaml.erb`) +:file:`modules/openstack_project/templates/review.projects.ini.erb`) using:: cat $pubkey | ssh -p 29418 $USER@$HOST gerrit create-account \ diff --git a/doc/source/jeepyb.rst b/doc/source/jeepyb.rst index 441f938a33..3465b8d6c7 100644 --- a/doc/source/jeepyb.rst +++ b/doc/source/jeepyb.rst @@ -20,7 +20,8 @@ At a Glance * :file:`modules/openstack_project/manifests/review.pp` * :file:`modules/openstack_project/manifests/review_dev.pp` :Configuration: - * :file:`modules/openstack_project/templates/review.projects.yaml.erb` + * :file:`modules/openstack_project/templates/review.projects.ini.erb` + * :file:`modules/openstack_project/files/review.projects.yaml` * :file:`modules/openstack_project/files/pypi-mirror.yaml` :Projects: * https://git.openstack.org/cgit/openstack-infra/jeepyb @@ -36,25 +37,28 @@ project in Gerrit, create the new project on Github, create a local git replica on the Gerrit host, configure the project Access Controls, and create new groups in Gerrit. +The global configuration data needed for ``manage-projects`` to know how to +connect to things or how to operate is in +:file:`modules/openstack_project/templates/review.projects.ini.erb`. + +#. Config values:: + + [projects] + homepage=http://example.org + local-git-dir=/var/lib/git + gerrit-host=review.example.org + gerrit-user=example-project-creator + gerrit-key=/home/gerrit2/.ssh/example_project_id_rsa + github-config=/etc/github/github-projects.secure.config + has-wiki=False + has-issues=False + has-pull-requests=False + has-downloads=False + OpenStack Gerrit projects are configured in the -:file:`modules/openstack_project/templates/review.projects.yaml.erb`. +:file:`modules/openstack_project/files/review.projects.yaml`. file. When this file is updated, ``manage-projects`` is run -automatically. This file contains two sections, the first is a set of -default config values that each project can override, and the second -is a list of projects (each may contain their own overrides). - -#. Config default values:: - - - homepage: http://example.org - local-git-dir: /var/lib/git - gerrit-host: review.example.org - gerrit-user: example-project-creator - gerrit-key: /home/gerrit2/.ssh/example_project_id_rsa - github-config: /etc/github/github-projects.secure.config - has-wiki: False - has-issues: False - has-pull-requests: False - has-downloads: False +automatically. #. Project definition:: @@ -69,7 +73,7 @@ is a list of projects (each may contain their own overrides). The above config gives puppet and its related scripts enough information to create new projects, but not enough to add access controls to each project. To add access control you need to have have an ``acl-config`` -option for the project in ``review.projects.yaml.erb`` file. That option +option for the project in ``review.projects.yaml`` file. That option should have a value that is a path to the ``project.config`` for that project. @@ -99,7 +103,7 @@ a single project you will want to do the following: mergeContent = true #. Add a project entry for the project in - ``modules/openstack_project/templates/review.projects.yaml.erb``.:: + ``modules/openstack_project/files/review.projects.yaml``.:: - project: openstack/project-name acl-config: /home/gerrit2/acls/project-name.config diff --git a/doc/source/running-your-own.rst b/doc/source/running-your-own.rst index ba24463c4e..7a308a5393 100644 --- a/doc/source/running-your-own.rst +++ b/doc/source/running-your-own.rst @@ -179,8 +179,9 @@ Migrate the manifests: . file to let git add it). ``http://ci.openstack.org/stackforge.html`` covers how it gets populated when your infrastructure is working. - * Ditto projects.yaml, which is passed in from your review.pp - something like - $PROJECT/templates/review.projects.yaml.erb + * Ditto projects.yaml and projects.ini, which is passed in from your + review.pp - something like $PROJECT/files/review.projects.yaml + and $PROJECT/templates/review.projects.ini.erb * set_agreements is a database migration tool for gerrit CLAs; not needed unless you have CLAs. diff --git a/doc/source/stackforge.rst b/doc/source/stackforge.rst index 7566456e12..caf8a5cba2 100644 --- a/doc/source/stackforge.rst +++ b/doc/source/stackforge.rst @@ -49,10 +49,9 @@ with simple changes to the openstack-infra/config repository. To start make sure you have cloned the openstack-infra/config repository ``git clone https://git.openstack.org/openstack-infra/config``. -First you need to add your StackForge project to the master project -list. Edit -``modules/openstack_project/templates/review.projects.yaml.erb`` -and add a new section for your project in alphabetical order within the file. +First you need to add your StackForge project to the master project list. +Edit ``modules/openstack_project/files/review.projects.yaml`` and add a +new section for your project in alphabetical order within the file. It should look something like:: - project: stackforge/project-name diff --git a/modules/openstack_project/files/nodepool/scripts/cache_git_repos.py b/modules/openstack_project/files/nodepool/scripts/cache_git_repos.py index e53cb200f1..6b5bba6cbc 100644 --- a/modules/openstack_project/files/nodepool/scripts/cache_git_repos.py +++ b/modules/openstack_project/files/nodepool/scripts/cache_git_repos.py @@ -22,7 +22,7 @@ import urllib2 from common import run_local URL = ('http://git.openstack.org/cgit/openstack-infra/config/plain/' - 'modules/openstack_project/templates/review.projects.yaml.erb') + 'modules/openstack_project/files/review.projects.yaml') PROJECT_RE = re.compile('^-?\s+project:\s+(.*)$') diff --git a/modules/openstack_project/files/review-dev.projects.yaml b/modules/openstack_project/files/review-dev.projects.yaml new file mode 100644 index 0000000000..d38a743429 --- /dev/null +++ b/modules/openstack_project/files/review-dev.projects.yaml @@ -0,0 +1,8 @@ +- project: gtest-org/gtest +- project: completely-bogus-org/test +- project: gtest-org/test +- project: gtest-org/test2 +- project: gtest-org/test3 +- project: gtest-org/test-manage-project + acl-config: /home/gerrit2/acls/test-manage-project.config +- project: gtest-org/test.hyphen diff --git a/modules/openstack_project/templates/review.projects.yaml.erb b/modules/openstack_project/files/review.projects.yaml similarity index 98% rename from modules/openstack_project/templates/review.projects.yaml.erb rename to modules/openstack_project/files/review.projects.yaml index c64cb3e3a6..b929cbf844 100644 --- a/modules/openstack_project/templates/review.projects.yaml.erb +++ b/modules/openstack_project/files/review.projects.yaml @@ -1,16 +1,3 @@ -- homepage: http://openstack.org - acl-dir: /home/gerrit2/acls - local-git-dir: <%= local_git_dir %> - gerrit-host: <%= fqdn %> - gerrit-user: openstack-project-creator - gerrit-committer: OpenStack Project Creator - gerrit-key: <%= ssh_project_key %> - github-config: /etc/github/github-projects.secure.config - has-wiki: False - has-issues: False - has-pull-requests: False - has-downloads: False ---- - project: openstack-dev/cookiecutter description: Cookiecutter Template for new OpenStack projects upstream: git://github.com/emonty/cookiecutter-openstack.git diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index aca82a348f..5ab9d31756 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -42,6 +42,7 @@ class openstack_project::gerrit ( $script_key_file = '/home/gerrit2/.ssh/id_rsa', $script_logging_conf = '/home/gerrit2/.sync_logging.conf', $projects_file = 'UNDEF', + $projects_config = 'UNDEF', $github_username = '', $github_oauth_token = '', $github_project_username = '', @@ -313,7 +314,17 @@ class openstack_project::gerrit ( owner => 'gerrit2', group => 'gerrit2', mode => '0444', - content => template($projects_file), + source => $projects_file, + replace => true, + require => Class['::gerrit'], + } + + file { '/home/gerrit2/projects.ini': + ensure => present, + owner => 'gerrit2', + group => 'gerrit2', + mode => '0444', + content => template($projects_config), replace => true, require => Class['::gerrit'], } diff --git a/modules/openstack_project/manifests/git_backend.pp b/modules/openstack_project/manifests/git_backend.pp index 2218410843..42795428fe 100644 --- a/modules/openstack_project/manifests/git_backend.pp +++ b/modules/openstack_project/manifests/git_backend.pp @@ -78,7 +78,7 @@ class openstack_project::git_backend ( owner => 'cgit', group => 'cgit', mode => '0444', - content => template('openstack_project/review.projects.yaml.erb'), + source => 'puppet:///modules/openstack_project/review.projects.yaml', replace => true, } diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index 189bff14aa..4457920c77 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -112,7 +112,9 @@ class openstack_project::review ( script_key_file => '/home/gerrit2/.ssh/launchpadsync_rsa', script_logging_conf => '/home/gerrit2/.sync_logging.conf', projects_file => - 'openstack_project/review.projects.yaml.erb', + 'puppet:///modules/openstack_project/review.projects.yaml', + projects_config => + 'openstack_project/review.projects.ini', github_username => 'openstack-gerrit', github_oauth_token => $github_oauth_token, github_project_username => $github_project_username, diff --git a/modules/openstack_project/manifests/review_dev.pp b/modules/openstack_project/manifests/review_dev.pp index 80d06c9a5b..6d645e1aa8 100644 --- a/modules/openstack_project/manifests/review_dev.pp +++ b/modules/openstack_project/manifests/review_dev.pp @@ -59,7 +59,9 @@ class openstack_project::review_dev ( script_key_file => '/home/gerrit2/.ssh/launchpadsync_rsa', script_logging_conf => '/home/gerrit2/.sync_logging.conf', projects_file => - 'openstack_project/review-dev.projects.yaml.erb', + 'puppet:///modules/openstack_project/review-dev.projects.yaml', + projects_config => + 'openstack_project/review-dev.projects.ini.erb', github_username => 'openstack-gerrit-dev', github_oauth_token => $github_oauth_token, github_project_username => $github_project_username, diff --git a/modules/openstack_project/templates/review-dev.projects.ini.erb b/modules/openstack_project/templates/review-dev.projects.ini.erb new file mode 100644 index 0000000000..089b1dc197 --- /dev/null +++ b/modules/openstack_project/templates/review-dev.projects.ini.erb @@ -0,0 +1,11 @@ +[projects] +homepage=http://openstack.org +acl-dir=/home/gerrit2/acls +local-git-dir=<%= local_git_dir %> +gerrit-host=<%= fqdn %> +gerrit-user=openstack-dev-project-creator +gerrit-key=<%= ssh_project_key %> +github-config=/etc/github/github-projects.secure.config +has-wiki=False +has-issues=False +has-downloads=False diff --git a/modules/openstack_project/templates/review-dev.projects.yaml.erb b/modules/openstack_project/templates/review-dev.projects.yaml.erb deleted file mode 100644 index 6568543855..0000000000 --- a/modules/openstack_project/templates/review-dev.projects.yaml.erb +++ /dev/null @@ -1,19 +0,0 @@ -- homepage: http://openstack.org - acl-dir: /home/gerrit2/acls - local-git-dir: <%= local_git_dir %> - gerrit-host: <%= fqdn %> - gerrit-user: openstack-dev-project-creator - gerrit-key: <%= ssh_project_key %> - github-config: /etc/github/github-projects.secure.config - has-wiki: False - has-issues: False - has-downloads: False ---- -- project: gtest-org/gtest -- project: completely-bogus-org/test -- project: gtest-org/test -- project: gtest-org/test2 -- project: gtest-org/test3 -- project: gtest-org/test-manage-project - acl-config: /home/gerrit2/acls/test-manage-project.config -- project: gtest-org/test.hyphen diff --git a/modules/openstack_project/templates/review.projects.ini.erb b/modules/openstack_project/templates/review.projects.ini.erb new file mode 100644 index 0000000000..09a23624d6 --- /dev/null +++ b/modules/openstack_project/templates/review.projects.ini.erb @@ -0,0 +1,13 @@ +[projects] +homepage=http://openstack.org +acl-dir=/home/gerrit2/acls +local-git-dir=<%= local_git_dir %> +gerrit-host=<%= fqdn %> +gerrit-user=openstack-project-creator +gerrit-committer=OpenStack Project Creator +gerrit-key=<%= ssh_project_key %> +github-config=/etc/github/github-projects.secure.config +has-wiki=False +has-issues=False +has-pull-requests=False +has-downloads=False diff --git a/tools/check_projects_yaml_alphabetized.sh b/tools/check_projects_yaml_alphabetized.sh index 3951f8fa0e..87beb69598 100755 --- a/tools/check_projects_yaml_alphabetized.sh +++ b/tools/check_projects_yaml_alphabetized.sh @@ -7,13 +7,7 @@ export TMPDIR=`/bin/mktemp -d` trap "rm -rf $TMPDIR" EXIT pushd $TMPDIR - -if [ -f $OLDPWD/modules/openstack_project/templates/review.projects.yaml.erb ] -then - PROJECTS_LIST=$OLDPWD/modules/openstack_project/templates/review.projects.yaml.erb -else - PROJECTS_LIST=$OLDPWD/modules/openstack_project/files/review.projects.yaml -fi +PROJECTS_LIST=$OLDPWD/modules/openstack_project/files/review.projects.yaml sed -e '/^- project: /!d' -e 's/^- project: //' $PROJECTS_LIST > projects_list