Update aio job to use become and fix environment
The in-tree job definition did not pass the legacy ZUUL environment
into sudo or dump the ZUUL_ prefixed vars into zuul.env, so the
get-ansible-role-requirements script did not detect that it should
use Zuul provided sources when available.
This fixes the job definition in several ways:
1) The job definition no longer calls gate-check-commit using the
sudo command. Instead become/become_user are placed on the task
so ansible will handle the sudoing and we just call
gate-check-commit directly now.
2) The zuul legacy environment is removed from the job environment.
Only ZUUL_PROJECT is used in the integrated repo[1], so that is
the only var we define now, and we do not need anything special to
pass it into gate-check-commit since it is no longer running in
a sudo wrapper.
As a result of these changes, the zuul.env loading code is removed
from gate-check-commit.
[1] c3ce038737/tests/get-ansible-role-requirements.yml (L57)
Change-Id: Id0fb8502029e3f996d2557bc09c3314cc884bba8
This commit is contained in:
@@ -95,19 +95,6 @@ if [ -n "${DATA_DISK_DEVICE}" ]; then
|
|||||||
export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_data_disk_device=${DATA_DISK_DEVICE}"
|
export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_data_disk_device=${DATA_DISK_DEVICE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Grab all the zuul environment variables that
|
|
||||||
# were exported by the jenkins user into a file.
|
|
||||||
# This is used for cross-repo testing.
|
|
||||||
if [ -f zuul.env ]; then
|
|
||||||
# The ZUUL variables we get in the file are
|
|
||||||
# not quoted, so we change the file to ensure
|
|
||||||
# that they are. We also ensure that each
|
|
||||||
# var is exported so that it's accessible in
|
|
||||||
# any subshell.
|
|
||||||
sed -i 's|\(.*\)=\(.*\)$|export \1="\2"|' zuul.env
|
|
||||||
source zuul.env
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Bootstrap Ansible
|
# Bootstrap Ansible
|
||||||
source "${OSA_CLONE_DIR}/scripts/bootstrap-ansible.sh"
|
source "${OSA_CLONE_DIR}/scripts/bootstrap-ansible.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
- name: Run gate-check-commit.sh script
|
- name: Run gate-check-commit.sh script
|
||||||
command: "sudo scripts/gate-check-commit.sh {{ scenario }} {{ action }}"
|
become: yes
|
||||||
|
become_user: root
|
||||||
|
command: "scripts/gate-check-commit.sh {{ scenario }} {{ action }}"
|
||||||
args:
|
args:
|
||||||
chdir: "src/{{ zuul.project.canonical_name }}"
|
chdir: "src/{{ zuul.project.canonical_name }}"
|
||||||
environment: '{{ zuul | zuul_legacy_vars }}'
|
environment:
|
||||||
|
# ZUUL_PROJECT is used by tests/get-ansible-role-requirements to
|
||||||
|
# determine when CI provided repos should be used.
|
||||||
|
ZUUL_PROJECT: "{{ zuul.project.short_name }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user