From b7f8050bca2425cc9e37fb8ead9ae7bd27810570 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Wed, 11 Aug 2021 13:22:27 +0200 Subject: [PATCH] fix(ci): cleanup Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/Jenkinsfile-GitLab-Docker | 83 ++++--------------- .../dsTesterDockerCompose/docker-compose.tplt | 23 ++--- 2 files changed, 23 insertions(+), 83 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Docker b/ci-scripts/Jenkinsfile-GitLab-Docker index 915394b..f9af0a5 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Docker +++ b/ci-scripts/Jenkinsfile-GitLab-Docker @@ -45,7 +45,6 @@ def upstreamTagToUse = params.upstreamTagToUse def dsT_host_flag = false def dsT_host = "" def dsT_host_user = "" -def dsT_host_ip_addr = "" // dsTester tag to use def dsTesterTag = params.DSTESTER_TAG @@ -109,11 +108,6 @@ pipeline { } else { dsT_host_user = params.DS_Tester_Server_Login } - if (params.DS_Tester_Server_IP_Addr == null) { - allParametersPresent = false - } else { - dsT_host_ip_addr = params.DS_Tester_Server_IP_Addr - } if (allParametersPresent) { echo "DS Tester is on ${dsT_host}" } else { @@ -367,19 +361,19 @@ pipeline { // Copy the pcaps and logs from the containers sh "mkdir -p archives/pcaps archives/logs" sh 'docker cp cicd-oai-nrf:/tmp/nrf.pcap archives/pcaps/oai_nrf.pcap || true' - sh 'docker cp cicd-oai-nrf:/tmp/nrf.log archives/logs/oai_nrf.log || true' + sh 'docker logs cicd-oai-nrf > archives/logs/oai_nrf.log 2>&1 || true' sh 'docker cp cicd-oai-amf:/tmp/amf.pcap archives/pcaps/oai_amf.pcap || true' - sh 'docker cp cicd-oai-amf:/tmp/amf.log archives/logs/oai_amf.log || true' + sh 'docker logs cicd-oai-amf > archives/logs/oai_amf.log 2>&1 || true' sh 'docker cp cicd-oai-smf:/tmp/smf.pcap archives/pcaps/oai_smf.pcap || true' - sh 'docker cp cicd-oai-smf:/tmp/smf.log archives/logs/oai_smf.log || true' + sh 'docker logs cicd-oai-smf > archives/logs/oai_smf.log 2>&1 || true' sh 'docker cp cicd-oai-upf:/tmp/spgwu.pcap archives/pcaps/oai_spgwu.pcap || true' - sh 'docker cp cicd-oai-upf:/tmp/spgwu.log archives/logs/oai_spgwu.log || true' + sh 'docker logs cicd-oai-upf > archives/logs/oai_spgwu.log 2>&1 || true' sh 'docker cp cicd-oai-ausf:/tmp/ausf.pcap archives/pcaps/oai_ausf.pcap || true' - sh 'docker cp cicd-oai-ausf:/tmp/ausf.log archives/logs/oai_ausf.log || true' + sh 'docker logs cicd-oai-ausf > archives/logs/oai_ausf.log 2>&1 || true' sh 'docker cp cicd-oai-udm:/tmp/udm.pcap archives/pcaps/oai_udm.pcap || true' - sh 'docker cp cicd-oai-udm:/tmp/udm.log archives/logs/oai_udm.log || true' + sh 'docker logs cicd-oai-udm > archives/logs/oai_udm.log 2>&1 || true' sh 'docker cp cicd-oai-udr:/tmp/udr.pcap archives/pcaps/oai_udr.pcap || true' - sh 'docker cp cicd-oai-udr:/tmp/udr.log archives/logs/oai_udr.log || true' + sh 'docker logs cicd-oai-udr > archives/logs/oai_udr.log 2>&1 || true' } } } @@ -402,13 +396,13 @@ pipeline { // Get logs if deployment fail if (deployed != true) { sh "mkdir -p archives/logs" - sh 'docker logs cicd-oai-nrf > archives/logs/oai_nrf.log || true' - sh 'docker logs cicd-oai-amf > archives/logs/oai_amf.log || true' - sh 'docker logs cicd-oai-smf > archives/logs/oai_smf.log || true' - sh 'docker logs cicd-oai-upf > archives/logs/oai_spgwu.log || true' - sh 'docker logs cicd-oai-ausf > archives/logs/oai_ausf.log || true' - sh 'docker logs cicd-oai-udm > archives/logs/oai_udm.log || true' - sh 'docker logs cicd-oai-udr > archives/logs/oai_udr.log || true' + sh 'docker logs cicd-oai-nrf > archives/logs/oai_nrf.log 2>&1 || true' + sh 'docker logs cicd-oai-amf > archives/logs/oai_amf.log 2>&1 || true' + sh 'docker logs cicd-oai-smf > archives/logs/oai_smf.log 2>&1 || true' + sh 'docker logs cicd-oai-upf > archives/logs/oai_spgwu.log 2>&1 || true' + sh 'docker logs cicd-oai-ausf > archives/logs/oai_ausf.log 2>&1 || true' + sh 'docker logs cicd-oai-udm > archives/logs/oai_udm.log 2>&1 || true' + sh 'docker logs cicd-oai-udr > archives/logs/oai_udr.log 2>&1 || true' } // Remove any leftover containers/networks sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host @@ -430,52 +424,3 @@ pipeline { } } } - -// Functions - -def copyTo2ndServer(filename, flag, user, host) { - if (flag) { - if ("oai-cn5g-fed.zip".equals(filename)) { - sh "ssh ${user}@${host} 'rm -rf /tmp/CI-CN5G-FED'" - sh "ssh ${user}@${host} 'mkdir -p /tmp/CI-CN5G-FED'" - } - sh "scp ${filename} ${user}@${host}:/tmp/CI-CN5G-FED" - if ("oai-cn5g-fed.zip".equals(filename)) { - sh "ssh ${user}@${host} 'cd /tmp/CI-CN5G-FED && unzip -qq oai-cn5g-fed.zip && rm oai-cn5g-fed.zip'" - sh "ssh ${user}@${host} 'cd /tmp/CI-CN5G-FED && git checkout -f ${GIT_COMMIT}'" - sh "ssh ${user}@${host} 'cd /tmp/CI-CN5G-FED && git log -n1'" - } - } -} - -def copyFrom2ndServer(filename, target, flag, user, host) { - if (flag) { - sh "scp ${user}@${host}:/tmp/CI-CN5G-FED/${filename} ${target}" - } -} - -def myShCmd(cmd, flag, user, host) { - if (flag) { - sh "ssh -t -t ${user}@${host} 'cd /tmp/CI-CN5G-FED && ${cmd}'" - } else { - sh "${cmd}" - } -} - -def myShCmdWithLog(cmd, logFile, flag, user, host) { - if (flag) { - sh "ssh -t -t ${user}@${host} 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:.:/usr/local/devsol/bin && ${cmd}' > ${logFile} 2>&1" - } else { - sh "${cmd} > ${logFile} 2>&1" - } -} - -def myShRetCmd(cmd, flag, user, host) { - if (flag) { - ret = sh returnStdout: true, script: "ssh -t -t ${user}@${host} 'cd /tmp/CI-CN5G-FED && ${cmd}'" - } else { - ret = sh returnStdout: true, script: "${cmd}" - } - ret = ret.trim() - return ret -} diff --git a/ci-scripts/dsTesterDockerCompose/docker-compose.tplt b/ci-scripts/dsTesterDockerCompose/docker-compose.tplt index 3410987..b407089 100644 --- a/ci-scripts/dsTesterDockerCompose/docker-compose.tplt +++ b/ci-scripts/dsTesterDockerCompose/docker-compose.tplt @@ -30,8 +30,7 @@ services: - 80 command: > bash -c "nohup tshark -i eth0 -w /tmp/udr.pcap 2>&1 > /dev/null & - /openair-udr/bin/oai_udr -c /openair-udr/etc/udr.conf -o | tee /tmp/udr.log 2>&1 - " + /openair-udr/bin/oai_udr -c /openair-udr/etc/udr.conf -o" cap_add: - NET_ADMIN environment: @@ -67,8 +66,7 @@ services: - 80 command: > bash -c "nohup tshark -i eth0 -w /tmp/udm.pcap 2>&1 > /dev/null & - /openair-udm/bin/oai_udm -c /openair-udm/etc/udm.conf -o | tee /tmp/udm.log 2>&1 - " + /openair-udm/bin/oai_udm -c /openair-udm/etc/udm.conf -o" cap_add: - NET_ADMIN environment: @@ -103,8 +101,7 @@ services: - 80 command: > bash -c "nohup tshark -i eth0 -w /tmp/ausf.pcap 2>&1 > /dev/null & - /openair-ausf/bin/oai_ausf -c /openair-ausf/etc/ausf.conf -o | tee /tmp/ausf.log 2>&1 - " + /openair-ausf/bin/oai_ausf -c /openair-ausf/etc/ausf.conf -o" cap_add: - NET_ADMIN environment: @@ -143,8 +140,7 @@ services: - 9090 command: > bash -c "nohup tshark -i eth0 -w /tmp/nrf.pcap 2>&1 > /dev/null & - /openair-nrf/bin/oai_nrf -c /openair-nrf/etc/nrf.conf -o | tee /tmp/nrf.log 2>&1 - " + /openair-nrf/bin/oai_nrf -c /openair-nrf/etc/nrf.conf -o" cap_add: - NET_ADMIN environment: @@ -174,8 +170,7 @@ services: - 80 command: > bash -c "nohup tshark -i eth0 -w /tmp/amf.pcap 2>&1 > /dev/null & - /openair-amf/bin/oai_amf -c /openair-amf/etc/amf.conf -o | tee /tmp/amf.log 2>&1 - " + /openair-amf/bin/oai_amf -c /openair-amf/etc/amf.conf -o" cap_add: - NET_ADMIN environment: @@ -253,8 +248,7 @@ services: - 9090 command: > bash -c "nohup tshark -i eth0 -w /tmp/smf.pcap 2>&1 > /dev/null & - /openair-smf/bin/oai_smf -c /openair-smf/etc/smf.conf -o | tee /tmp/smf.log 2>&1 - " + /openair-smf/bin/oai_smf -c /openair-smf/etc/smf.conf -o" cap_add: - NET_ADMIN environment: @@ -307,8 +301,7 @@ services: - 8805 command: > bash -c "nohup tshark -i eth0 -w /tmp/spgwu.pcap 2>&1 > /dev/null & - /openair-spgwu-tiny/bin/oai_spgwu -c /openair-spgwu-tiny/etc/spgw_u.conf -o | tee /tmp/spgwu.log 2>&1 - " + /openair-spgwu-tiny/bin/oai_spgwu -c /openair-spgwu-tiny/etc/spgw_u.conf -o" environment: - TZ=Europe/Paris - PID_DIRECTORY=/var/run @@ -369,3 +362,5 @@ networks: ipam: config: - subnet: 192.168.61.192/26 + driver_opts: + com.docker.network.bridge.name: "cicd-public" -- GitLab