Update Variable Naming Convention
Variables in qemu-build.sh, build-jenkins.sh, build-setup.sh,
and kubernetes-launch.sh updated to use the same convention across
different scripts.
Change-Id: Ice9ef2f47b0fbf125eadd235f63b79abafdc2dd7
Signed-off-by: Alanny Lopez <alannyglopez@gmail.com>
diff --git a/build-jenkins.sh b/build-jenkins.sh
index 9d41bc9..341f89a 100755
--- a/build-jenkins.sh
+++ b/build-jenkins.sh
@@ -33,7 +33,7 @@
# Default: "1000"
# j_home Directory used as the Jenkins Home in the container.
# Default: "/var/jenkins_home"
-# out_img The name given to the Docker image when it is built.
+# img_name The name given to the Docker image when it is built.
# Default: "openbmc/jenkins-master-${ARCH}:${JENKINS_VRSN}"
# tini_vrsn The version of Tini to use in the Dockerfile, 0.16.1 is
# the first release with ppc64le release support.
@@ -84,7 +84,7 @@
j_home=${j_home:-/var/jenkins_home}
http_port=${http_port:-8080}
agent_port=${agent_port:-50000}
-out_img=${out_img:-openbmc/jenkins-master-${ARCH}:${j_vrsn}}
+img_name=${img_name:-openbmc/jenkins-master-${ARCH}:${j_vrsn}}
# Save the Jenkins.war URL to a variable and SHA if we care about verification
j_url=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${j_vrsn}/jenkins-war-${j_vrsn}.war
@@ -199,7 +199,7 @@
################################################################################
# Build the image
-docker build -t ${out_img} .
+docker build -t ${img_name} .
if [[ ${launch} == "docker" ]]; then
@@ -215,22 +215,22 @@
# Ensure directories tht will be mounted are owned by the jenkins user
if [[ "$(id -u)" != 0 ]]; then
echo "Not running as root:"
- echo "Checking if jgid and juid are the owners of mounted directories"
- test1=$(ls -nd ${home_mnt} | awk '{print $3 " " $4}')
- if [[ "${test1}" != "${j_uid} ${j_gid}" ]]; then
+ echo "Checking if j_gid and j_uid are the owners of mounted directories"
+ 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 "${test1} != ${j_uid} ${j_gid}"
- willfail=1
+ echo "${test_1} != ${j_uid} ${j_gid}"
+ will_fail=1
fi
if [[ ! -z "${host_import_mnt}" ]]; then
- test2=$(ls -nd ${host_import_mnt} | awk '{print $3 " " $4}' )
- if [[ "${test2}" != "${j_uid} ${j_gid}" ]]; then
+ 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 "${test2} != ${j_uid} ${j_gid}"
- willfail=1
+ echo "${test_2} != ${j_uid} ${j_gid}"
+ will_fail=1
fi
fi
- if [[ "${willfail}" == 1 ]]; then
+ 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
@@ -244,17 +244,17 @@
#If we don't have import mount don't add to docker command
if [[ ! -z ${host_import_mnt} ]]; then
- importvolcmd="-v ${host_import_mnt}:${cont_import_mnt}"
+ import_vol_cmd="-v ${host_import_mnt}:${cont_import_mnt}"
fi
# Launch the jenkins image with Docker
docker run -d \
- ${importvolcmd} \
+ ${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}\" \
- ${out_img}
+ ${img_name}
elif [[ ${launch} == "k8s" ]]; then
# launch using the k8s template
diff --git a/build-setup.sh b/build-setup.sh
index 6ec337c..30e1c42 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -16,18 +16,18 @@
# Default: "~/{RandomNumber}"
#
# Docker Image Build Variables:
-# BITBAKE_OPTS Set to "-c populate_sdk" or whatever other bitbake options
+# BITBAKE_OPTS Set to "-c populate_sdk" or whatever other BitBake options
# you'd like to pass into the build.
# Default: "", no options set
-# builddir Path where the actual bitbake build occurs in inside the
+# build_dir Path where the actual BitBake build occurs inside the
# container, path cannot be located on network storage.
# Default: "/tmp/openbmc"
# distro The distro used as the base image for the build image:
# fedora|ubuntu
# Default: "ubuntu"
-# imgname The name given to the target build's docker image.
+# img_name The name given to the target build's docker image.
# Default: "openbmc/${distro}:${imgtag}-${target}-${ARCH}"
-# imgtag The base docker image distro tag:
+# img_tag The base docker image distro tag:
# ubuntu: latest|16.04|14.04|trusty|xenial
# fedora: 23|24|25
# Default: "latest"
@@ -37,9 +37,6 @@
# Default: "qemu"
#
# Deployment Variables:
-# extraction Path where the ombcdir contents will be copied out to when
-# the build completes.
-# Default: "${obmcext}/build/tmp"
# launch ""|job|pod
# Can be left blank to launch the container via Docker
# Job lets you keep a copy of job and container logs on the
@@ -47,11 +44,14 @@
# job again via the api without needing this script.
# Pod launches a container which runs to completion without
# saving anything to the api when it completes.
-# obmcext Path of the OpenBMC repo directory used as a reference
+# obmc_dir Path of the OpenBMC repo directory used as a reference
# for the build inside the container.
# Default: "${WORKSPACE}/openbmc"
-# sscdir Path to use as the BitBake shared-state cache directory.
+# ssc_dir Path to use as the BitBake shared-state cache directory.
# Default: "/home/${USER}"
+# xtrct_path Path where the build_dir contents will be copied out to
+# when the build completes.
+# Default: "${obmc_dir}/build/tmp"
#
###############################################################################
build_scripts_dir=${build_scripts_dir:-"$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"}
@@ -62,12 +62,12 @@
# Default variables
target=${target:-qemu}
distro=${distro:-ubuntu}
-imgtag=${imgtag:-latest}
-builddir=${builddir:-/tmp/openbmc}
-sscdir=${sscdir:-${HOME}}
+img_tag=${img_tag:-latest}
+build_dir=${build_dir:-/tmp/openbmc}
+ssc_dir=${ssc_dir:-${HOME}}
WORKSPACE=${WORKSPACE:-${HOME}/${RANDOM}${RANDOM}}
-obmcext=${obmcext:-${WORKSPACE}/openbmc}
-extraction=${extraction:-${obmcext}/build/tmp}
+obmc_dir=${obmc_dir:-${WORKSPACE}/openbmc}
+xtrct_path=${xtrct_path:-${obmc_dir}/build/tmp}
launch=${launch:-}
http_proxy=${http_proxy:-}
PROXY=""
@@ -91,17 +91,17 @@
# Timestamp for job
echo "Build started, $(date)"
-# If the obmcext directory doesn't exist clone it in
-if [ ! -d ${obmcext} ]; then
- echo "Clone in openbmc master to ${obmcext}"
- git clone https://github.com/openbmc/openbmc ${obmcext}
+# 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}
fi
-# Make and chown the extraction directory to avoid permission errors
-if [ ! -d ${extraction} ]; then
- mkdir -p ${extraction}
+# Make and chown the xtrct_path directory to avoid permission errors
+if [ ! -d ${xtrct_path} ]; then
+ mkdir -p ${xtrct_path}
fi
-chown ${UID}:${GROUPS} ${extraction}
+chown ${UID}:${GROUPS} ${xtrct_path}
# Work out what build target we should be running and set BitBake command
case ${target} in
@@ -145,7 +145,7 @@
fi
Dockerfile=$(cat << EOF
- FROM ${DOCKER_BASE}${distro}:${imgtag}
+ FROM ${DOCKER_BASE}${distro}:${img_tag}
${PROXY}
@@ -196,7 +196,7 @@
fi
Dockerfile=$(cat << EOF
- FROM ${DOCKER_BASE}${distro}:${imgtag}
+ FROM ${DOCKER_BASE}${distro}:${img_tag}
${PROXY}
@@ -251,7 +251,7 @@
set -xeo pipefail
# Go into the OpenBMC directory, the build will handle changing directories
-cd ${obmcext}
+cd ${obmc_dir}
# Set up proxies
export ftp_proxy=${http_proxy}
@@ -293,39 +293,39 @@
PARALLEL_MAKE = "-j$(nproc)"
INHERIT += "rm_work"
BB_GENERATE_MIRROR_TARBALLS = "1"
-DL_DIR="${sscdir}/bitbake_downloads"
-SSTATE_DIR="${sscdir}/bitbake_sharedstatecache"
+DL_DIR="${ssc_dir}/bitbake_downloads"
+SSTATE_DIR="${ssc_dir}/bitbake_sharedstatecache"
USER_CLASSES += "buildstats"
INHERIT_remove = "uninative"
-TMPDIR="${builddir}"
+TMPDIR="${build_dir}"
EOF_CONF
# Kick off a build
bitbake ${BITBAKE_OPTS} obmc-phosphor-image
-# Copy build directory of internal obmcdir into workspace directory
-cp -r ${builddir}/* ${extraction}
+# Copy internal build directory into xtrct_path directory
+cp -r ${build_dir}/* ${xtrct_path}
EOF_SCRIPT
chmod a+x ${WORKSPACE}/build.sh
# Give the Docker image a name based on the distro,tag,arch,and target
-imgname=${imgname:-openbmc/${distro}:${imgtag}-${target}-${ARCH}}
+img_name=${img_name:-openbmc/${distro}:${img_tag}-${target}-${ARCH}}
# Build the Docker image
-docker build -t ${imgname} - <<< "${Dockerfile}"
+docker build -t ${img_name} - <<< "${Dockerfile}"
# Determine if the build container will be launched with Docker or Kubernetes
if [[ "${launch}" == "" ]]; then
- # If obmcext or sscdir are ${HOME} or a subdirectory they will not be mounted
- mountobmcext="-v ""${obmcext}"":""${obmcext}"" "
- mountsscdir="-v ""${sscdir}"":""${sscdir}"" "
- if [[ "${obmcext}" = "${HOME}/"* || "${obmcext}" = "${HOME}" ]];then
- mountobmcext=""
+ # If obmc_dir or ssc_dir are ${HOME} or a subdirectory they will not be mounted
+ mount_obmc_dir="-v ""${obmc_dir}"":""${obmc_dir}"" "
+ mount_ssc_dir="-v ""${ssc_dir}"":""${ssc_dir}"" "
+ if [[ "${obmc_dir}" = "${HOME}/"* || "${obmc_dir}" = "${HOME}" ]];then
+ mount_obmc_dir=""
fi
- if [[ "${sscdir}" = "${HOME}/"* || "${sscdir}" = "${HOME}" ]];then
- mountsscdir=""
+ if [[ "${ssc_dir}" = "${HOME}/"* || "${ssc_dir}" = "${HOME}" ]];then
+ mount_ssc_dir=""
fi
# Run the Docker container, execute the build.sh script
@@ -336,9 +336,9 @@
-e WORKSPACE=${WORKSPACE} \
-w "${HOME}" \
-v "${HOME}":"${HOME}" \
- ${mountobmcext} \
- ${mountsscdir} \
- -t ${imgname} \
+ ${mount_obmc_dir} \
+ ${mount_ssc_dir} \
+ -t ${img_name} \
${WORKSPACE}/build.sh
elif [[ "${launch}" == "job" || "${launch}" == "pod" ]]; then
@@ -351,7 +351,7 @@
fi
# To maintain function of resources that used an older path, add a link
-ln -sf ${extraction}/deploy ${WORKSPACE}/deploy
+ln -sf ${xtrct_path}/deploy ${WORKSPACE}/deploy
# Timestamp for build
echo "Build completed, $(date)"
diff --git a/kubernetes/Templates/OpenBMC-build-job-v2.yaml b/kubernetes/Templates/OpenBMC-build-job-v2.yaml
index f379bff..a6719c7 100644
--- a/kubernetes/Templates/OpenBMC-build-job-v2.yaml
+++ b/kubernetes/Templates/OpenBMC-build-job-v2.yaml
@@ -9,7 +9,7 @@
spec:
template:
metadata:
- name: ${podname}
+ name: ${pod_name}
labels:
target: ${target}
spec:
@@ -18,14 +18,14 @@
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: sscdir
+ claimName: ${w_claim}
+ - name: ssc-dir
persistentVolumeClaim:
- claimName: ${sclaim}
+ claimName: ${s_claim}
restartPolicy: Never
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: ["/bin/bash","-c"]
args: ["sleep 2h"]
@@ -33,8 +33,8 @@
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: builddir
- value: ${builddir}
+ - name: build-dir
+ value: ${build_dir}
securityContext:
capabilities:
add:
@@ -42,7 +42,7 @@
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: sscdir
- mountPath: ${sscdir}
+ - name: ssc-dir
+ mountPath: ${ssc_dir}
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-job.yaml b/kubernetes/Templates/OpenBMC-build-job.yaml
index c035193..7f9c017 100644
--- a/kubernetes/Templates/OpenBMC-build-job.yaml
+++ b/kubernetes/Templates/OpenBMC-build-job.yaml
@@ -9,7 +9,7 @@
spec:
template:
metadata:
- name: ${podname}
+ name: ${pod_name}
labels:
target: ${target}
spec:
@@ -18,22 +18,22 @@
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: sscdir
+ claimName: ${w_claim}
+ - name: ssc-dir
persistentVolumeClaim:
- claimName: ${sclaim}
+ claimName: ${s_claim}
restartPolicy: Never
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: [\"${WORKSPACE}/build.sh\"]
workingDir: ${HOME}
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: builddir
- value: ${builddir}
+ - name: build-dir
+ value: ${build_dir}
securityContext:
capabilities:
add:
@@ -41,7 +41,7 @@
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: sscdir
- mountPath: ${sscdir}
+ - name: ssc-dir
+ mountPath: ${ssc_dir}
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-pod-v2.yaml b/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
index 75adac8..11c4419 100644
--- a/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
+++ b/kubernetes/Templates/OpenBMC-build-pod-v2.yaml
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
- name: ${podname}
+ name: ${pod_name}
namespace: ${namespace}
spec:
nodeSelector:
@@ -9,13 +9,13 @@
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: sscdir
+ claimName: ${w_claim}
+ - name: ssc-dir
persistentVolumeClaim:
- claimName: ${sclaim}
+ claimName: ${s_claim}
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: ["/bin/bash","-c"]
args: ["sleep 2h"]
@@ -23,8 +23,8 @@
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: builddir
- value: ${builddir}
+ - name: build-dir
+ value: ${build_dir}
securityContext:
capabilities:
add:
@@ -32,8 +32,8 @@
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: sscdir
- mountPath: ${sscdir}
+ - name: ssc-dir
+ mountPath: ${ssc_dir}
restartPolicy: Never
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/OpenBMC-build-pod.yaml b/kubernetes/Templates/OpenBMC-build-pod.yaml
index 4eb76da..a383367 100644
--- a/kubernetes/Templates/OpenBMC-build-pod.yaml
+++ b/kubernetes/Templates/OpenBMC-build-pod.yaml
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
- name: ${podname}
+ name: ${pod_name}
namespace: ${namespace}
spec:
nodeSelector:
@@ -9,21 +9,21 @@
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: sscdir
+ claimName: ${w_claim}
+ - name: ssc-dir
persistentVolumeClaim:
- claimName: ${sclaim}
+ claimName: ${s_claim}
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: [\"${WORKSPACE}/build.sh\"]
workingDir: ${HOME}
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: builddir
- value: ${builddir}
+ - name: build-dir
+ value: ${build_dir}
securityContext:
capabilities:
add:
@@ -31,8 +31,8 @@
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: sscdir
- mountPath: ${sscdir}
+ - name: ssc-dir
+ mountPath: ${ssc_dir}
restartPolicy: Never
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-build-job.yaml b/kubernetes/Templates/QEMU-build-job.yaml
index 04a8c4e..1fe635f 100644
--- a/kubernetes/Templates/QEMU-build-job.yaml
+++ b/kubernetes/Templates/QEMU-build-job.yaml
@@ -9,33 +9,33 @@
spec:
template:
metadata:
- name: ${podname}
+ name: ${pod_name}
spec:
nodeSelector:
beta.kubernetes.io/arch: ${ARCH}
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: qemudir
+ claimName: ${w_claim}
+ - name: qemu-dir
persistentVolumeClaim:
- claimName: ${qclaim}
+ claimName: ${q_claim}
restartPolicy: Never
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: [\"${WORKSPACE}/build.sh\"]
workingDir: ${HOME}
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: qemudir
- value: ${qemudir}
+ - name: qemu-dir
+ value: ${qemu_dir}
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: qemudir
- mountPath: ${qemudir}
+ - name: qemu-dir
+ mountPath: ${qemu_dir}
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-build-pod.yaml b/kubernetes/Templates/QEMU-build-pod.yaml
index 3a23af7..eb3088d 100644
--- a/kubernetes/Templates/QEMU-build-pod.yaml
+++ b/kubernetes/Templates/QEMU-build-pod.yaml
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
- name: ${podname}
+ name: ${pod_name}
namespace: ${namespace}
spec:
nodeSelector:
@@ -9,26 +9,26 @@
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
- - name: qemudir
+ claimName: ${w_claim}
+ - name: qemu-dir
persistentVolumeClaim:
- claimName: ${qclaim}
+ claimName: ${q_claim}
restartPolicy: Never
hostNetwork: True
containers:
- - image: ${imgname}
+ - image: ${img_name}
name: builder
command: [\"${WORKSPACE}/build.sh\"]
workingDir: ${HOME}
env:
- name: WORKSPACE
value: ${WORKSPACE}
- - name: qemudir
- value: ${qemudir}
+ - name: qemu-dir
+ value: ${qemu_dir}
volumeMounts:
- name: workspace
mountPath: ${HOME}/workspace
- - name: qemudir
- mountPath: ${qemudir}
+ - name: qemu-dir
+ mountPath: ${qemu_dir}
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/Templates/QEMU-launch-deployment.yaml b/kubernetes/Templates/QEMU-launch-deployment.yaml
index c17df73..c8bdc9f 100644
--- a/kubernetes/Templates/QEMU-launch-deployment.yaml
+++ b/kubernetes/Templates/QEMU-launch-deployment.yaml
@@ -1,29 +1,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
- name: ${deployname}
+ name: ${deploy_name}
namespace: ${namespace}
spec:
replicas: ${replicas}
selector:
matchLabels:
- app: ${deployname}
+ app: ${deploy_name}
template:
metadata:
labels:
- app: ${deployname}
+ app: ${deploy_name}
spec:
volumes:
- name: workspace
persistentVolumeClaim:
- claimName: ${wclaim}
+ claimName: ${w_claim}
nodeSelector:
beta.kubernetes.io/arch: ${ARCH}
securityContext:
runAsUser: 0
containers:
- - image: ${imgname}
- name: ${podname}
+ - image: ${img_name}
+ name: ${pod_name}
command: [\"${OBMC_BUILD_DIR}/boot-qemu.sh\"]
tty: true
workingDir: ${OBMC_BUILD_DIR}
@@ -59,4 +59,4 @@
subPath: ${jenkins_subpath}
mountPath: ${OBMC_BUILD_DIR}
imagePullSecrets:
- - name: ${imgplsec}
+ - name: ${img_pl_sec}
diff --git a/kubernetes/kubernetes-launch.sh b/kubernetes/kubernetes-launch.sh
index 3917a92..fd8e95c 100755
--- a/kubernetes/kubernetes-launch.sh
+++ b/kubernetes/kubernetes-launch.sh
@@ -24,28 +24,28 @@
# Default: The parent directory containing this script
#
# Kubernetes Variables:
-# imgplsec The image pull secret used to access registry if needed
+# img_pl_sec The image pull secret used to access registry if needed
# Default: "regkey"
-# imgrepo The registry to use to pull and push images
+# registry The registry to use to pull and push images
# Default: "master.cfc:8500/openbmc/""
-# jobtimeout The amount of time in seconds that the build will wait for
+# job_timeout The amount of time in seconds that the build will wait for
# the job to be created in the api of the cluster.
# Default: "60"
# namespace The namespace to be used within the Kubernetes cluster
# Default: "openbmc"
-# podtimeout The amount of time in seconds that the build will wait for
+# pod_timeout The amount of time in seconds that the build will wait for
# the pod to start running on the cluster.
# Default: "600"
#
# YAML File Variables (No Defaults):
-# imgname The name the image that will be passed to the kubernetes
+# img_name The name the image that will be passed to the kubernetes
# api to build the containers. The image with the tag
-# imgname will be built in the invoker script. This script
+# img_name will be built in the invoker script. This script
# will then tag it to include the registry in the name, push
-# it, and update the imgname to be what was pushed to the
+# it, and update the img_name to be what was pushed to the
# registry. Users should not include the registry in the
-# original imgname.
-# podname The name of the pod, needed to trace down the logs.
+# original img_name.
+# pod_name The name of the pod, needed to trace down the logs.
#
# Deployment Option Variables (No Defaults):
# invoker Name of what this script is being called by or for, used
@@ -71,10 +71,10 @@
# Kubernetes Variables
namespace=${namespace:-openbmc}
-imgrepo=${imgrepo:-master.cfc:8500/openbmc/}
-imgplsec=${imgplsec:-regkey}
-jobtimeout=${jobtimeout:-60}
-podtimeout=${podtimeout:-600}
+registry=${registry:-master.cfc:8500/openbmc/}
+img_pl_sec=${img_pl_sec:-regkey}
+job_timeout=${job_timeout:-60}
+pod_timeout=${pod_timeout:-600}
# Options which decide script behavior
invoker=${invoker:-${1}}
@@ -87,25 +87,25 @@
# Other variables in the template not declared here are declared by invoker
case ${invoker} in
OpenBMC-build)
- wclaim=${wclaim:-jenkins-slave-space}
- sclaim=${sclaim:-shared-state-cache}
- oclaim=${oclaim:-openbmc-reference-repo}
- newimgname=${newimgname:-${imgrepo}${distro}:${imgtag}-${ARCH}}
- podname=${podname:-openbmc${BUILD_ID}-${target}-builder}
+ w_claim=${w_claim:-jenkins-slave-space}
+ s_claim=${s_claim:-shared-state-cache}
+ o_claim=${o_claim:-openbmc-reference-repo}
+ new_img_name=${new_img_name:-${registry}${distro}:${img_tag}-${ARCH}}
+ pod_name=${pod_name:-openbmc${BUILD_ID}-${target}-builder}
;;
QEMU-build)
- podname=${podname:-qemubuild${BUILD_ID}}
- wclaim=${wclaim:-jenkins-slave-space}
- qclaim=${qclaim:-qemu-repo}
- newimgname="${imgrepo}${imgname}"
+ pod_name=${pod_name:-qemubuild${BUILD_ID}}
+ w_claim=${w_claim:-jenkins-slave-space}
+ q_claim=${q_claim:-qemu-repo}
+ new_img_name="${registry}${img_name}"
;;
QEMU-launch)
- deployname=${deployname:-qemu-launch-deployment}
- podname=${podname:-qemu-instance}
+ deploy_name=${deploy_name:-qemu-launch-deployment}
+ pod_name=${pod_name:-qemu-instance}
replicas=${replicas:-5}
- wclaim=${wclaim:-jenkins-slave-space}
+ w_claim=${w_claim:-jenkins-slave-space}
jenkins_subpath=${jenkins_subpath:-Openbmc-Build/openbmc/build}
- newimgname="${imgrepo}qemu-instance"
+ new_img_name="${registry}qemu-instance"
;;
XCAT-launch)
;;
@@ -116,12 +116,12 @@
;;
esac
-# Tag the image created by the invoker with a name that includes the imgrepo
-docker tag ${imgname} ${newimgname}
-imgname=${newimgname}
+# Tag the image created by the invoker with a name that includes the registry
+docker tag ${img_name} ${new_img_name}
+img_name=${new_img_name}
# Push the image that was built to the image repository
-docker push ${imgname}
+docker push ${img_name}
if [[ "$ARCH" == x86_64 ]]; then
ARCH=amd64
@@ -132,53 +132,53 @@
extras+="-v2"
fi
-yamlfile=$(eval "echo \"$(<${build_scripts_dir}/kubernetes/Templates/${invoker}-${launch}${extras}.yaml)\"")
-kubectl create -f - <<< "${yamlfile}"
+yaml_file=$(eval "echo \"$(<${build_scripts_dir}/kubernetes/Templates/${invoker}-${launch}${extras}.yaml)\"")
+kubectl create -f - <<< "${yaml_file}"
-# If launch is a job we have to find the podname with identifiers
+# If launch is a job we have to find the pod_name with identifiers
if [[ "${launch}" == "job" ]]; then
while [ -z ${replace} ]
do
- if [ ${jobtimeout} -lt 0 ]; then
- kubectl delete -f - <<< "${yamlfile}"
+ if [ ${job_timeout} -lt 0 ]; then
+ kubectl delete -f - <<< "${yaml_file}"
echo "Timeout occurred before job was present in the API"
exit 1
else
sleep 1
- let jobtimeout-=1
+ let job_timeout-=1
fi
- replace=$(kubectl get pods -n ${namespaces} | grep ${podname} | awk 'print $1')
+ replace=$(kubectl get pods -n ${namespaces} | grep ${pod_name} | awk 'print $1')
done
- podname=${replace}
+ pod_name=${replace}
fi
# Once pod is running track logs
if [[ "${log}" == true ]]; then
# Wait for Pod to be running
- checkstatus="kubectl describe pod ${podname} -n ${namespace}"
- status=$( ${checkstatus} | grep Status: )
+ check_status="kubectl describe pod ${pod_name} -n ${namespace}"
+ status=$( ${check_status} | grep Status: )
while [ -z "$( echo ${status} | grep Running)" ]
do
- if [ ${podtimeout} -lt 0 ]; then
- kubectl delete -f - <<< "${yamlfile}"
+ if [ ${pod_timeout} -lt 0 ]; then
+ kubectl delete -f - <<< "${yaml_file}"
echo "Timeout occurred before pod was Running"
exit 1
else
sleep 1
- let podtimeout-=1
+ let pod_timeout-=1
fi
- status=$( ${checkstatus} | grep Status: )
+ status=$( ${check_status} | grep Status: )
done
# Tail the logs of the pod, if workaround enabled start executing build script instead.
if [[ "${workaround}" == "true" ]]; then
- kubectl exec -it ${podname} -n ${namespace} ${WORKSPACE}/build.sh
+ kubectl exec -it ${pod_name} -n ${namespace} ${WORKSPACE}/build.sh
else
- kubectl logs -f ${podname} -n ${namespace}
+ kubectl logs -f ${pod_name} -n ${namespace}
fi
fi
# Delete the object if purge is true
if [[ "${purge}" == true ]]; then
- kubectl delete -f - <<< "${yamlfile}"
+ kubectl delete -f - <<< "${yaml_file}"
fi
diff --git a/qemu-build.sh b/qemu-build.sh
index ea61393..9377617 100755
--- a/qemu-build.sh
+++ b/qemu-build.sh
@@ -11,7 +11,7 @@
# Default: The directory containing this script
# http_proxy The HTTP address of the proxy server to connect to.
# Default: "", proxy is not setup if this is not set
-# qemudir Path of the directory that holds the QEMU repo, if none
+# qemu_dir Path of the directory that holds the QEMU repo, if none
# exists will clone in the OpenBMC/QEMU repo to WORKSPACE.
# Default: "${WORKSPACE}/qemu"
# WORKSPACE Path of the workspace directory where some intermediate
@@ -19,11 +19,11 @@
# Default: "~/{RandomNumber}"
#
# Docker Image Build Variables:
-# builddir Path of the directory that is created within the docker
+# build_dir Path of the directory that is created within the docker
# container where the build is actually done. Done this way
-# to allow NFS volumes to be used as the qemudir.
+# to allow NFS volumes to be used as the qemu_dir.
# Default: "/tmp/qemu"
-# imgname Defaults to qemu-build with the arch as its tag, can be
+# img_name Defaults to qemu-build with the arch as its tag, can be
# changed or passed to give a specific name to created image
#
# Deployment Variables:
@@ -46,10 +46,10 @@
WORKSPACE=${WORKSPACE:-${HOME}/${RANDOM}${RANDOM}}
http_proxy=${http_proxy:-}
launch=${launch:-}
-qemudir=${qemudir:-${WORKSPACE}/qemu}
-builddir=${builddir:-/tmp/qemu}
+qemu_dir=${qemu_dir:-${WORKSPACE}/qemu}
+build_dir=${build_dir:-/tmp/qemu}
ARCH=$(uname -m)
-imgname=${imgname:-qemu-build:${ARCH}}
+img_name=${img_name:-qemu-build:${ARCH}}
# Timestamp for job
echo "Build started, $(date)"
@@ -73,9 +73,9 @@
esac
# If there is no qemu directory, git clone in the openbmc mirror
-if [ ! -d ${qemudir} ]; then
- echo "Clone in openbmc master to ${qemudir}"
- git clone https://github.com/openbmc/qemu ${qemudir}
+if [ ! -d ${qemu_dir} ]; then
+ echo "Clone in openbmc master to ${qemu_dir}"
+ git clone https://github.com/openbmc/qemu ${qemu_dir}
fi
# Create the docker run script
@@ -91,10 +91,10 @@
set -x
# create a copy of the qemudir in /qemu to use as the build directory
-cp -a ${qemudir}/. ${builddir}
+cp -a ${qemu_dir}/. ${build_dir}
# Go into the build directory
-cd ${builddir}
+cd ${build_dir}
gcc --version
git submodule update --init dtc
@@ -114,7 +114,7 @@
--disable-vnc-png
make -j4
-cp -a ${builddir}/arm-softmmu/. ${WORKSPACE}/arm-softmmu/
+cp -a ${build_dir}/arm-softmmu/. ${WORKSPACE}/arm-softmmu/
EOF_SCRIPT
chmod a+x ${WORKSPACE}/build.sh
@@ -143,12 +143,12 @@
RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER}
RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} ${USER}
USER ${USER}
-RUN mkdir ${builddir}
+RUN mkdir ${build_dir}
ENV HOME ${HOME}
EOF
)
-docker build -t ${imgname} - <<< "${Dockerfile}"
+docker build -t ${img_name} - <<< "${Dockerfile}"
# If Launch is left empty will create a docker container
if [[ "${launch}" == "" ]]; then
@@ -156,17 +156,17 @@
echo "Failed to build docker container."
exit 1
fi
- mountqemu="-v ""${qemudir}"":""${qemudir}"" "
- if [[ "${qemudir}" = "${HOME}/"* || "${qemudir}" = "${HOME}" ]]; then
- mountqemu=""
+ mount_qemu="-v ""${qemu_dir}"":""${qemu_dir}"" "
+ if [[ "${qemu_dir}" = "${HOME}/"* || "${qemu_dir}" = "${HOME}" ]]; then
+ mount_qemu=""
fi
docker run \
--rm=true \
-e WORKSPACE=${WORKSPACE} \
-w "${HOME}" \
-v "${HOME}":"${HOME}" \
- ${mountqemu} \
- -t ${imgname} \
+ ${mount_qemu} \
+ -t ${img_name} \
${WORKSPACE}/build.sh
elif [[ "${launch}" == "pod" || "${launch}" == "job" ]]; then
. ${build_scripts_dir}/kubernetes/kubernetes-launch.sh QEMU-build true true