diff --git a/jenkins/scripts/release-tools/functions b/jenkins/scripts/release-tools/functions index 6ec0b61aee..93801fb867 100644 --- a/jenkins/scripts/release-tools/functions +++ b/jenkins/scripts/release-tools/functions @@ -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 } diff --git a/jenkins/scripts/release-tools/update_constraints.sh b/jenkins/scripts/release-tools/update_constraints.sh index 6746510087..3c10c1a0a2 100755 --- a/jenkins/scripts/release-tools/update_constraints.sh +++ b/jenkins/scripts/release-tools/update_constraints.sh @@ -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 diff --git a/playbooks/proposal/pre.yaml b/playbooks/proposal/pre.yaml index c404916e58..66d87aac59 100644 --- a/playbooks/proposal/pre.yaml +++ b/playbooks/proposal/pre.yaml @@ -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 diff --git a/playbooks/release/pre.yaml b/playbooks/release/pre.yaml index 1779904990..63685437c2 100644 --- a/playbooks/release/pre.yaml +++ b/playbooks/release/pre.yaml @@ -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 }}" diff --git a/roles/configure-git/README.rst b/roles/configure-git/README.rst new file mode 100644 index 0000000000..cdd4b0d567 --- /dev/null +++ b/roles/configure-git/README.rst @@ -0,0 +1 @@ +Configure git with specific options \ No newline at end of file diff --git a/roles/configure-git/defaults/main.yaml b/roles/configure-git/defaults/main.yaml new file mode 100644 index 0000000000..43d7614784 --- /dev/null +++ b/roles/configure-git/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +git_config_scope: global +git_config: {} \ No newline at end of file diff --git a/roles/configure-git/tasks/main.yaml b/roles/configure-git/tasks/main.yaml new file mode 100644 index 0000000000..88d183ac8f --- /dev/null +++ b/roles/configure-git/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- name: Configure Git + git_config: + name: "{{ item.key }}" + scope: "{{ git_config_scope }}" + value: "{{ item.value }}" + with_dict: "{{ git_config }}" \ No newline at end of file