mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
CI: Make a generic function for (un)deployment with script
Add simple unit tests for the new functions. Signed-off-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@openairinterface.org>
This commit is contained in:
committed by
Jaroslava Fiedlerova
parent
cb0e501293
commit
c02c3daad9
22
ci-scripts/scripts/oc-chart-deploy.sh
Executable file
22
ci-scripts/scripts/oc-chart-deploy.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
export PS4='[\D{%Y-%m-%d %H:%M:%S}] '
|
||||
|
||||
function die() { echo $@; exit 1; }
|
||||
[ $# -eq 3 ] || die "usage: $0 <path-to-dir> <namespace> <image-tag>"
|
||||
|
||||
OC_NS=${2}
|
||||
IMAGE_TAG=${3}
|
||||
OC_DIR=${1}
|
||||
OC_RELEASE=$(basename "${1}")
|
||||
|
||||
cat /opt/oc-password | oc login -u oaicicd --server https://api.oai.cs.eurecom.fr:6443 > /dev/null
|
||||
oc project ${OC_NS} > /dev/null
|
||||
set -x
|
||||
helm install --wait --timeout 120s ${OC_RELEASE} --set nfimage.version=${IMAGE_TAG} --hide-notes ${OC_DIR}/.
|
||||
status=$?
|
||||
set +x
|
||||
oc logout > /dev/null
|
||||
|
||||
[ $status -eq 0 ] || die "OC chart deployment failed"
|
||||
26
ci-scripts/scripts/oc-chart-undeploy.sh
Executable file
26
ci-scripts/scripts/oc-chart-undeploy.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function die() { echo $@; exit 1; }
|
||||
[ $# -eq 3 ] || die "usage: $0 <path-to-dir> <namespace> <log-dir>"
|
||||
|
||||
export PS4='[\D{%Y-%m-%d %H:%M:%S}] '
|
||||
|
||||
OC_DIR=${1}
|
||||
OC_NS=${2}
|
||||
LOG_DIR=${3}
|
||||
OC_RELEASE=$(basename "${OC_DIR}")
|
||||
|
||||
cat ${OC_DIR}/oc-password | oc login -u oaicicd --server https://api.oai.cs.eurecom.fr:6443 > /dev/null
|
||||
oc project ${OC_NS} > /dev/null
|
||||
|
||||
oc describe pod > ${LOG_DIR}/describe-pods-post-test.log
|
||||
oc get pods.metrics.k8s &> ${LOG_DIR}/nf-resource-consumption.log
|
||||
oc logs -l app.kubernetes.io/name=${OC_RELEASE} --tail=-1 > ${LOG_DIR}/${OC_RELEASE}.log
|
||||
set -x
|
||||
helm uninstall ${OC_RELEASE} --wait
|
||||
status=$?
|
||||
set +x
|
||||
oc logout > /dev/null
|
||||
|
||||
[ $status -eq 0 ] || die "OC chart undeployment failed"
|
||||
Reference in New Issue
Block a user