Ensure git folder rights and always run clone script

In https://review.openstack.org/380553 a change was made to
only execute the clone script if the script changes. This
has resulted in a failure when using a pre-staged git cache.

As the script only executes clone tasks if the git repo is
broken or the SHA isn't in the clone, it's OK to execute it
multiple times.

This patch ensures that the script always runs, but also tries
to add changes to the tests to try to uncover the cause of the
integrated build failure which the previous patch caused.

Additionally, the patch also adds tasks to ensure that the git
folder has the correct owner:group.

Change-Id: I40a02c26d0abc9d17dd7fad2eab969d169c436bb
This commit is contained in:
Jesse Pretorius 2016-10-06 21:02:56 +01:00 committed by Jesse Pretorius (odyssey4me)
parent f2384e09be
commit e7baae22ae
3 changed files with 42 additions and 4 deletions

View File

@ -31,6 +31,7 @@ repo_build_use_upper_constraints: true
repo_build_upper_constraints_overrides: []
repo_build_service_user_name: "nginx"
repo_build_service_group_name: "www-data"
repo_build_base_path: "/var/www/repo"
repo_build_global_links_path: "/var/www/repo/links"

View File

@ -17,7 +17,23 @@
template:
src: "op-clone-script.sh.j2"
dest: "/opt/op-clone-script.sh"
register: repo_clone_script_template
tags:
- repo-clone-repos
- name: Check if the git folder exists already
stat:
path: "{{ repo_build_git_dir }}"
register: _git_folder
tags:
- repo-clone-repos
- name: Git service data folder setup
file:
path: "{{ (_git_folder.stat.exists and _git_folder.stat.islnk) | ternary(_git_folder.stat.lnk_source, repo_build_git_dir) }}"
state: "directory"
owner: "{{ repo_build_service_user_name }}"
group: "{{ repo_build_service_group_name }}"
recurse: true
tags:
- repo-clone-repos
@ -25,6 +41,5 @@
shell: "bash /opt/op-clone-script.sh"
become: yes
become_user: "{{ repo_build_service_user_name }}"
when: repo_clone_script_template | changed
tags:
- repo-clone-repos

View File

@ -19,7 +19,22 @@
roles:
- "repo_server"
post_tasks:
- name: Pre-cache the keystone git repository
- name: Check if the git cache exists on deployment host
local_action:
module: stat
path: "/opt/git/openstack"
register: _local_git_cache
- name: Pre-cache the keystone git repository (from git cache)
synchronize:
src: "/opt/git/openstack/keystone/"
dest: "/var/www/repo/openstackgit/keystone"
when:
- _local_git_cache.stat is defined
- _local_git_cache.stat.exists
- name: Pre-cache the keystone git repository (from git source)
git:
repo: "https://git.openstack.org/openstack/keystone"
dest: "/var/www/repo/openstackgit/keystone"
@ -27,7 +42,11 @@
update: yes
become: yes
become_user: "{{ repo_build_service_user_name }}"
- name: Pre-cache the tempest git repository
when:
- _local_git_cache.stat is defined
- not _local_git_cache.stat.exists
- name: Pre-cache the tempest git repository (from git source)
git:
repo: "https://git.openstack.org/openstack/tempest"
dest: "/var/www/repo/openstackgit/tempest"
@ -35,13 +54,16 @@
update: yes
become: yes
become_user: "{{ repo_build_service_user_name }}"
- name: Intentionally set the keystone repo remote origin to github
shell: "git remote set-url origin https://github.com/openstack/keystone.git"
args:
chdir: "/var/www/repo/openstackgit/keystone"
- name: Intentionally remote the tempest repo remote origin
shell: "git remote remove origin"
args:
chdir: "/var/www/repo/openstackgit/tempest"
vars_files:
- test-vars.yml