diff --git a/playbooks/files/project-requirements-change.py b/playbooks/files/project-requirements-change.py index b9ab2e5ee5..6e45ab9849 100755 --- a/playbooks/files/project-requirements-change.py +++ b/playbooks/files/project-requirements-change.py @@ -170,7 +170,6 @@ def main(): cwd = os.getcwd() # build a list of requirements in the proposed change, # and check them for style violations while doing so - head = run_command("git rev-parse HEAD")[0] head_proj = project.read(cwd) head_reqs = RequirementsList('HEAD', head_proj) # Don't apply strict parsing rules to stable branches. @@ -187,11 +186,11 @@ def main(): if not args.local: # build a list of requirements already in the target branch, # so that we can create a diff and identify what's being changed - run_command("git checkout %s" % branch) + run_command("git checkout HEAD^1") branch_proj = project.read(cwd) # switch back to the proposed change now - run_command("git checkout %s" % head) + run_command("git checkout %s" % branch) else: branch_proj = {'root': cwd} branch_reqs = RequirementsList(branch, branch_proj) diff --git a/playbooks/requirements-check.yaml b/playbooks/requirements-check.yaml index b08eebd27e..e4c139b255 100644 --- a/playbooks/requirements-check.yaml +++ b/playbooks/requirements-check.yaml @@ -1,4 +1,8 @@ - hosts: all tasks: - name: Run requirements check script - script: "files/project-requirements-change.py {{ zuul.project.src_dir }} {{ zuul.branch }}" + # Use command module here instead of script since Zuul gets output + # with command into job-output.txt file. + # Command expects the file to be at the remote system - the system + # running the tests. Ask zuul variables for the path. + command: "{{ zuul._projects['git.openstack.org/openstack/requirements'].src_dir }}/playbooks/files/project-requirements-change.py {{ zuul.project.src_dir }} {{ zuul.branch }}"