move git configuration for release jobs to ansible tasks
Instead of scripting the git configuration, use tasks in pre playbooks for the jobs. We use different settings for tag-releases and propose-constraint-updates. Change-Id: Id3713d89a8b2af821de41a146954be551337cf75 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
1f2e5692b9
commit
ae2422adf6
@ -98,15 +98,6 @@ function update_upper_constraints {
|
||||
}
|
||||
|
||||
|
||||
function configure_git_review_for_release {
|
||||
echo "Configuring git review for the release user"
|
||||
git config --global user.name "OpenStack Release Bot"
|
||||
git config --global user.email "infra-root@openstack.org"
|
||||
git config --global user.signingkey "infra-root@openstack.org"
|
||||
git config --global gitreview.username "release"
|
||||
}
|
||||
|
||||
|
||||
function clone_repo {
|
||||
typeset repo="$1"
|
||||
typeset branch="$2"
|
||||
@ -129,19 +120,9 @@ function clone_repo {
|
||||
(cd $repo && cat .git/config) || echo "could not cat .git/config in $(pwd)"
|
||||
(cd $repo && ssh -vvv -p 29418 release@review.openstack.org gerrit version ) || echo "could not connect to gerrit via ssh"
|
||||
|
||||
# Configure git-review so we can propose patches to the repo if
|
||||
# needed. Some of the release scripts are still run by hand to
|
||||
# recover from failure, in which case we don't want to set the git
|
||||
# review user. So try to make git review work by itself first, and
|
||||
# only if that fails update the git configuration.
|
||||
echo "Testing git review configuration. It is safe to ignore a failure here."
|
||||
if ! (cd $repo && git review -s -v); then
|
||||
(cd $repo &&
|
||||
configure_git_review_for_release &&
|
||||
echo "Retrying git review. Do not ignore failures" &&
|
||||
git review -s -v
|
||||
)
|
||||
fi
|
||||
# We assume the job uses a git_config task to configure git
|
||||
# properly.
|
||||
(cd $repo && git review -s -v)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ if [[ -z "$dist_name" ]]; then
|
||||
echo "Could not determine the name of the constraint to update"
|
||||
else
|
||||
setup_temp_space update-constraints-$SHORTNAME
|
||||
# NOTE(dhellmann): zuul-cloner defaults to checking out master if
|
||||
# NOTE(dhellmann): clone_repo defaults to checking out master if
|
||||
# the named branch doesn't exist.
|
||||
clone_repo openstack/requirements stable/$SERIES
|
||||
cd openstack/requirements
|
||||
|
@ -4,6 +4,11 @@
|
||||
command: pip install git-review
|
||||
become: yes
|
||||
roles:
|
||||
- role: configure-git
|
||||
git_config:
|
||||
user.name: OpenStack Proposal Bot
|
||||
user.email: openstack-infra@lists.openstack.org
|
||||
gitreview.username: proposal-bot
|
||||
- legacy-copy-project-config-scripts
|
||||
- add-sshkey
|
||||
- role: bindep
|
||||
|
@ -1,14 +1,18 @@
|
||||
- hosts: all
|
||||
pre_tasks:
|
||||
|
||||
# This is tempoarary until v2 is gone and we can rework things
|
||||
- name: Add origin remote to enable notes fetching
|
||||
command: "git remote add origin https://{{ item.canonical_name }}"
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/src/{{ item.canonical_name }}"
|
||||
with_items: "{{ zuul.projects }}"
|
||||
|
||||
roles:
|
||||
- role: configure-git
|
||||
git_config:
|
||||
user.name: OpenStack Release Bot
|
||||
user.email: infra-root@openstack.org
|
||||
user.signingkey: infra-root@openstack.org
|
||||
gitreview.username: release
|
||||
- role: bindep
|
||||
bindep_profile: test
|
||||
bindep_dir: "src/{{ zuul.project.canonical_name }}"
|
||||
|
1
roles/configure-git/README.rst
Normal file
1
roles/configure-git/README.rst
Normal file
@ -0,0 +1 @@
|
||||
Configure git with specific options
|
3
roles/configure-git/defaults/main.yaml
Normal file
3
roles/configure-git/defaults/main.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
git_config_scope: global
|
||||
git_config: {}
|
7
roles/configure-git/tasks/main.yaml
Normal file
7
roles/configure-git/tasks/main.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Configure Git
|
||||
git_config:
|
||||
name: "{{ item.key }}"
|
||||
scope: "{{ git_config_scope }}"
|
||||
value: "{{ item.value }}"
|
||||
with_dict: "{{ git_config }}"
|
Loading…
Reference in New Issue
Block a user