Commit 29b4e64d authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): properly removing docker volumes

Laurent noticed it on one of his MR and confirmed with him:
  -- Volumes have be created the 1st time they ran on avra on July 7th
  -- Volumes were created with not only the raw files but also the nr-softmodem executable

Solution: two-fold:
  1. using the `docker-compose down -v` syntax, the volume is deleted automatically
  2. I added redundancy with the custom command to remove the used volume
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 0f254383
......@@ -988,14 +988,11 @@ class Containerize():
for svcName in services:
# head -n -1 suppresses the final "X exited with status code Y"
filename = f'{svcName}-{HTML.testCase_id}.log'
#mySSH.command(f'docker-compose -f ci-docker-compose.yml logs --no-log-prefix -- {svcName} | head -n -1 &> {lSourcePath}/cmake_targets/log/{filename}', '\$', 30)
mySSH.command(f'docker-compose -f ci-docker-compose.yml logs --no-log-prefix -- {svcName} &> {lSourcePath}/cmake_targets/log/{filename}', '\$', 120)
mySSH.command('docker-compose -f ci-docker-compose.yml down', '\$', 5)
# Cleaning any created tmp volume
mySSH.command('docker volume prune --force', '\$', 20)
mySSH.command('docker-compose -f ci-docker-compose.yml down -v', '\$', 5)
mySSH.close()
# Analyzing log file!
files = ','.join([f'{s}-{HTML.testCase_id}' for s in services])
if len(services) > 1:
......@@ -1298,7 +1295,7 @@ class Containerize():
logging.debug('\u001B[1m Undeploying \u001B[0m')
logging.debug(f'Working dir is back {self.yamlPath[0]}')
cmd = 'docker-compose -f docker-compose-ci.yml down'
cmd = 'docker-compose -f docker-compose-ci.yml down -v'
deployStatus = myCmd.run(cmd, timeout=100)
if deployStatus.returncode != 0:
myCmd.close()
......@@ -1309,9 +1306,6 @@ class Containerize():
return
self.deployedContainers = []
# Cleaning any created tmp volume
cmd = 'docker volume prune --force'
deployStatus = myCmd.run(cmd, timeout=100, reportNonZero=False)
myCmd.close()
if fullStatus:
......
......@@ -679,7 +679,7 @@ class EPCManagement():
mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/mme.conf', self.SourceCodePath + '/scripts')
mySSH.command('chmod 775 entrypoint.sh', '\$', 60)
mySSH.command('wget --quiet --tries=3 --retry-connrefused https://raw.githubusercontent.com/OPENAIRINTERFACE/openair-hss/develop/src/hss_rel14/db/oai_db.cql', '\$', 30)
mySSH.command('docker-compose down', '\$', 60)
mySSH.command('docker-compose down -v', '\$', 60)
mySSH.command('docker-compose up -d db_init', '\$', 60)
# databases take time...
time.sleep(10)
......@@ -831,8 +831,7 @@ class EPCManagement():
listOfContainers += ' prod-trf-gen'
nbContainers += 1
mySSH.command('docker-compose down', '\$', 60)
mySSH.command('docker volume prune --force || true', '\$', 60)
mySSH.command('docker-compose down -v', '\$', 60)
mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10)
noMoreContainerNb = mySSH.getBefore().count('No such object')
mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10)
......
......@@ -750,7 +750,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'WaitEndBuild_eNB':
RAN.WaitBuildeNBisFinished(HTML)
elif action == 'Custom_Command':
logging.info(f"Executing custom command")
RAN.CustomCommand(HTML)
if RAN.prematureExit:
CiTestObj.AutoTerminateeNB(HTML,RAN,EPC,CONTAINERS)
......
......@@ -260,6 +260,7 @@ class RANManagement():
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.backgroundBuildTestId[int(self.eNB_instance)], HTML)
def CustomCommand(self, HTML):
logging.info(f"Executing custom command on {self.node}")
cmd = cls_cmd.getConnection(self.node)
ret = cmd.run(self.command)
cmd.close()
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100011
004000
000010
000011
020011
......@@ -45,6 +46,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fdd_phytest_rrc.config</command>
</testCase>
<testCase id="000010">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G gNB RF sim SA</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100012
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_fdd_phytest</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fdd_phytest_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100001
004000
000000
000001
020001
......@@ -43,6 +44,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fr2_32prb_rrc.config</command>
</testCase>
<testCase id="000000">
<class>DeployGenObject</class>
<desc>Deploy OAI gNB</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100002
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_fr2_32prb</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fr2_32prb_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100001
004000
000000
000001
020001
......@@ -43,6 +44,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_tdd_dora_rrc.config</command>
</testCase>
<testCase id="000000">
<class>DeployGenObject</class>
<desc>Deploy OAI gNB</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100002
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_tdd_dora</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_tdd_dora_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment