Merge "Don't set tracing in environment files"

This commit is contained in:
Jenkins 2016-11-01 01:42:59 +00:00 committed by Gerrit Code Review
commit cc1b37e731
4 changed files with 12 additions and 21 deletions

View File

@ -151,6 +151,12 @@ for i in $(find elements -type f \
fi
fi
# check that environment files don't "set -x"
if [[ "$i" =~ (environment.d) ]]; then
if grep -q "set -x" $i; then
error "Environment file $i should not set tracing"
fi
fi
# check that sudo calls in phases run outside the chroot look
# "safe"; meaning that they seem to operate within the chroot

View File

@ -172,11 +172,12 @@ the image as executable files.
Environment Variables
^^^^^^^^^^^^^^^^^^^^^
To set environment variables for other hooks, add a file to your element
``environment.d``.
This directory contains bash script snippets that are sourced before running
scripts in each phase.
To set environment variables for other hooks, add a file to your
element ``environment.d``. This directory contains bash script
snippets that are sourced before running scripts in each phase. Note
that because environment includes are sourced together, they should
not set global flags like ``set -x`` because they will affect all
preceeding imports.
DIB exposes an internal ``$IMAGE_ELEMENT`` variable which provides elements
access to the full set of elements that are included in the image build. This

View File

@ -1,9 +1 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
export DIB_EXTLINUX=1

View File

@ -1,5 +1,3 @@
#!/bin/bash
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,11 +13,5 @@
# under the License.
#
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
export DIB_MANIFEST_IMAGE_DIR=${DIB_MANIFEST_IMAGE_DIR:-/etc/dib-manifests}
export DIB_MANIFEST_SAVE_DIR=${DIB_MANIFEST_SAVE_DIR:-${IMAGE_NAME}.d/}