project-config/jenkins/jobs/ironic.yaml
dparalen 91f259453b enable stack sudo for ironic discovery gate job
discovery_exercise.sh performs two steps that require superuser privileges:
* iptables -L ironic-inspector to confirm a node is not blacklisted before
  booting it for the discovery process
* virsh start <baremetal_domain> to trigger the discovery process of a node

This patch changes safe-devstack-vm-gate-wrap.sh behavior to avoid dropping
stack user from sudoers.d Similar approach has already been applied in case
of the nodepool.yaml set of jobs[1]

Links:
[1] https://github.com/openstack-infra/project-config/blob/master/jenkins/jobs/nodepool.yaml#L77

Change-Id: I69fb19f4baa0ae433ac53a4384992ee6a9d3ba65
2016-03-11 12:23:52 +01:00

251 lines
9.3 KiB
YAML

- job-template:
name: '{pipeline}-ironic-dsvm-functional{job-suffix}'
node: '{node}'
wrappers:
- build-timeout:
timeout: 80
- timestamps
builders:
- link-logs
- net-info
- devstack-checkout
- shell: |
#!/bin/bash -xe
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_TEMPEST=1
export DEVSTACK_GATE_IRONIC=1
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_GATE_VIRT_DRIVER=ironic
export TEMPEST_CONCURRENCY=2
export BRANCH_OVERRIDE={branch-override}
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
# tempest-lib support was added in Mitaka. Fall back to tempest for other stable branches.
if [ "$ZUUL_BRANCH" == "stable/kilo" -o "$ZUUL_BRANCH" == "stable/liberty" ] ; then
export DEVSTACK_GATE_TEMPEST_REGEX='baremetal'
else
export DEVSTACK_GATE_TEMPEST_ALL_PLUGINS=1
export DEVSTACK_GATE_TEMPEST_REGEX='ironic'
fi
export DEVSTACK_LOCAL_CONFIG="enable_plugin ironic git://git.openstack.org/openstack/ironic"
# No post_test_hook is needed while tests live in tempest
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
publishers:
- devstack-logs
- console-log
- job-template:
name: '{pipeline}-ironicclient-dsvm-functional{job-suffix}'
node: '{node}'
wrappers:
- build-timeout:
timeout: 80
- timestamps
builders:
- link-logs
- net-info
- devstack-checkout
- shell: |
#!/bin/bash -xe
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_TEMPEST=0
export DEVSTACK_PROJECT_FROM_GIT=python-ironicclient
export OVERRIDE_ENABLED_SERVICES=key,mysql,rabbit,ir-api,ir-cond
export BRANCH_OVERRIDE={branch-override}
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
export PROJECTS="openstack/ironic openstack/python-ironicclient $PROJECTS"
export DEVSTACK_LOCAL_CONFIG="enable_plugin ironic git://git.openstack.org/openstack/ironic"
function post_test_hook {{
# Configure and run functional tests
$BASE/new/python-ironicclient/ironicclient/tests/functional/hooks/post_test_hook.sh
}}
export -f post_test_hook
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
publishers:
- devstack-logs
- console-log
- job-template:
name: '{pipeline}-ironic-inspector-dsvm-{ramdisk}{job-suffix}'
node: '{node}'
wrappers:
- build-timeout:
timeout: 80
- timestamps
builders:
- link-logs
- net-info
- devstack-checkout
- shell: |
#!/bin/bash -xe
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_TEMPEST=0
export DEVSTACK_GATE_IRONIC=1
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_GATE_VIRT_DRIVER=ironic
export BRANCH_OVERRIDE={branch-override}
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
export PROJECTS="openstack/ironic openstack/ironic-inspector $PROJECTS"
# devstack plugin didn't exist until mitaka
if [[ "$ZUUL_BRANCH" != "stable/liberty" ]] ; then
export DEVSTACK_LOCAL_CONFIG="enable_plugin ironic git://git.openstack.org/openstack/ironic"
else
export DEVSTACK_LOCAL_CONFIG=""
fi
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ironic-inspector https://git.openstack.org/openstack/ironic-inspector"
if [ "{ramdisk}" != "dib" ] ; then
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_DEPLOY_DRIVER_ISCSI_WITH_IPA=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_RAMDISK_ELEMENT=ironic-agent"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_BUILD_DEPLOY_RAMDISK=False"
# IPA requires at least 1 GiB of RAM
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=1024"$'\n'"IRONIC_VM_COUNT=1"
if [ "{ramdisk}" == "ipa-src" ] ; then
export PROJECTS="openstack/ironic-python-agent $PROJECTS"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_BUILD_RAMDISK=True"
elif [ "{ramdisk}" == "ipa-ipxe" ] ; then
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_IPXE_ENABLED=True"
fi
fi
function post_test_hook {{
source $BASE/new/devstack/openrc admin admin
cd /opt/stack/new/ironic-inspector
sudo -E -u stack ./devstack/exercise.sh
}}
export -f post_test_hook
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
publishers:
- devstack-logs
- console-log
- job-template:
name: '{pipeline}-ironic-inspector-dsvm-discovery{job-suffix}'
node: '{node}'
wrappers:
- build-timeout:
timeout: 80
- timestamps
builders:
- link-logs
- net-info
- devstack-checkout
- shell: |
#!/bin/bash -xe
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_TEMPEST=0
export DEVSTACK_GATE_IRONIC=1
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_GATE_VIRT_DRIVER=ironic
export BRANCH_OVERRIDE={branch-override}
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
export PROJECTS="openstack/ironic openstack/ironic-inspector $PROJECTS"
export DEVSTACK_LOCAL_CONFIG="enable_plugin ironic git://git.openstack.org/openstack/ironic"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ironic-inspector https://git.openstack.org/openstack/ironic-inspector"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_DEPLOY_DRIVER_ISCSI_WITH_IPA=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_RAMDISK_ELEMENT=ironic-agent"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_BUILD_DEPLOY_RAMDISK=False"
# IPA requires at least 1 GiB of RAM
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=1024"$'\n'"IRONIC_VM_COUNT=1"
# enable enroll hook
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_NODE_NOT_FOUND_HOOK=enroll"
# discovery_exercise.sh requires iptables and virsh direct access
export DEVSTACK_GATE_REMOVE_STACK_SUDO=0
function post_test_hook {{
source $BASE/new/devstack/openrc admin admin
cd /opt/stack/new/ironic-inspector
sudo -E -u stack ./devstack/discovery_exercise.sh
}}
export -f post_test_hook
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
publishers:
- devstack-logs
- console-log
- job-template:
name: '{pipeline}-python-ironic-inspector-client-dsvm{job-suffix}'
node: '{node}'
wrappers:
- build-timeout:
timeout: 80
- timestamps
builders:
- link-logs
- net-info
- devstack-checkout
- shell: |
#!/bin/bash -xe
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_TEMPEST=0
export DEVSTACK_GATE_IRONIC=1
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_GATE_VIRT_DRIVER=ironic
export BRANCH_OVERRIDE={branch-override}
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
export DEVSTACK_PROJECT_FROM_GIT="python-ironic-inspector-client"
export PROJECTS="openstack/ironic openstack/python-ironic-inspector-client openstack/ironic-inspector $PROJECTS"
# devstack plugin didn't exist until mitaka
if [[ "$ZUUL_BRANCH" != "stable/liberty" ]] ; then
export DEVSTACK_LOCAL_CONFIG="enable_plugin ironic git://git.openstack.org/openstack/ironic"
else
export DEVSTACK_LOCAL_CONFIG=""
fi
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ironic-inspector https://git.openstack.org/openstack/ironic-inspector"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_DEPLOY_DRIVER_ISCSI_WITH_IPA=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_RAMDISK_ELEMENT=ironic-agent"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_BUILD_DEPLOY_RAMDISK=False"
# IPA requires at least 1 GiB of RAM
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=1024"$'\n'"IRONIC_VM_COUNT=1"
function post_test_hook {{
source $BASE/new/devstack/openrc admin admin
cd /opt/stack/new/ironic-inspector
sudo -E -u stack ./devstack/exercise.sh
}}
export -f post_test_hook
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
publishers:
- devstack-logs
- console-log