format shell scripts with beautysh
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie72911e0f57a1f69b0bf317de8c52947886e1303
diff --git a/build-jenkins.sh b/build-jenkins.sh
index cdc61cb..079c260 100755
--- a/build-jenkins.sh
+++ b/build-jenkins.sh
@@ -92,34 +92,34 @@
# Make or Clean WORKSPACE
if [[ -d "${workspace}" ]]; then
- rm -rf "${workspace}/Dockerfile" \
- "${workspace}/docker-jenkins" \
- "${workspace}/plugins.*" \
- "${workspace}/install-plugins.sh" \
- "${workspace}/jenkins.sh" \
- "${workspace}/jenkins-support" \
- "${workspace}/init.groovy"
+ rm -rf "${workspace}/Dockerfile" \
+ "${workspace}/docker-jenkins" \
+ "${workspace}/plugins.*" \
+ "${workspace}/install-plugins.sh" \
+ "${workspace}/jenkins.sh" \
+ "${workspace}/jenkins-support" \
+ "${workspace}/init.groovy"
else
- mkdir -p "${workspace}"
+ mkdir -p "${workspace}"
fi
# Determine the prefix of the Dockerfile's base image
case ${ARCH} in
- "ppc64le")
- docker_base="ppc64le/"
- tini_arch="ppc64el"
- ;;
- "x86_64")
- docker_base=""
- tini_arch="amd64"
- ;;
- "aarch64")
- docker_base="arm64v8/"
- tini_arch="arm64"
- ;;
- *)
- echo "Unsupported system architecture(${ARCH}) found for docker image"
- exit 1
+ "ppc64le")
+ docker_base="ppc64le/"
+ tini_arch="ppc64el"
+ ;;
+ "x86_64")
+ docker_base=""
+ tini_arch="amd64"
+ ;;
+ "aarch64")
+ docker_base="arm64v8/"
+ tini_arch="arm64"
+ ;;
+ *)
+ echo "Unsupported system architecture(${ARCH}) found for docker image"
+ exit 1
esac
# Move Into the WORKSPACE
@@ -208,60 +208,60 @@
if [[ "${launch}" == "docker" ]]; then
- # Ensure directories that will be mounted exist
- if [[ -n "${host_import_mnt}" && ! -d "${host_import_mnt}" ]]; then
- mkdir -p "${host_import_mnt}"
- fi
-
- if [[ ! -d "${home_mnt}" ]]; then
- mkdir -p "${home_mnt}"
- fi
-
- # Ensure directories that will be mounted are owned by the jenkins user
- if [[ "$(id -u)" != 0 ]]; then
- echo "Not running as root:"
- echo "Checking if j_gid and j_uid are the owners of mounted directories"
- # shellcheck disable=SC2012 # use ls to get permissions.
- test_1="$(ls -nd "${home_mnt}" | awk '{print $3 " " $4}')"
- if [[ "${test_1}" != "${j_uid} ${j_gid}" ]]; then
- echo "Owner of ${home_mnt} is not the jenkins user"
- echo "${test_1} != ${j_uid} ${j_gid}"
- will_fail=1
+ # Ensure directories that will be mounted exist
+ if [[ -n "${host_import_mnt}" && ! -d "${host_import_mnt}" ]]; then
+ mkdir -p "${host_import_mnt}"
fi
+
+ if [[ ! -d "${home_mnt}" ]]; then
+ mkdir -p "${home_mnt}"
+ fi
+
+ # Ensure directories that will be mounted are owned by the jenkins user
+ if [[ "$(id -u)" != 0 ]]; then
+ echo "Not running as root:"
+ echo "Checking if j_gid and j_uid are the owners of mounted directories"
+ # shellcheck disable=SC2012 # use ls to get permissions.
+ test_1="$(ls -nd "${home_mnt}" | awk '{print $3 " " $4}')"
+ if [[ "${test_1}" != "${j_uid} ${j_gid}" ]]; then
+ echo "Owner of ${home_mnt} is not the jenkins user"
+ echo "${test_1} != ${j_uid} ${j_gid}"
+ will_fail=1
+ fi
+ if [[ -n "${host_import_mnt}" ]]; then
+ # shellcheck disable=SC2012 # use ls to get permissions.
+ test_2="$(ls -nd "${host_import_mnt}" | awk '{print $3 " " $4}' )"
+ if [[ "${test_2}" != "${j_uid} ${j_gid}" ]]; then
+ echo "Owner of ${host_import_mnt} is not the jenkins user"
+ echo "${test_2} != ${j_uid} ${j_gid}"
+ will_fail=1
+ fi
+ fi
+ if [[ "${will_fail}" == 1 ]]; then
+ echo "Failing before attempting to launch container"
+ echo "Try again as root or use correct uid/gid pairs"
+ exit 1
+ fi
+ else
+ if [[ -n "${host_import_mnt}" ]]; then
+ chown -R "${j_uid}:${j_gid}" "${host_import_mnt}"
+ fi
+ chown -R "${j_uid}:${j_gid}" "${home_mnt}"
+ fi
+
+ #If we don't have import mount don't add to docker command
if [[ -n "${host_import_mnt}" ]]; then
- # shellcheck disable=SC2012 # use ls to get permissions.
- test_2="$(ls -nd "${host_import_mnt}" | awk '{print $3 " " $4}' )"
- if [[ "${test_2}" != "${j_uid} ${j_gid}" ]]; then
- echo "Owner of ${host_import_mnt} is not the jenkins user"
- echo "${test_2} != ${j_uid} ${j_gid}"
- will_fail=1
- fi
+ import_vol_cmd="-v ${host_import_mnt}:${cont_import_mnt}"
fi
- if [[ "${will_fail}" == 1 ]]; then
- echo "Failing before attempting to launch container"
- echo "Try again as root or use correct uid/gid pairs"
- exit 1
- fi
- else
- if [[ -n "${host_import_mnt}" ]]; then
- chown -R "${j_uid}:${j_gid}" "${host_import_mnt}"
- fi
- chown -R "${j_uid}:${j_gid}" "${home_mnt}"
- fi
-
- #If we don't have import mount don't add to docker command
- if [[ -n "${host_import_mnt}" ]]; then
- import_vol_cmd="-v ${host_import_mnt}:${cont_import_mnt}"
- fi
- # Launch the jenkins image with Docker
- # shellcheck disable=SC2086 # import_vol_cmd is intentially word-split.
- docker run -d \
- ${import_vol_cmd} \
- -v "${home_mnt}:${j_home}" \
- -p "${http_port}:8080" \
- -p "${agent_port}:${agent_port}" \
- --env JAVA_OPTS=\""${java_options}"\" \
- --env JENKINS_OPTS=\""${jenkins_options}"\" \
- "${img_name}"
+ # Launch the jenkins image with Docker
+ # shellcheck disable=SC2086 # import_vol_cmd is intentially word-split.
+ docker run -d \
+ ${import_vol_cmd} \
+ -v "${home_mnt}:${j_home}" \
+ -p "${http_port}:8080" \
+ -p "${agent_port}:${agent_port}" \
+ --env JAVA_OPTS=\""${java_options}"\" \
+ --env JENKINS_OPTS=\""${jenkins_options}"\" \
+ "${img_name}"
fi
diff --git a/build-rootfs-size-docker.sh b/build-rootfs-size-docker.sh
index eb2b351..325d8c8 100755
--- a/build-rootfs-size-docker.sh
+++ b/build-rootfs-size-docker.sh
@@ -52,11 +52,11 @@
if [[ "${DISTRO}" == "ubuntu"* ]]; then
-if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
-fi
+ if [[ -n "${http_proxy}" ]]; then
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ fi
-Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ${DOCKER_BASE}${DISTRO}
${PROXY}
@@ -86,7 +86,7 @@
RUN /bin/bash
EOF
-)
+ )
fi
################################# docker img # #################################
diff --git a/build-setup.sh b/build-setup.sh
index 948279e..e40f54e 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -117,18 +117,18 @@
# Determine the prefix of the Dockerfile's base image
case ${ARCH} in
- "ppc64le")
- DOCKER_BASE="ppc64le/"
- ;;
- "x86_64")
- DOCKER_BASE=""
- ;;
- "aarch64")
- DOCKER_BASE="arm64v8/"
- ;;
- *)
- echo "Unsupported system architecture(${ARCH}) found for docker image"
- exit 1
+ "ppc64le")
+ DOCKER_BASE="ppc64le/"
+ ;;
+ "x86_64")
+ DOCKER_BASE=""
+ ;;
+ "aarch64")
+ DOCKER_BASE="arm64v8/"
+ ;;
+ *)
+ echo "Unsupported system architecture(${ARCH}) found for docker image"
+ exit 1
esac
# Timestamp for job
@@ -136,25 +136,25 @@
# If the obmc_dir directory doesn't exist clone it in
if [ ! -d "${obmc_dir}" ]; then
- echo "Clone in openbmc master to ${obmc_dir}"
- git clone https://github.com/openbmc/openbmc "${obmc_dir}"
+ echo "Clone in openbmc master to ${obmc_dir}"
+ git clone https://github.com/openbmc/openbmc "${obmc_dir}"
fi
if [[ "$target" = repotest ]]; then
- DOCKER_IMAGE_NAME=$(./scripts/build-unit-test-docker)
- docker run --cap-add=sys_admin --rm=true \
- --network host \
- --privileged=true \
- -u "$USER" \
- -w "${obmc_dir}" -v "${obmc_dir}:${obmc_dir}" \
- -t "${DOCKER_IMAGE_NAME}" \
- "${obmc_dir}"/meta-phosphor/scripts/run-repotest
- exit
+ DOCKER_IMAGE_NAME=$(./scripts/build-unit-test-docker)
+ docker run --cap-add=sys_admin --rm=true \
+ --network host \
+ --privileged=true \
+ -u "$USER" \
+ -w "${obmc_dir}" -v "${obmc_dir}:${obmc_dir}" \
+ -t "${DOCKER_IMAGE_NAME}" \
+ "${obmc_dir}"/meta-phosphor/scripts/run-repotest
+ exit
fi
# Make and chown the xtrct_path directory to avoid permission errors
if [ ! -d "${xtrct_path}" ]; then
- mkdir -p "${xtrct_path}"
+ mkdir -p "${xtrct_path}"
fi
chown "${UID}:${GROUPS[0]}" "${xtrct_path}"
@@ -168,11 +168,11 @@
# Configure Docker build
if [[ "${distro}" == fedora ]];then
- if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf"
- fi
+ if [[ -n "${http_proxy}" ]]; then
+ PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf"
+ fi
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ${DOCKER_BASE}${distro}:${img_tag}
${PROXY}
@@ -217,15 +217,15 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
elif [[ "${distro}" == ubuntu ]]; then
- if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
- fi
+ if [[ -n "${http_proxy}" ]]; then
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ fi
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ${DOCKER_BASE}${distro}:${img_tag}
${PROXY}
@@ -268,7 +268,7 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
fi
# Create the Docker run script
@@ -402,31 +402,31 @@
mount_ssc_dir="-v ""${ssc_dir}"":""${ssc_dir}"" "
mount_workspace_dir="-v ""${WORKSPACE}"":""${WORKSPACE}"" "
if [[ "${obmc_dir}" = "${HOME}/"* || "${obmc_dir}" = "${HOME}" ]];then
-mount_obmc_dir=""
+ mount_obmc_dir=""
fi
if [[ "${ssc_dir}" = "${HOME}/"* || "${ssc_dir}" = "${HOME}" ]];then
-mount_ssc_dir=""
+ mount_ssc_dir=""
fi
if [[ "${WORKSPACE}" = "${HOME}/"* || "${WORKSPACE}" = "${HOME}" ]];then
-mount_workspace_dir=""
+ mount_workspace_dir=""
fi
# Run the Docker container, execute the build.sh script
# shellcheck disable=SC2086 # mount commands word-split purposefully
docker run \
---cap-add=sys_admin \
---cap-add=sys_nice \
---net=host \
---rm=true \
--e WORKSPACE="${WORKSPACE}" \
--w "${HOME}" \
--v "${HOME}:${HOME}" \
-${mount_obmc_dir} \
-${mount_ssc_dir} \
-${mount_workspace_dir} \
---cpus="$num_cpu" \
-"${img_name}" \
-"${WORKSPACE}/build.sh"
+ --cap-add=sys_admin \
+ --cap-add=sys_nice \
+ --net=host \
+ --rm=true \
+ -e WORKSPACE="${WORKSPACE}" \
+ -w "${HOME}" \
+ -v "${HOME}:${HOME}" \
+ ${mount_obmc_dir} \
+ ${mount_ssc_dir} \
+ ${mount_workspace_dir} \
+ --cpus="$num_cpu" \
+ "${img_name}" \
+ "${WORKSPACE}/build.sh"
# To maintain function of resources that used an older path, add a link
ln -sf "${xtrct_path}/deploy" "${WORKSPACE}/deploy"
diff --git a/docs-build.sh b/docs-build.sh
index b0f06f8..438c3d7 100755
--- a/docs-build.sh
+++ b/docs-build.sh
@@ -15,7 +15,7 @@
# Configure docker build
if [[ -n "${http_proxy}" ]]; then
-PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
Dockerfile=$(cat << EOF
@@ -42,8 +42,8 @@
# Build the docker container
if ! docker build -t linux-build/ubuntu - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -71,4 +71,4 @@
# Run the docker container, execute the build script we just built
docker run --cap-add=sys_admin --net=host --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${HOME}" -v "${HOME}":"${HOME}" -t linux-build/ubuntu "${WORKSPACE}/build.sh"
+ -w "${HOME}" -v "${HOME}":"${HOME}" -t linux-build/ubuntu "${WORKSPACE}/build.sh"
diff --git a/initramfs-build.sh b/initramfs-build.sh
index af9061e..2cc4c28 100755
--- a/initramfs-build.sh
+++ b/initramfs-build.sh
@@ -5,7 +5,7 @@
# Debug
if grep -q debug <<< "$@"; then
- set -x
+ set -x
fi
set -o errexit
set -o pipefail
@@ -17,8 +17,8 @@
ENDIANESS=${ENDIANESS:-le}
PROXY=""
-usage(){
- cat << EOF_USAGE
+function usage() {
+ cat << EOF_USAGE
Usage: $0 [options]
Options:
@@ -28,7 +28,7 @@
-e same as --endianess
EOF_USAGE
- exit 1
+ exit 1
}
# Arguments
@@ -36,25 +36,25 @@
eval set -- "${CMD_LINE}"
while true ; do
- case "${1}" in
- -e|--endianess)
- if [[ "${2,,}" == "be" ]]; then
- ENDIANESS=""
- fi
- shift 2
- ;;
- -d|--debug)
- set -x
- shift
- ;;
- --)
- shift
- break
- ;;
- *)
- usage
- ;;
- esac
+ case "${1}" in
+ -e|--endianess)
+ if [[ "${2,,}" == "be" ]]; then
+ ENDIANESS=""
+ fi
+ shift 2
+ ;;
+ -d|--debug)
+ set -x
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ usage
+ ;;
+ esac
done
# Timestamp for job
@@ -62,7 +62,7 @@
# Configure docker build
if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
Dockerfile=$(cat << EOF
@@ -97,8 +97,8 @@
# Build the docker container
if ! docker build -t initramfs-build/ubuntu - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -146,15 +146,15 @@
# Run the docker container, execute the build script we just built
docker run \
- --cap-add=sys_admin \
- --net=host \
- --rm=true \
- -e WORKSPACE="${WORKSPACE}" \
- --user="${USER}" \
- -w "${HOME}" \
- -v "${HOME}":"${HOME}" \
- -t initramfs-build/ubuntu \
- "${WORKSPACE}/build.sh"
+ --cap-add=sys_admin \
+ --net=host \
+ --rm=true \
+ -e WORKSPACE="${WORKSPACE}" \
+ --user="${USER}" \
+ -w "${HOME}" \
+ -v "${HOME}":"${HOME}" \
+ -t initramfs-build/ubuntu \
+ "${WORKSPACE}/build.sh"
# Timestamp for build
echo "Build completed, $(date)"
diff --git a/jenkins/userid-validation b/jenkins/userid-validation
index d68a8c5..331f507 100755
--- a/jenkins/userid-validation
+++ b/jenkins/userid-validation
@@ -14,9 +14,9 @@
GERRIT_COMMAND="curl -s --anyauth -n https://gerrit.openbmc.org"
GERRIT_SSH_CMD=( \
- ssh -o 'StrictHostKeyChecking no' -i "$SSH_KEY" \
- -p 29418 jenkins-openbmc-ci@gerrit.openbmc.org gerrit \
-)
+ ssh -o 'StrictHostKeyChecking no' -i "$SSH_KEY" \
+ -p 29418 jenkins-openbmc-ci@gerrit.openbmc.org gerrit \
+ )
echo "Checking ${GERRIT_PROJECT}:${GERRIT_BRANCH}:${GERRIT_CHANGE_ID}:${GERRIT_PATCHSET_REVISION}"
@@ -63,43 +63,43 @@
# Write full list of users to a file
GERRIT_CI_GROUPS=( \
- alibaba/ci-authorized \
- amd/ci-authorized \
- ami/ci-authorized \
- ampere/ci-authorized \
- arm/ci-authorized \
- aspeed/ci-authorized \
- bytedance/ci-authorized \
- code-construct/ci-authorized \
- depo/ci-authorized \
- erg/ci-authorized \
- facebook/ci-authorized \
- fii/ci-authorized \
- gager-in/ci-authorized \
- google/ci-authorized \
- hcl/ci-authorized \
- hpe/ci-authorized \
- ibm/ci-authorized \
- individual/ci-authorized \
- inspur/ci-authorized \
- intel/ci-authorized \
- inventec/ci-authorized \
- lenovo/ci-authorized \
- microsoft/ci-authorized \
- nineelements/ci-authorized \
- nuvoton/ci-authorized \
- nvidia/ci-authorized \
- openbmc/ci-authorized \
- pcpartner/ci-authorized \
- phytium/ci-authorized \
- quanta/ci-authorized \
- quic/ci-authorized \
- rcs/ci-authorized \
- supermicro/ci-authorized \
- wistron/ci-authorized \
- wiwynn/ci-authorized \
- yadro/ci-authorized \
-)
+ alibaba/ci-authorized \
+ amd/ci-authorized \
+ ami/ci-authorized \
+ ampere/ci-authorized \
+ arm/ci-authorized \
+ aspeed/ci-authorized \
+ bytedance/ci-authorized \
+ code-construct/ci-authorized \
+ depo/ci-authorized \
+ erg/ci-authorized \
+ facebook/ci-authorized \
+ fii/ci-authorized \
+ gager-in/ci-authorized \
+ google/ci-authorized \
+ hcl/ci-authorized \
+ hpe/ci-authorized \
+ ibm/ci-authorized \
+ individual/ci-authorized \
+ inspur/ci-authorized \
+ intel/ci-authorized \
+ inventec/ci-authorized \
+ lenovo/ci-authorized \
+ microsoft/ci-authorized \
+ nineelements/ci-authorized \
+ nuvoton/ci-authorized \
+ nvidia/ci-authorized \
+ openbmc/ci-authorized \
+ pcpartner/ci-authorized \
+ phytium/ci-authorized \
+ quanta/ci-authorized \
+ quic/ci-authorized \
+ rcs/ci-authorized \
+ supermicro/ci-authorized \
+ wistron/ci-authorized \
+ wiwynn/ci-authorized \
+ yadro/ci-authorized \
+ )
rm -f "$WORKSPACE/users.txt"
for g in "${GERRIT_CI_GROUPS[@]}"; do
diff --git a/kernel-build-setup.sh b/kernel-build-setup.sh
index 972f477..6b5d6f4 100755
--- a/kernel-build-setup.sh
+++ b/kernel-build-setup.sh
@@ -20,11 +20,11 @@
# Configure docker build
if [[ "${distro}" == fedora ]];then
- if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf"
- fi
+ if [[ -n "${http_proxy}" ]]; then
+ PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf"
+ fi
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM fedora:latest
${PROXY}
@@ -46,14 +46,14 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
elif [[ "${distro}" == ubuntu ]]; then
- if [[ -n "${http_proxy}" ]]; then
- PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
- fi
+ if [[ -n "${http_proxy}" ]]; then
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ fi
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ubuntu:latest
${PROXY}
@@ -77,13 +77,13 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
fi
# Build the docker container
if ! docker build -t "linux-aspeed/${distro}" - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -127,7 +127,7 @@
# Run the docker container, execute the build script we just built
docker run --cap-add=sys_admin --net=host --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${HOME}" -v "${HOME}":"${HOME}" -t linux-aspeed/"${distro}" "${WORKSPACE}"/build.sh
+ -w "${HOME}" -v "${HOME}":"${HOME}" -t linux-aspeed/"${distro}" "${WORKSPACE}"/build.sh
# Timestamp for build
echo "Build completed, $(date)"
diff --git a/kernel-build.sh b/kernel-build.sh
index 199075a..22348ea 100755
--- a/kernel-build.sh
+++ b/kernel-build.sh
@@ -15,7 +15,7 @@
# Configure docker build
if [[ -n "${http_proxy}" ]]; then
-PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
Dockerfile=$(cat << EOF
@@ -50,8 +50,8 @@
# Build the docker container
if ! docker build -t linux-build/ubuntu - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -99,7 +99,7 @@
# Run the docker container, execute the build script we just built
docker run --cap-add=sys_admin --net=host --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${WORKSPACE}" -v "${WORKSPACE}":"${WORKSPACE}" -t linux-build/ubuntu "${WORKSPACE}"/build.sh
+ -w "${WORKSPACE}" -v "${WORKSPACE}":"${WORKSPACE}" -t linux-build/ubuntu "${WORKSPACE}"/build.sh
result=${?}
diff --git a/openpower-build-setup.sh b/openpower-build-setup.sh
index 3d8bc73..1947ee7 100755
--- a/openpower-build-setup.sh
+++ b/openpower-build-setup.sh
@@ -20,8 +20,8 @@
# if there is no open-power directory clone in master into workspace
if [ ! -e "${WORKSPACE}"/op-build ]; then
- echo "Clone in openpower master to ${WORKSPACE}/op-build"
- git clone --recursive https://github.com/open-power/op-build "${WORKSPACE}"/op-build
+ echo "Clone in openpower master to ${WORKSPACE}/op-build"
+ git clone --recursive https://github.com/open-power/op-build "${WORKSPACE}"/op-build
fi
# Determine the architecture
@@ -47,7 +47,7 @@
# Configure docker build
if [[ "${distro}" == fedora ]];then
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ${DOCKER_BASE}fedora:latest
RUN dnf --refresh repolist && dnf install -y \
@@ -94,11 +94,11 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
elif [[ "${distro}" == ubuntu ]]; then
- Dockerfile=$(cat << EOF
+ Dockerfile=$(cat << EOF
FROM ${DOCKER_BASE}ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
@@ -137,13 +137,13 @@
ENV HOME ${HOME}
RUN /bin/bash
EOF
-)
+ )
fi
# Build the docker container
if ! docker build -t op-build/"${distro}" - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
mkdir -p "${WORKSPACE}"
@@ -174,7 +174,7 @@
# Run the docker container, execute the build script we just built
docker run --net=host --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${HOME}" -v "${HOME}":"${HOME}" -t op-build/"${distro}" "${WORKSPACE}"/build.sh
+ -w "${HOME}" -v "${HOME}":"${HOME}" -t op-build/"${distro}" "${WORKSPACE}"/build.sh
# Create link to images for archiving
ln -sf "${WORKSPACE}"/op-build/output/images "${WORKSPACE}"/images
diff --git a/qemu-build.sh b/qemu-build.sh
index 6a60abd..c5b2301 100755
--- a/qemu-build.sh
+++ b/qemu-build.sh
@@ -45,23 +45,23 @@
# Setup Proxy
if [[ -n "${http_proxy}" ]]; then
-PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
# Determine the prefix of the Dockerfile's base image
case ${ARCH} in
- "ppc64le")
- DOCKER_BASE="ppc64le/"
- ;;
- "x86_64")
- DOCKER_BASE=""
- ;;
- "aarch64")
- DOCKER_BASE="arm64v8/"
- ;;
- *)
- echo "Unsupported system architecture(${ARCH}) found for docker image"
- exit 1
+ "ppc64le")
+ DOCKER_BASE="ppc64le/"
+ ;;
+ "x86_64")
+ DOCKER_BASE=""
+ ;;
+ "aarch64")
+ DOCKER_BASE="arm64v8/"
+ ;;
+ *)
+ echo "Unsupported system architecture(${ARCH}) found for docker image"
+ exit 1
esac
# Create the docker run script
@@ -138,8 +138,8 @@
)
if ! docker build -t ${img_name} - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
docker run \
diff --git a/run-qemu-robot-test.sh b/run-qemu-robot-test.sh
index b704f9b..a400991 100755
--- a/run-qemu-robot-test.sh
+++ b/run-qemu-robot-test.sh
@@ -81,18 +81,18 @@
# Determine the prefix of the Dockerfile's base image and the QEMU_ARCH variable
case ${ARCH} in
- "ppc64le")
- QEMU_ARCH="ppc64le-linux"
- ;;
- "x86_64")
- QEMU_ARCH="x86_64-linux"
- ;;
- "aarch64")
- QEMU_ARCH="arm64-linux"
- ;;
- *)
- echo "Unsupported system architecture(${ARCH}) found for docker image"
- exit 1
+ "ppc64le")
+ QEMU_ARCH="ppc64le-linux"
+ ;;
+ "x86_64")
+ QEMU_ARCH="x86_64-linux"
+ ;;
+ "aarch64")
+ QEMU_ARCH="arm64-linux"
+ ;;
+ *)
+ echo "Unsupported system architecture(${ARCH}) found for docker image"
+ exit 1
esac
# Set the location of the qemu binary relative to UPSTREAM_WORKSPACE
@@ -112,84 +112,84 @@
if [[ ${LAUNCH} == "local" ]]; then
- # Start QEMU docker instance
- # root in docker required to open up the https/ssh ports
- obmc_qemu_docker=$(docker run --detach \
- --rm \
- --user root \
- --env HOME="${OBMC_BUILD_DIR}" \
- --env QEMU_RUN_TIMER="${QEMU_RUN_TIMER}" \
- --env QEMU_ARCH="${QEMU_ARCH}" \
- --env QEMU_BIN="${QEMU_BIN}" \
- --env MACHINE="${MACHINE}" \
- --env DEFAULT_IMAGE_LOC="${DEFAULT_IMAGE_LOC}" \
- --workdir "${OBMC_BUILD_DIR}" \
- --volume "${UPSTREAM_WORKSPACE}:${OBMC_BUILD_DIR}:ro" \
- --tty \
- "${DOCKER_IMG_NAME}" "${OBMC_BUILD_DIR}"/boot-qemu-test.exp)
+ # Start QEMU docker instance
+ # root in docker required to open up the https/ssh ports
+ obmc_qemu_docker=$(docker run --detach \
+ --rm \
+ --user root \
+ --env HOME="${OBMC_BUILD_DIR}" \
+ --env QEMU_RUN_TIMER="${QEMU_RUN_TIMER}" \
+ --env QEMU_ARCH="${QEMU_ARCH}" \
+ --env QEMU_BIN="${QEMU_BIN}" \
+ --env MACHINE="${MACHINE}" \
+ --env DEFAULT_IMAGE_LOC="${DEFAULT_IMAGE_LOC}" \
+ --workdir "${OBMC_BUILD_DIR}" \
+ --volume "${UPSTREAM_WORKSPACE}:${OBMC_BUILD_DIR}:ro" \
+ --tty \
+ "${DOCKER_IMG_NAME}" "${OBMC_BUILD_DIR}"/boot-qemu-test.exp)
- # We can use default ports because we're going to have the 2
- # docker instances talk over their private network
- DOCKER_SSH_PORT=22
- DOCKER_HTTPS_PORT=443
+ # We can use default ports because we're going to have the 2
+ # docker instances talk over their private network
+ DOCKER_SSH_PORT=22
+ DOCKER_HTTPS_PORT=443
- # This docker command intermittently asserts a SIGPIPE which
- # causes the whole script to fail. The IP address comes through
- # fine on these errors so just ignore the SIGPIPE
- trap '' PIPE
+ # This docker command intermittently asserts a SIGPIPE which
+ # causes the whole script to fail. The IP address comes through
+ # fine on these errors so just ignore the SIGPIPE
+ trap '' PIPE
- DOCKER_QEMU_IP_ADDR="$(docker inspect "$obmc_qemu_docker" | \
+ DOCKER_QEMU_IP_ADDR="$(docker inspect "$obmc_qemu_docker" | \
grep "IPAddress\":" | tail -n1 | cut -d '"' -f 4)"
- #Now wait for the OpenBMC QEMU Docker instance to get to standby
- delay=5
- attempt=$(( QEMU_LOGIN_TIMER / delay ))
- while [ $attempt -gt 0 ]; do
- attempt=$(( attempt - 1 ))
- echo "Waiting for qemu to get to standby (attempt: $attempt)..."
- result=$(docker logs "$obmc_qemu_docker")
- if grep -q 'OPENBMC-READY' <<< "$result" ; then
- echo "QEMU is ready!"
- # Give QEMU a few secs to stabilize
- sleep $delay
- break
+ #Now wait for the OpenBMC QEMU Docker instance to get to standby
+ delay=5
+ attempt=$(( QEMU_LOGIN_TIMER / delay ))
+ while [ $attempt -gt 0 ]; do
+ attempt=$(( attempt - 1 ))
+ echo "Waiting for qemu to get to standby (attempt: $attempt)..."
+ result=$(docker logs "$obmc_qemu_docker")
+ if grep -q 'OPENBMC-READY' <<< "$result" ; then
+ echo "QEMU is ready!"
+ # Give QEMU a few secs to stabilize
+ sleep $delay
+ break
+ fi
+ sleep $delay
+ done
+
+ if [ "$attempt" -eq 0 ]; then
+ echo "Timed out waiting for QEMU, exiting"
+ exit 1
fi
- sleep $delay
- done
- if [ "$attempt" -eq 0 ]; then
- echo "Timed out waiting for QEMU, exiting"
- exit 1
- fi
+ # Now run the Robot test (Tests commented out until they are working again)
- # Now run the Robot test (Tests commented out until they are working again)
+ # Timestamp for job
+ echo "Robot Test started, $(date)"
- # Timestamp for job
- echo "Robot Test started, $(date)"
+ mkdir -p "${WORKSPACE}"
+ cd "${WORKSPACE}"
- mkdir -p "${WORKSPACE}"
- cd "${WORKSPACE}"
+ # Copy in the script which will execute the Robot tests
+ cp "$DIR"/scripts/run-robot.sh "${WORKSPACE}"
- # Copy in the script which will execute the Robot tests
- cp "$DIR"/scripts/run-robot.sh "${WORKSPACE}"
+ # Run the Docker container to execute the Robot test cases
+ # The test results will be put in ${WORKSPACE}
+ docker run --rm \
+ --env HOME="${HOME}" \
+ --env IP_ADDR="${DOCKER_QEMU_IP_ADDR}" \
+ --env SSH_PORT="${DOCKER_SSH_PORT}" \
+ --env HTTPS_PORT="${DOCKER_HTTPS_PORT}" \
+ --env MACHINE="${MACHINE_QEMU}" \
+ --workdir "${HOME}" \
+ --volume "${WORKSPACE}":"${HOME}" \
+ --tty \
+ "${DOCKER_IMG_NAME}" "${HOME}"/run-robot.sh
- # Run the Docker container to execute the Robot test cases
- # The test results will be put in ${WORKSPACE}
- docker run --rm \
- --env HOME="${HOME}" \
- --env IP_ADDR="${DOCKER_QEMU_IP_ADDR}" \
- --env SSH_PORT="${DOCKER_SSH_PORT}" \
- --env HTTPS_PORT="${DOCKER_HTTPS_PORT}" \
- --env MACHINE="${MACHINE_QEMU}" \
- --workdir "${HOME}" \
- --volume "${WORKSPACE}":"${HOME}" \
- --tty \
- "${DOCKER_IMG_NAME}" "${HOME}"/run-robot.sh
-
- # Now stop the QEMU Docker image
- docker stop "$obmc_qemu_docker"
+ # Now stop the QEMU Docker image
+ docker stop "$obmc_qemu_docker"
else
- echo "LAUNCH variable invalid, Exiting"
- exit 1
+ echo "LAUNCH variable invalid, Exiting"
+ exit 1
fi
diff --git a/run-rootfs-size-docker.sh b/run-rootfs-size-docker.sh
index 6b34d07..254e0e3 100755
--- a/run-rootfs-size-docker.sh
+++ b/run-rootfs-size-docker.sh
@@ -54,7 +54,7 @@
# Copy rootfs_size.py script into workspace
cp "${WORKSPACE}"/${OBMC_TOOLS}/${ROOTFS_SIZE_PY_DIR}/${ROOTFS_SIZE_PY} \
-"${WORKSPACE}"/${ROOTFS_SIZE_PY}
+ "${WORKSPACE}"/${ROOTFS_SIZE_PY}
chmod a+x "${WORKSPACE}"/${ROOTFS_SIZE_PY}
# Configure docker build
diff --git a/scripts/boot-qemu.sh b/scripts/boot-qemu.sh
index fd52c9e..bea10dd 100755
--- a/scripts/boot-qemu.sh
+++ b/scripts/boot-qemu.sh
@@ -88,7 +88,7 @@
# Obtain IP from /etc/hosts if IP is not valid set to localhost
IP=$(awk 'END{print $1}' /etc/hosts)
if [[ "$IP" != *.*.*.* ]]; then
- IP=127.0.0.1
+ IP=127.0.0.1
fi
# Forward all needed ports for the robot test framework to run
diff --git a/scripts/build-qemu-robot-docker.sh b/scripts/build-qemu-robot-docker.sh
index ee4b61d..f985b5c 100755
--- a/scripts/build-qemu-robot-docker.sh
+++ b/scripts/build-qemu-robot-docker.sh
@@ -157,7 +157,7 @@
PROXY_ARGS=""
if [[ -n "${http_proxy}" ]]; then
- PROXY_ARGS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy}"
+ PROXY_ARGS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy}"
fi
# Build above image
diff --git a/scripts/clean-unit-test-docker b/scripts/clean-unit-test-docker
index 696dee6..6c8cd5a 100755
--- a/scripts/clean-unit-test-docker
+++ b/scripts/clean-unit-test-docker
@@ -9,6 +9,6 @@
# * ww is the two digit ISO week. (date format %V)
docker image ls \
- "openbmc/ubuntu-unit-test*" \
- --format "{{.Repository}}:{{.Tag}}" |
- grep -v "$(date '+%Y-W%V')" | xargs -r docker image rm || true
+ "openbmc/ubuntu-unit-test*" \
+ --format "{{.Repository}}:{{.Tag}}" |
+grep -v "$(date '+%Y-W%V')" | xargs -r docker image rm || true
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index c7bf16c..2dd5497 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -176,7 +176,7 @@
LINTER_REQUIRE+=([clang_format]="clang-format;.clang-format")
LINTER_IGNORE+=([clang_format]=".clang-ignore;.clang-format-ignore")
LINTER_TYPES+=([clang_format]="c;cpp")
-do_clang_format() {
+function do_clang_format() {
"${CLANG_FORMAT}" -i "$@"
}
diff --git a/scripts/run-robot.sh b/scripts/run-robot.sh
index fab7941..357608e 100755
--- a/scripts/run-robot.sh
+++ b/scripts/run-robot.sh
@@ -20,15 +20,15 @@
MACHINE=${MACHINE:-"qemu"}
ROBOT_CODE_HOME=${ROBOT_CODE_HOME:-/tmp/$(whoami)/${RANDOM}/obmc-robot/}
-ROBOT_TEST_CMD=${ROBOT_TEST_CMD:-"python3 -m robot\
+ROBOT_TEST_CMD="${ROBOT_TEST_CMD:-"python3 -m robot\
-v OPENBMC_HOST:${IP_ADDR}\
-v SSH_PORT:${SSH_PORT}\
-v HTTPS_PORT:${HTTPS_PORT}\
-v REDFISH_SUPPORT_TRANS_STATE:1\
- --argumentfile ./test_lists/QEMU_CI ./tests ./redfish ./ipmi"}
+ --argumentfile ./test_lists/QEMU_CI ./tests ./redfish ./ipmi"}"
git clone https://github.com/openbmc/openbmc-test-automation.git \
- "${ROBOT_CODE_HOME}"
+ "${ROBOT_CODE_HOME}"
cd "${ROBOT_CODE_HOME}" || exit
diff --git a/scripts/test-qemu b/scripts/test-qemu
index 7cdb180..813fd73 100755
--- a/scripts/test-qemu
+++ b/scripts/test-qemu
@@ -7,7 +7,7 @@
trap 'rm -rf ${ARTIFACT_DIR}' EXIT
-acquire() {
+function acquire() {
local target="$1"
wget --quiet --show-progress --directory-prefix="${ARTIFACT_DIR}" https://jenkins.openbmc.org/view/latest/job/latest-master/lastSuccessfulBuild/label=docker-builder,target="${target}"/artifact/openbmc/build/tmp/deploy/images/"${target}"/'*zip*'/"${target}".zip
unzip -qq -d "${ARTIFACT_DIR}" "${ARTIFACT_DIR}"/"${target}".zip
@@ -24,7 +24,7 @@
-drive file=${PALMETTO_MTD},if=mtd,format=raw \
-nographic \
-net nic \
- -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \
+ -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \
-c 'set timeout 300' \
-c 'expect timeout { exit 1 } "login:"' \
-c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \
@@ -40,7 +40,7 @@
-drive file=${WITHERSPOON_MTD},if=mtd,format=raw \
-nographic \
-net nic \
- -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \
+ -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \
-c 'set timeout 300' \
-c 'expect timeout { exit 1 } "login:"' \
-c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \
@@ -68,7 +68,7 @@
-drive file=${P10BMC_MMC},if=sd,format=raw,index=2 \
-net nic \
-net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \
- -nographic" \
+ -nographic" \
-c 'set timeout 300' \
-c 'expect timeout { exit 1 } "login:"' \
-c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \
diff --git a/test-distro.sh b/test-distro.sh
index 9bd1e95..394567b 100755
--- a/test-distro.sh
+++ b/test-distro.sh
@@ -3,35 +3,35 @@
set -eou pipefail
set -x
-util_ensure_available() {
- local bin=$1
- if ! which "${bin}"
- then
- echo "Please install ${bin}"
- return 1
- fi
- return 0
-}
-
-jenkins_get_job_config() {
- local host="$1"
- local job="$2"
- local config
- config="$(mktemp --suffix=.xml config.XXXXXX)"
- local url="https://${host}/job/${job}/config.xml"
- wget --output-document="${config}" "${url}"
- echo "${config}"
-}
-
-jenkins_get_job_repos() {
- local config="$1"
- if [ -n "${REPO}" ]
- then
- echo "${REPO}"
+function util_ensure_available() {
+ local bin=$1
+ if ! which "${bin}"
+ then
+ echo "Please install ${bin}"
+ return 1
+ fi
return 0
- fi
- # xmllint is rubbish, so we need sed(1) to separate the results
- xmllint --xpath '//com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject/pattern' "${config}" | sed -e 's/<pattern>//g' -e 's/<\/pattern>/\n/g'
+}
+
+function jenkins_get_job_config() {
+ local host="$1"
+ local job="$2"
+ local config
+ config="$(mktemp --suffix=.xml config.XXXXXX)"
+ local url="https://${host}/job/${job}/config.xml"
+ wget --output-document="${config}" "${url}"
+ echo "${config}"
+}
+
+function jenkins_get_job_repos() {
+ local config="$1"
+ if [ -n "${REPO}" ]
+ then
+ echo "${REPO}"
+ return 0
+ fi
+ # xmllint is rubbish, so we need sed(1) to separate the results
+ xmllint --xpath '//com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject/pattern' "${config}" | sed -e 's/<pattern>//g' -e 's/<\/pattern>/\n/g'
}
: "${JENKINS_HOST:=openpower.xyz}"
@@ -46,59 +46,59 @@
while [[ $# -gt 0 ]]
do
- key="$1"
- case "${key}" in
- -c|--config)
- CONFIG="$2"
- shift 2
- ;;
- -r|--repo|--repository)
- REPO="$2"
- shift 2
- ;;
- -h|--help)
- echo "USAGE: DISTRO=DOCKERBASE $0 --config config.xml"
- echo
- echo "DOCKERBASE is the Docker Hub tag of the base image against which to"
- echo "build and test the repositories described in config.xml. Individual"
- echo "repositories can be tested against DOCKERBASE with the --repository"
- echo "option \(in place of --config\)."
- exit 0
- ;;
- *)
- (>&2 echo Unrecognised argument \'"$1"\')
- shift
- ;;
- esac
+ key="$1"
+ case "${key}" in
+ -c|--config)
+ CONFIG="$2"
+ shift 2
+ ;;
+ -r|--repo|--repository)
+ REPO="$2"
+ shift 2
+ ;;
+ -h|--help)
+ echo "USAGE: DISTRO=DOCKERBASE $0 --config config.xml"
+ echo
+ echo "DOCKERBASE is the Docker Hub tag of the base image against which to"
+ echo "build and test the repositories described in config.xml. Individual"
+ echo "repositories can be tested against DOCKERBASE with the --repository"
+ echo "option \(in place of --config\)."
+ exit 0
+ ;;
+ *)
+ (>&2 echo Unrecognised argument \'"$1"\')
+ shift
+ ;;
+ esac
done
if [ -z "${CONFIG}" ]
then
- CONFIG="$(jenkins_get_job_config "${JENKINS_HOST}" "${JENKINS_JOB}")"
+ CONFIG="$(jenkins_get_job_config "${JENKINS_HOST}" "${JENKINS_JOB}")"
fi
export UNIT_TEST_PKG=
export WORKSPACE=
-git_clone_repo() {
- local prj_package="$1"
- local package
- package="$(basename "${prj_package}")"
- local workspace="$2"
- if [ -d "${prj_package}" ]
- then
- git clone "${prj_package}" "${workspace}"/"${package}"
- return
- fi
- git clone https://gerrit.openbmc.org/openbmc/"${package}" "${workspace}"/"${package}"
+function git_clone_repo() {
+ local prj_package="$1"
+ local package
+ package="$(basename "${prj_package}")"
+ local workspace="$2"
+ if [ -d "${prj_package}" ]
+ then
+ git clone "${prj_package}" "${workspace}"/"${package}"
+ return
+ fi
+ git clone https://gerrit.openbmc.org/openbmc/"${package}" "${workspace}"/"${package}"
}
jenkins_get_job_repos "${CONFIG}" | while read -r GERRIT_PROJECT
do
- UNIT_TEST_PKG=$(basename "${GERRIT_PROJECT}")
- WORKSPACE="$(mktemp -d --tmpdir openbmc-build-scripts.XXXXXX)"
- git clone . "${WORKSPACE}"/openbmc-build-scripts
- git_clone_repo "${GERRIT_PROJECT}" "${WORKSPACE}"
- ./run-unit-test-docker.sh
- rm -rf "${WORKSPACE}"
+ UNIT_TEST_PKG=$(basename "${GERRIT_PROJECT}")
+ WORKSPACE="$(mktemp -d --tmpdir openbmc-build-scripts.XXXXXX)"
+ git clone . "${WORKSPACE}"/openbmc-build-scripts
+ git_clone_repo "${GERRIT_PROJECT}" "${WORKSPACE}"
+ ./run-unit-test-docker.sh
+ rm -rf "${WORKSPACE}"
done
diff --git a/trace-kernel-build.sh b/trace-kernel-build.sh
index d0e3b44..63691e2 100755
--- a/trace-kernel-build.sh
+++ b/trace-kernel-build.sh
@@ -15,7 +15,7 @@
# Configure docker build
if [[ -n "${http_proxy}" ]]; then
-PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
Dockerfile=$(cat << EOF
@@ -50,8 +50,8 @@
# Build the docker container
if ! docker build -t trace-linux-build/ubuntu - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -100,8 +100,8 @@
# Run the docker container, execute the build script we just built
docker run --cap-add=sys_admin --net=host --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${WORKSPACE}" -v "${WORKSPACE}":"${WORKSPACE}" \
- -t trace-linux-build/ubuntu "${WORKSPACE}"/build.sh
+ -w "${WORKSPACE}" -v "${WORKSPACE}":"${WORKSPACE}" \
+ -t trace-linux-build/ubuntu "${WORKSPACE}"/build.sh
result=${?}
diff --git a/u-boot-build.sh b/u-boot-build.sh
index c1346f9..b8917a0 100755
--- a/u-boot-build.sh
+++ b/u-boot-build.sh
@@ -15,7 +15,7 @@
# Configure docker build
if [[ -n "${http_proxy}" ]]; then
-PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
+ PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
Dockerfile=$(cat << EOF
@@ -38,8 +38,8 @@
# Build the docker container
if ! docker build -t u-boot-build/ubuntu - <<< "${Dockerfile}" ; then
- echo "Failed to build docker container."
- exit 1
+ echo "Failed to build docker container."
+ exit 1
fi
# Create the docker run script
@@ -70,5 +70,5 @@
# Run the docker container, execute the build script we just built
docker run --rm=true -e WORKSPACE="${WORKSPACE}" --user="${USER}" \
- -w "${HOME}" -v "${HOME}":"${HOME}" -t u-boot-build/ubuntu \
- "${WORKSPACE}"/build.sh
+ -w "${HOME}" -v "${HOME}":"${HOME}" -t u-boot-build/ubuntu \
+ "${WORKSPACE}"/build.sh