- project:
!j2: |
{%- for uc in usecase -%}
- iec-{{ iecType }}-install-{{ uc }}-{{ installer }}-{{ deploy_type }}-{{ os }}-daily-{{ stream }}
+ {%- for ph in phase -%}
+ iec-{{ iecType }}-{{ ph }}-{{ uc }}-{{ installer }}-{{ deploy_type }}-{{ os }}-daily-{{ stream }}
+ {%- if not loop.last -%},{%- endif -%}
+ {%- endfor %}
{%- if not loop.last -%},{%- endif -%}
{%- endfor %}
current-parameters: true
publishers: *publishers
- job-template:
- id: akraino-iec-install-usecase
- name: 'iec-{iecType}-install-{usecase}-{installer}-{deploy_type}-{os}-daily-{stream}'
+ id: akraino-iec-phase-usecase
+ name: 'iec-{iecType}-{phase}-{usecase}-{installer}-{deploy_type}-{os}-daily-{stream}'
concurrent: true
node: '{slave-label}'
properties: *properties
branch: '{branch}'
- '{project}-defaults'
- '{installer}-{os}-defaults'
+ - '{usecase}-defaults'
wrappers:
- build-name:
!include-raw-escape: ../iec/iec-{usecase}.sh
publishers: *publishers
-
##############################################################################
export TERM="vt220"
+set -x
echo "JOB_NAME=${JOB_NAME}"
+# Run either ssh or scp on the K8S master
+run_on_k8s_master () {
+ case "${1}" in
+ ssh)
+ _c="${1}"
+ shift
+ _s=" "
+ ;;
+ scp)
+ _c="${1} -r"
+ shift
+ _s=":${1}"
+ shift
+ ;;
+ *)
+ echo "Use either ssh or scp to run on K8S master"
+ exit 1
+ ;;
+ esac
+
+ if [ -n "${K8S_SSH_PASSWORD}" ]
+ then
+ eval sshpass -p "${K8S_SSH_PASSWORD}" "${_c}" \
+ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ ${_o} "${K8S_SSH_USER}"@"${K8S_MASTER_IP}${_s}" "$@"
+ elif [ -n "${K8S_SSH_KEY}" ]
+ then
+ eval ${_c} -i "${K8S_SSH_KEY}" \
+ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ ${_o} "${K8S_SSH_USER}"@"${K8S_MASTER_IP}${_s}" "$@"
+ else
+ echo "Neither K8S_SSH_PASSWORD nor K8S_SSH_KEY are set"
+ exit 1
+ fi
+}
+
+if [ -z "$K8S_SSH_USER" ]
+then
+ echo "K8S_SSH_USER not set, cannot ssh to K8S master, aborting"
+ exit 1
+fi
+
case "${JOB_NAME}" in
*fuel*)
K8S_MASTER_IP=$(docker exec fuel cat /etc/hosts | grep iec01 \
# On Fuel deployements the K8s ssh key is the one used by the deploy job
K8S_SSH_KEY=${SSH_KEY}
IEC_DIR="/var/lib/akraino/iec"
+ KUBE_DIR="~${K8S_SSH_USER}/.kube"
;;
*compass*)
# K8S_{MASTER_IP,SSH_USER,SSH_PASSWORD} are already set by job params
IEC_DIR="/${K8S_SSH_USER}/iec"
+ KUBE_DIR="~${K8S_SSH_USER}/.kube"
;;
*)
echo "Cannot determine installer from ${JOB_NAME}"
;;
esac
-if [ -z "$K8S_SSH_USER" ]
-then
- echo "K8S_SSH_USER not set, cannot ssh to install SEBA"
- exit 1
-fi
+case "${JOB_NAME}" in
+ iec-*-install-seba_on_arm*)
+ INSTALL_CMD="'cd ${IEC_DIR}/src/use_cases/seba_on_arm/install; ./install.sh'"
+ run_on_k8s_master ssh "${INSTALL_CMD}"
+ ;;
+ iec-*-test-seba_on_arm*)
-INSTALL_CMD="cd ${IEC_DIR}/src/use_cases/seba_on_arm/install; ./install.sh"
+ case "${PON_TYPE}" in
+ *ponsim*)
+ ;;
+ *)
+ echo "Unknown PON_TYPE ${PON_TYPE}"
+ exit
+ ;;
+ esac
-if [ -n "${K8S_SSH_PASSWORD}" ]
-then
- sshpass -p "${K8S_SSH_PASSWORD}" ssh -o StrictHostKeyChecking=no \
- "${K8S_SSH_USER}"@"${K8S_MASTER_IP}" "${INSTALL_CMD}"
-elif [ -n "${K8S_SSH_KEY}" ]
-then
- ssh -o StrictHostKeyChecking=no -i "${K8S_SSH_KEY}" \
- "${K8S_SSH_USER}"@"${K8S_MASTER_IP}" "${INSTALL_CMD}"
-else
- echo "Neither K8S_SSH_USER or K8S_SSH_KEY set. Cannot ssh to K8S Master"
- exit 1
-fi
+ # After the installation, copy the .kube dir from the K8S master
+ cd "${WORKSPACE}" || exit 1
+ run_on_k8s_master scp "${KUBE_DIR}" "${WORKSPACE}"
+
+ SEBA_TEST_DIR="src/use_cases/seba_on_arm/test"
+ TEST_CMD="${SEBA_TEST_DIR}/${PON_TYPE}/test.sh"
+ echo "Issuing command"
+ echo "${TEST_CMD}"
+
+ eval ${TEST_CMD}
+ exit_code=$?
+ ;;
+ *)
+ echo "Cannot determine what to do for seba_on_arm from ${JOB_NAME}"
+ exit 1
+ ;;
+esac
exit 0