files = **.sh
ignore = .git/**,
.tox/**,
+ jjb/global-jjb/**,
+ jjb/integration/**,
jenkins-scripts/*-local-env.sh
shell = bash
indent_size = 4
# in cases where an internal ci system is using multiple NEXUS systems one for artifacts and another for staging,
# we can override using ODLNEXUS_STAGING_URL to route the staging build to the 2nd server.
# (most CI setups where a single Nexus server is used, ODLNEXUS_STAGING_URL should be left unset)
-NEXUS_STAGING_URL=${ODLNEXUS_STAGING_URL:-$ODLNEXUSPROXY}
+NEXUS_STAGING_URL="${ODLNEXUS_STAGING_URL:-$ODLNEXUSPROXY}"
-NEXUSURL=${NEXUS_STAGING_URL}/content/repositories/
+NEXUSURL="${NEXUS_STAGING_URL}/content/repositories/"
VERSION=$(grep -m2 '<version>' "${WORKSPACE}/integration/distribution/${KARAF_ARTIFACT}/pom.xml" | tail -n1 | awk -F'[<|>]' '/version/ { printf $3 }')
echo "VERSION: ${VERSION}"
STAGING_REPO_ID=$(grep "Created staging repository with ID" "$WORKSPACE/deploy-staged-repository.log" | cut -d '"' -f2)
--else -o ""\
"$p" 2>/dev/null)
if [ ! -z "${GROUP}" ]; then
+ # shellcheck disable=SC2207
grouplist+=($(echo "${GROUP}" | awk -F'.' '{ print $3 }'))
fi
done < <(find . -name "pom.xml")
modules=$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' pom.xml)
for module in $modules; do
- pushd "$module"
+ pushd "$module" || exit
# TODO: Remove once stable/nitrogen is no longer supported.
if [ "$GERRIT_BRANCH" == "stable/nitrogen" ] && [ "$module" == "yangtools" ]; then
git format-patch --stdout "origin/v1.2.x" > "$PATCH_DIR/${module//\//-}.patch"
git format-patch --stdout "origin/$GERRIT_BRANCH" > "$PATCH_DIR/${module//\//-}.patch"
fi
git bundle create "$PATCH_DIR/${module//\//-}.bundle" "origin/master..HEAD"
- popd
+ popd || exit
done
tar cvzf "$WORKSPACE/archives/patches.tar.gz" -C "$WORKSPACE/archives" patches
fi
wget -nv -O /tmp/pom.xml "https://git.opendaylight.org/gerrit/gitweb?p=releng/autorelease.git;a=blob_plain;f=pom.xml;hb=$GERRIT_BRANCH"
+# Allow word splitting as we only expect modules to appear
+# shellcheck disable=2207
modules=($(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' /tmp/pom.xml))
cat > "$YAML_FILE" << EOF
FILE=repos.txt
find . -name pom.xml -print0 | xargs -0 grep -i '<repositories>\|<pluginRepositories>' > "$FILE"
-[[ $(tr -d "\r\n" < $FILE|wc -c) -eq 0 ]] && rm $FILE
+[[ $(tr -d "\\r\\n" < $FILE|wc -c) -eq 0 ]] && rm $FILE
if [ -a $FILE ]
then
script=$(mktemp)
-cat > $script <<EOF
+cat > "$script" <<EOF
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
url = link['href']
project = url.split('/')[3].split('-')[0]
- _file.write("{}\t{}{}\n".format(project, jenkins_url, url))
+ _file.write("{}\\t{}{}\\n".format(project, jenkins_url, url))
_file.close()
EOF
| awk -F": " -e '{print $3}' | sed "s:'::;s:'$::;/^$/d" | sort | uniq)"
for image in "${images[@]}"; do
- os_image_protected=$(openstack --os-cloud $OS_CLOUD image show "$image" -f value -c protected)
+ os_image_protected=$(openstack --os-cloud "$OS_CLOUD" image show "$image" -f value -c protected)
echo "Protected setting for $image: $os_image_protected"
if [[ $os_image_protected != True ]]; then
echo "Image: $image NOT set as protected, changing the protected value."
- openstack --os-cloud $OS_CLOUD image set --protected "$image"
+ openstack --os-cloud "$OS_CLOUD" image set --protected "$image"
fi
done
function copy-ssh-keys-to-slave() {
RETRIES=60
for j in $(seq 1 $RETRIES); do
- # shellcheck disable=SC2092
+ # shellcheck disable=SC2006,SC2092
if `ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1`; then
ssh "jenkins@${i}" 'echo "$(facter ipaddress_eth0) $(/bin/hostname)" | sudo tee -a /etc/hosts'
echo "Successfully copied public keys to slave ${i}"
# to which VM types.
openstack stack show -c outputs "$STACK_NAME"
-# shellcheck disable=SC2006
+# shellcheck disable=SC2006,SC2207
ADDR=(`openstack stack show -f json -c outputs "$STACK_NAME" | \
jq -r '.outputs[] | \
select(.output_key | match("^vm_[0-9]+_ips\$")) | \
# Blank line before EOF is on purpose to ensure there is spacing.
IFS=$'\n'
+# We purposely want globbing here to build images list
+# shellcheck disable=SC2207
IMAGES=($(openstack image list --long -f value -c Name -c Protected \
| grep 'ZZCI.*True' | sed 's/ True//'))
for i in "${IMAGES[@]}"; do
# shellcheck disable=SC2154 disable=SC2145
printf 'Dependency found: %s\n' "${{actual_deps[@]}}"
-# shellcheck disable=SC2154 disable=SC2145 disable=SC2034
+# shellcheck disable=SC2154,SC2145,SC2034,SC2207
diff_deps=(`echo "${{expected_deps[@]}}" "${{actual_deps[@]}}" | tr ' ' '\n' | sort | uniq -u`)
# shellcheck disable=SC2154 disable=SC2145 disable=SC2068 disable=SC2170 disable=SC1083
if [ ${{#diff_deps[*]}} -eq 0 ]; then
enable_service() {
# Enable services for Ubuntu instances
+ # We purposely want to allow globbing to build the package array
+ # shellcheck disable=SC2206
services=($@)
for service in "${services[@]}"; do
# On Ubuntu sometimes the mirrors fail to install a package. This wrapper
# checks that a package is successfully installed before moving on.
+ # We purposely want to allow globbing to build the package array
+ # shellcheck disable=SC2206
packages=($@)
for pkg in "${packages[@]}"
# shellcheck disable=SC2154
branch=${os_branch}
# strip the "stable" off of the branch
-branch_name=$(cut -d'/' -f2 <<< ${branch})
+branch_name=$(cut -d'/' -f2 <<< "${branch}")
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
cd tmp
git clone https://github.com/openstack-dev/devstack.git
-(cd devstack && git checkout ${branch})
+(cd devstack && git checkout "${branch}")
sed -e 's/#.*//' devstack/files/rpms/general | xargs yum install -y
base_url=https://github.com/openstack/
for proj in $projs
do
- git clone ${base_url}${proj}
- (cd ${proj} && git checkout ${branch})
- pip install -c requirements/upper-constraints.txt -e ${proj}
- pip install -c requirements/upper-constraints.txt -r ${proj}/test-requirements.txt
+ git clone "${base_url}${proj}"
+ (cd "${proj}" && git checkout "${branch}")
+ pip install -c requirements/upper-constraints.txt -e "${proj}"
+ pip install -c requirements/upper-constraints.txt -r "${proj}/test-requirements.txt"
done
echo '---> Installing openvswitch from relevant openstack branch'
-yum install -y centos-release-openstack-${branch_name}
+yum install -y "centos-release-openstack-${branch_name}"
yum install -y --nogpgcheck openvswitch
-cd $OLDPWD
+cd "$OLDPWD"
rm -fr tmp
# vim: sw=4 ts=4 sts=4 et :
sleep 15
ovs-vsctl --version
ovs-vsctl show
-ps -elf|grep ovs
-ps -elf|grep vtep
+# We want to see the entire ps output not just the pid
+# shellcheck disable=SC2009
+ps -elf | grep ovs
+# shellcheck disable=SC2009
+ps -elf | grep vtep
echo '---> Finished installing OpenVSwitch 2.6.1'
echo '---> Installing mininet'
./install.sh -nfv
echo '---> Installing cbench installation for running openflow performance tests'
-OF_DIR=$HOME/openflow # Directory that contains OpenFlow code
-OFLOPS_DIR=$HOME/oflops # Directory that contains oflops repo
+OF_DIR="$HOME/openflow" # Directory that contains OpenFlow code
+OFLOPS_DIR="$HOME/oflops" # Directory that contains oflops repo
apt-get install -y --force-yes libsnmp-dev libpcap-dev libconfig-dev
-git clone git://gitosis.stanford.edu/openflow.git $OF_DIR
-git clone https://github.com/andi-bigswitch/oflops.git $OFLOPS_DIR
+git clone git://gitosis.stanford.edu/openflow.git "$OF_DIR"
+git clone https://github.com/andi-bigswitch/oflops.git "$OFLOPS_DIR"
-cd $OFLOPS_DIR
+cd "$OFLOPS_DIR"
./boot.sh
-./configure --with-openflow-src-dir=$OF_DIR
+./configure --with-openflow-src-dir="$OF_DIR"
make
make install