diff options
Diffstat (limited to 'resources/libraries/bash')
-rw-r--r-- | resources/libraries/bash/entry/check/pylint.sh | 3 | ||||
-rw-r--r-- | resources/libraries/bash/function/artifacts.sh | 26 | ||||
-rw-r--r-- | resources/libraries/bash/function/common.sh | 3 | ||||
-rw-r--r-- | resources/libraries/bash/function/dpdk.sh | 12 | ||||
-rw-r--r-- | resources/libraries/bash/function/gather.sh | 7 | ||||
-rw-r--r-- | resources/libraries/bash/function/per_patch.sh | 2 | ||||
-rw-r--r-- | resources/libraries/bash/shell/k8s_utils.sh | 17 |
7 files changed, 43 insertions, 27 deletions
diff --git a/resources/libraries/bash/entry/check/pylint.sh b/resources/libraries/bash/entry/check/pylint.sh index 18e7d3db72..fbfea4773e 100644 --- a/resources/libraries/bash/entry/check/pylint.sh +++ b/resources/libraries/bash/entry/check/pylint.sh @@ -19,7 +19,8 @@ set -exuo pipefail # to dissuade non-tox callers. # This script runs pylint and propagates its exit code. -# Config is taken from pylint.cfg, and proper virtualenv is assumed to be active. +# Config is taken from pylint.cfg, +# and proper virtualenv is assumed to be active. # The pylint output stored to pylint.log (overwriting). # "set -eu" handles failures from the following two lines. diff --git a/resources/libraries/bash/function/artifacts.sh b/resources/libraries/bash/function/artifacts.sh index 3fe6bae428..15a4dd2fe1 100644 --- a/resources/libraries/bash/function/artifacts.sh +++ b/resources/libraries/bash/function/artifacts.sh @@ -86,7 +86,7 @@ function download_ubuntu_artifacts () { repository installation was not successful." fi - packages=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ + pkgs=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ -o Dir::Etc::SourceParts=${apt_fdio_repo_file} dumpavail \ | grep Package: | cut -d " " -f 2 | grep vpp) || { die "Retrieval of available VPP packages failed." @@ -102,7 +102,7 @@ function download_ubuntu_artifacts () { fi set +x - for package in ${packages}; do + for package in ${pkgs}; do # Filter packages with given version pkg_info=$(apt-cache show -- ${package}) || { die "apt-cache show on ${package} failed." @@ -147,19 +147,19 @@ function download_centos_artifacts () { } # If version is set we will add suffix. artifacts=() - packages=(vpp vpp-selinux-policy vpp-devel vpp-lib vpp-plugins vpp-api-python) + pkgs=(vpp vpp-selinux-policy vpp-devel vpp-lib vpp-plugins vpp-api-python) if [ -z "${VPP_VERSION-}" ]; then - artifacts+=(${packages[@]}) + artifs+=(${pkgs[@]}) else - artifacts+=(${packages[@]/%/-${VPP_VERSION-}}) + artifs+=(${pkgs[@]/%/-${VPP_VERSION-}}) fi if [[ "${INSTALL:-false}" == "true" ]]; then - sudo yum -y install "${artifacts[@]}" || { + sudo yum -y install "${artifs[@]}" || { die "Install VPP artifact failed." } else - sudo yum -y install --downloadonly --downloaddir=. "${artifacts[@]}" || { + sudo yum -y install --downloadonly --downloaddir=. "${artifs[@]}" || { die "Download VPP artifacts failed." } fi @@ -181,20 +181,20 @@ function download_opensuse_artifacts () { die "Packagecloud FD.io repo fetch failed." } # If version is set we will add suffix. - artifacts=() - packages=(vpp vpp-devel vpp-lib vpp-plugins libvpp0) + artifs=() + pkgs=(vpp vpp-devel vpp-lib vpp-plugins libvpp0) if [ -z "${VPP_VERSION-}" ]; then - artifacts+=(${packages[@]}) + artifs+=(${pkgs[@]}) else - artifacts+=(${packages[@]/%/-${VPP_VERSION-}}) + artifs+=(${pkgs[@]/%/-${VPP_VERSION-}}) fi if [[ "${INSTALL:-false}" == "true" ]]; then - sudo yum -y install "${artifacts[@]}" || { + sudo yum -y install "${artifs[@]}" || { die "Install VPP artifact failed." } else - sudo yum -y install --downloadonly --downloaddir=. "${artifacts[@]}" || { + sudo yum -y install --downloadonly --downloaddir=. "${artifs[@]}" || { die "Download VPP artifacts failed." } fi diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index ec95f9227c..ed3b2044d3 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -526,7 +526,8 @@ function get_test_tag_string () { TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}" || true) if [[ -z "${TEST_TAG_STRING-}" ]]; then # Probably we got a base64 encoded comment. - comment=$(base64 --decode <<< "${GERRIT_EVENT_COMMENT_TEXT}" || true) + comment="${GERRIT_EVENT_COMMENT_TEXT}" + comment=$(base64 --decode <<< "${comment}" || true) comment=$(fgrep "${trigger}" <<< "${comment}" || true) TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}" || true) fi diff --git a/resources/libraries/bash/function/dpdk.sh b/resources/libraries/bash/function/dpdk.sh index 362524349c..3c16372294 100644 --- a/resources/libraries/bash/function/dpdk.sh +++ b/resources/libraries/bash/function/dpdk.sh @@ -95,8 +95,10 @@ function dpdk_compile () { sed -i "${sed_cmd}" "${sed_file}" || die "RTE_MAX_NUMA_NODES Patch failed" # Patch L3FWD. - sed_rxd="s/^#define RTE_TEST_RX_DESC_DEFAULT 128/#define RTE_TEST_RX_DESC_DEFAULT 1024/g" - sed_txd="s/^#define RTE_TEST_TX_DESC_DEFAULT 512/#define RTE_TEST_TX_DESC_DEFAULT 1024/g" + sed_rxd="s/^#define RTE_TEST_RX_DESC_DEFAULT 128" + sed_rxd+="/#define RTE_TEST_RX_DESC_DEFAULT 1024/g" + sed_txd="s/^#define RTE_TEST_TX_DESC_DEFAULT 512" + sed_txd+="/#define RTE_TEST_TX_DESC_DEFAULT 1024/g" sed_file="./main.c" pushd examples/l3fwd || die "Pushd failed" sed -i "${sed_rxd}" "${sed_file}" || die "Patch failed" @@ -207,8 +209,10 @@ function dpdk_l3fwd_compile () { pushd "${DPDK_DIR}" || die "Pushd failed" # Patch L3FWD. - sed_rxd="s/^#define RTE_TEST_RX_DESC_DEFAULT 128/#define RTE_TEST_RX_DESC_DEFAULT 2048/g" - sed_txd="s/^#define RTE_TEST_TX_DESC_DEFAULT 512/#define RTE_TEST_TX_DESC_DEFAULT 2048/g" + sed_rxd="s/^#define RTE_TEST_RX_DESC_DEFAULT 128" + sed_rxd+="/#define RTE_TEST_RX_DESC_DEFAULT 2048/g" + sed_txd="s/^#define RTE_TEST_TX_DESC_DEFAULT 512" + sed_txd+="/#define RTE_TEST_TX_DESC_DEFAULT 2048/g" sed_file="./main.c" pushd examples/l3fwd || die "Pushd failed" sed -i "${sed_rxd}" "${sed_file}" || die "Patch failed" diff --git a/resources/libraries/bash/function/gather.sh b/resources/libraries/bash/function/gather.sh index 2112e1be01..e3a6a9d150 100644 --- a/resources/libraries/bash/function/gather.sh +++ b/resources/libraries/bash/function/gather.sh @@ -124,7 +124,8 @@ function gather_vpp () { # - ${CSIT_DIR}/DPDK_STABLE_VER - DPDK version to use # by csit-vpp not-timed jobs. # - ${CSIT_DIR}/${VPP_VER_FILE} - Ubuntu VPP version to use. - # - ../*vpp*.deb|rpm - Relative to ${DOWNLOAD_DIR}, copied for vpp-csit jobs. + # - ../*vpp*.deb|rpm - Relative to ${DOWNLOAD_DIR}, + # copied for vpp-csit jobs. # Directories updated: # - ${DOWNLOAD_DIR}, vpp-*.deb files are copied here for vpp-csit jobs. # - ./ - Assumed ${DOWNLOAD_DIR}, *vpp*.deb|rpm files @@ -157,8 +158,10 @@ function gather_vpp () { download_artifacts || die ;; "vpp-csit-"*) + # Shorten line. + pgks="${PKG_SUFFIX}" # Use locally built packages. - mv "${DOWNLOAD_DIR}"/../*vpp*."${PKG_SUFFIX}" "${DOWNLOAD_DIR}"/ || { + mv "${DOWNLOAD_DIR}"/../*vpp*."${pkgs}" "${DOWNLOAD_DIR}"/ || { die "Move command failed." } ;; diff --git a/resources/libraries/bash/function/per_patch.sh b/resources/libraries/bash/function/per_patch.sh index 76dbf51416..4af3302008 100644 --- a/resources/libraries/bash/function/per_patch.sh +++ b/resources/libraries/bash/function/per_patch.sh @@ -96,7 +96,7 @@ function build_vpp_ubuntu_amd64 () { "using build default ($(grep -c ^processor /proc/cpuinfo))." fi - make UNATTENDED=y pkg-verify || die "VPP build using make pkg-verify failed." + make UNATTENDED=y pkg-verify || die "VPP build with make pkg-verify failed." echo "* VPP ${1-} BUILD SUCCESSFULLY COMPLETED" || { die "Argument not found." } diff --git a/resources/libraries/bash/shell/k8s_utils.sh b/resources/libraries/bash/shell/k8s_utils.sh index c29151059b..b96ec8df6c 100644 --- a/resources/libraries/bash/shell/k8s_utils.sh +++ b/resources/libraries/bash/shell/k8s_utils.sh @@ -66,7 +66,8 @@ function k8s_utils.contiv_vpp_deploy { k8s_contiv_patch="kubecon.contiv-vpp-yaml-patch.diff" # Pull the most recent Docker images - bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/pull-images.sh) + url="https://raw.githubusercontent.com/contiv/vpp/master/k8s/pull-images.sh" + bash <(curl -s "${url}") # Apply resources wget ${k8s_contiv} @@ -80,17 +81,21 @@ function k8s_utils.contiv_vpp_deploy { function k8s_utils.cri_shim_install { # Install the CRI Shim on host - sudo su root -c 'bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/cri-install.sh)' + url"https://raw.githubusercontent.com/contiv/vpp/master/k8s/cri-install.sh" + sudo su root -c "bash <(curl -s '${url}')" } function k8s_utils.cri_shim_uninstall { # Uninstall the CRI Shim on host - sudo su root -c 'bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/cri-install.sh) --uninstall' + url="https://raw.githubusercontent.com/contiv/vpp/master/k8s/cri-install.sh" + sudo su root -c "bash <(curl -s '${url}') --uninstall" } function k8s_utils.kube_proxy_install { # Installing custom version of Kube-Proxy to enable Kubernetes services - bash <(curl -s https://raw.githubusercontent.com/contiv/vpp/master/k8s/proxy-install.sh) + url="https://raw.githubusercontent.com/contiv/vpp/master/k8s/" + url+="proxy-install.sh" + bash <(curl -s "${url}") } function k8s_utils.apply { @@ -113,7 +118,9 @@ function k8s_utils.resource_delete { function k8s_utils.affinity_non_vpp { # Set affinity for all non VPP docker containers to CPU 0 - for i in `sudo docker ps --format "{{.ID}} {{.Names}}" | grep -v vpp | cut -d' ' -f1`; do + command='sudo docker ps --format "{{.ID}} {{.Names}}"' + command+=" | grep -v vpp | cut -d' ' -f1" + for i in $(${command}); do sudo docker update --cpuset-cpus 0 ${i} done } |