mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
ci: k8s: shellcheck fixes to gha-run.sh
Fixed a couple of warns shellcheck emitted and disabled others: * SC2154 (var is referenced but not assigned) * SC2086 (Double quote to prevent globbing and word splitting) Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
4af78be13a
commit
200e542921
@ -10,6 +10,7 @@ set -o pipefail
|
|||||||
|
|
||||||
kubernetes_dir="$(dirname "$(readlink -f "$0")")"
|
kubernetes_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
source "${kubernetes_dir}/../../gha-run-k8s-common.sh"
|
source "${kubernetes_dir}/../../gha-run-k8s-common.sh"
|
||||||
|
# shellcheck disable=2154
|
||||||
tools_dir="${repo_root_dir}/tools"
|
tools_dir="${repo_root_dir}/tools"
|
||||||
|
|
||||||
DOCKER_REGISTRY=${DOCKER_REGISTRY:-quay.io}
|
DOCKER_REGISTRY=${DOCKER_REGISTRY:-quay.io}
|
||||||
@ -121,7 +122,7 @@ function deploy_kata() {
|
|||||||
|
|
||||||
echo "::group::Final kata-deploy.yaml that is used in the test"
|
echo "::group::Final kata-deploy.yaml that is used in the test"
|
||||||
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||||
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" | grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" || die "Failed to setup the tests image"
|
grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" || die "Failed to setup the tests image"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
kubectl apply -f "${tools_dir}/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
kubectl apply -f "${tools_dir}/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
||||||
@ -160,7 +161,7 @@ function run_tests() {
|
|||||||
kubectl delete namespace kata-containers-k8s-tests &> /dev/null || true
|
kubectl delete namespace kata-containers-k8s-tests &> /dev/null || true
|
||||||
|
|
||||||
# Create a new namespace for the tests and switch to it
|
# Create a new namespace for the tests and switch to it
|
||||||
kubectl apply -f ${kubernetes_dir}/runtimeclass_workloads/tests-namespace.yaml
|
kubectl apply -f "${kubernetes_dir}/runtimeclass_workloads/tests-namespace.yaml"
|
||||||
kubectl config set-context --current --namespace=kata-containers-k8s-tests
|
kubectl config set-context --current --namespace=kata-containers-k8s-tests
|
||||||
|
|
||||||
pushd "${kubernetes_dir}"
|
pushd "${kubernetes_dir}"
|
||||||
@ -197,6 +198,7 @@ function cleanup() {
|
|||||||
cleanup_spec="-f "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml""
|
cleanup_spec="-f "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=2086
|
||||||
kubectl delete ${deploy_spec}
|
kubectl delete ${deploy_spec}
|
||||||
kubectl -n kube-system wait --timeout=10m --for=delete -l name=kata-deploy pod
|
kubectl -n kube-system wait --timeout=10m --for=delete -l name=kata-deploy pod
|
||||||
|
|
||||||
@ -211,10 +213,12 @@ function cleanup() {
|
|||||||
|
|
||||||
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
|
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
|
||||||
cat "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
|
cat "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
|
||||||
cat "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml" | grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" || die "Failed to setup the tests image"
|
grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" "${tools_dir}/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml" || die "Failed to setup the tests image"
|
||||||
|
# shellcheck disable=2086
|
||||||
kubectl apply ${cleanup_spec}
|
kubectl apply ${cleanup_spec}
|
||||||
sleep 180s
|
sleep 180s
|
||||||
|
|
||||||
|
# shellcheck disable=2086
|
||||||
kubectl delete ${cleanup_spec}
|
kubectl delete ${cleanup_spec}
|
||||||
kubectl delete -f "${tools_dir}/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
kubectl delete -f "${tools_dir}/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user