Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Justin
slapos
Commits
ccfc6548
Commit
ccfc6548
authored
Sep 30, 2022
by
Ophélie Gagnard
Committed by
Ophélie Gagnard
Oct 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/erp5testnode/testsuite/deploy-test: Clean deploy-script-controller.
parent
4e14882e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
33 deletions
+33
-33
software/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
...ware/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
+1
-1
software/erp5testnode/testsuite/deploy-test/deploy-script-controller
...p5testnode/testsuite/deploy-test/deploy-script-controller
+32
-32
No files found.
software/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
View file @
ccfc6548
...
...
@@ -14,7 +14,7 @@
# not need these here).
[deploy-script-controller-script]
filename = deploy-script-controller
md5sum =
8357771b70efd0740561b1cb46f6955e
md5sum =
6b2a293a38cf3ab69eba8d24fa1a8ea1
[template-deploy-test]
filename = instance.cfg.in
...
...
software/erp5testnode/testsuite/deploy-test/deploy-script-controller
View file @
ccfc6548
...
...
@@ -24,9 +24,9 @@
LOG_FILE
=
/var/log/test-script-deployment.log
wget
-O
/tmp/test-script.cfg.
$$
-q
http://10.0.2.100/data
wget
-O
/tmp/test-script.cfg.
"
$$
"
-q
http://10.0.2.100/data
source
/tmp/test-script.cfg.
$$
source
/tmp/test-script.cfg.
"
$$
"
if
[
-z
"
$LOG_FILE
"
]
;
then
echo
"Output log file is missing"
...
...
@@ -34,7 +34,7 @@ if [ -z "$LOG_FILE" ] ; then
fi
if
[
-z
"
$URL
"
]
;
then
echo
"URL is missing"
>>
$LOG_FILE
2>&1
echo
"URL is missing"
>>
"
$LOG_FILE
"
2>&1
exit
1
fi
...
...
@@ -48,65 +48,65 @@ if [ -z "$TRIES" ] ; then
exit
1
fi
DEPLOYMENT_SCRIPT
=
/tmp/test-script-deployment.bash.
$$
wget
-O
$DEPLOYMENT_SCRIPT
-q
$URL
DEPLOYMENT_SCRIPT
=
/tmp/test-script-deployment.bash.
"
$$
"
wget
-O
"
$DEPLOYMENT_SCRIPT
"
-q
"
$URL
"
if
[[
!
-s
"
$DEPLOYMENT_SCRIPT
"
]]
;
then
echo
"exit 1"
>
$DEPLOYMENT_SCRIPT
echo
"exit 1"
>
"
$DEPLOYMENT_SCRIPT
"
fi
function
add_log
()
{
LOG_FILE
=
$1
LOG_FILE
=
"
$1
"
for
f
in
/opt/slapos/log/slapos-node-
{
software,instance
}
.log
;
do
echo
"Tail of '
$f
':"
>>
$LOG_FILE
tail
-n
500
$f
>>
$LOG_FILE
echo
"Tail of '
$f
':"
>>
"
$LOG_FILE
"
tail
-n
500
"
$f
"
>>
"
$LOG_FILE
"
done
}
function
add_checks
()
{
LOG_FILE
=
$1
echo
'lsof -Pni'
>>
$LOG_FILE
2>&1
lsof
-Pni
>>
$LOG_FILE
2>&1
echo
'iptables-save'
>>
$LOG_FILE
2>&1
iptables-save
>>
$LOG_FILE
2>&1
for
f
in
/tmp/playbook-
*
;
do
echo
$f
;
cat
$f
;
echo
;
done
>>
$LOG_FILE
2>&1
echo
'slapos node status'
>>
$LOG_FILE
2>&1
slapos node status
>>
$LOG_FILE
2>&1
LOG_FILE
=
"
$1
"
echo
'lsof -Pni'
>>
"
$LOG_FILE
"
2>&1
lsof
-Pni
>>
"
$LOG_FILE
"
2>&1
echo
'iptables-save'
>>
"
$LOG_FILE
"
2>&1
iptables-save
>>
"
$LOG_FILE
"
2>&1
for
f
in
/tmp/playbook-
*
;
do
echo
"
$f
"
;
cat
"
$f
"
;
echo
;
done
>>
"
$LOG_FILE
"
2>&1
echo
'slapos node status'
>>
"
$LOG_FILE
"
2>&1
slapos node status
>>
"
$LOG_FILE
"
2>&1
}
function
upload
()
{
try
=
$1
LOG_FILE
=
$2
add_log
$LOG_FILE
add_checks
$LOG_FILE
try
=
"
$1
"
LOG_FILE
=
"
$2
"
add_log
"
$LOG_FILE
"
add_checks
"
$LOG_FILE
"
t
=
`
date
'+%Y%m%d%H%S'
`
mv
$LOG_FILE
${
LOG_FILE
}
.
$t
mv
"
$LOG_FILE
"
${
LOG_FILE
}
.
"
$t
"
curl
-q
-X
POST
--data-urlencode
"path=test-script-result/log-file.log.
$t
"
--data-urlencode
"content@
${
LOG_FILE
}
.
$t
"
http://10.0.2.100/
}
try
=
1
while
true
;
do
echo
"
$0
: Try
$try
. Running '/bin/bash
$DEPLOYMENT_SCRIPT
'"
>>
$LOG_FILE
2>&1
echo
"
$0
: Try
$try
. Running '/bin/bash
$DEPLOYMENT_SCRIPT
'"
>>
"
$LOG_FILE
"
2>&1
export
TEST_YML_PATH
/bin/bash
$DEPLOYMENT_SCRIPT
>>
$LOG_FILE
2>&1
result
=
$?
if
[
$result
==
0
]
;
then
echo
"
$0
: Try
$try
. Script executed successfully."
>>
$LOG_FILE
2>&1
upload
$try
$LOG_FILE
/bin/bash
"
$DEPLOYMENT_SCRIPT
"
>>
"
$LOG_FILE
"
2>&1
result
=
"
$?
"
if
[
"
$result
"
==
0
]
;
then
echo
"
$0
: Try
$try
. Script executed successfully."
>>
"
$LOG_FILE
"
2>&1
upload
"
$try
"
"
$LOG_FILE
"
break
fi
if
((
try
>
TRIES
))
;
then
echo
"
$0
: Try
$try
. Amount of tries
$TRIES
exceeded, giving up."
>>
$LOG_FILE
2>&1
upload
$try
$LOG_FILE
upload
"
$try
"
"
$LOG_FILE
"
break
fi
# wait WAITTIME before checking the state
echo
"
$0
: Try
$try
. Sleeping
$WAITTIME
before retry."
>>
$LOG_FILE
2>&1
upload
$try
$LOG_FILE
sleep
$WAITTIME
upload
"
$try
"
"
$LOG_FILE
"
sleep
"
$WAITTIME
"
((
try++
))
done
exit
$result
exit
"
$result
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment