Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
94324cfb
Commit
94324cfb
authored
Oct 04, 2022
by
Ophélie Gagnard
Browse files
Options
Browse Files
Download
Plain Diff
Data to vm
See merge request
nexedi/slapos!1267
parents
4e14882e
343f2af5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
56 deletions
+44
-56
software/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
...ware/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
+2
-2
software/erp5testnode/testsuite/deploy-test/deploy-script-controller
...p5testnode/testsuite/deploy-test/deploy-script-controller
+40
-43
software/erp5testnode/testsuite/deploy-test/instance-deploy-test.cfg.jinja2
...ode/testsuite/deploy-test/instance-deploy-test.cfg.jinja2
+2
-6
software/erp5testnode/testsuite/deploy-test/instance.cfg.in
software/erp5testnode/testsuite/deploy-test/instance.cfg.in
+0
-2
software/erp5testnode/testsuite/deploy-test/software.cfg
software/erp5testnode/testsuite/deploy-test/software.cfg
+0
-3
No files found.
software/erp5testnode/testsuite/deploy-test/buildout.hash.cfg
View file @
94324cfb
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
# not need these here).
# not need these here).
[deploy-script-controller-script]
[deploy-script-controller-script]
filename = deploy-script-controller
filename = deploy-script-controller
md5sum =
8357771b70efd0740561b1cb46f6955e
md5sum =
ca83be8dd6ebebe0fa37ec1266330b0d
[template-deploy-test]
[template-deploy-test]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
1faa52013b12b1753bcaff0b1309ad90
md5sum =
ba11521137356f4361b7d3d304f8fc0c
software/erp5testnode/testsuite/deploy-test/deploy-script-controller
View file @
94324cfb
...
@@ -13,10 +13,13 @@
...
@@ -13,10 +13,13 @@
# Format of data-to-vm is shell script:
# Format of data-to-vm is shell script:
# URL=<url>\nWAITTIME=<seconds>\nTRIES=<amount>
# URL=<url>\nWAITTIME=<seconds>\nTRIES=<amount>
#
#
#
Expected
values in configuration:
#
MANDATORY
values in configuration:
# * URL - the url of the script to download and test
# * URL - the url of the script to download and test
# OPTIONAL values in configuration:
# * WAITTIME - waiting time, before next try
# * WAITTIME - waiting time, before next try
# * TRIES - amount of tries
# * TRIES - amount of tries
# * any other exported variables can be used by the deployment script
# note: you need to export the variables for them to be used in the deployment script
# Possible TODOs:
# Possible TODOs:
# * post results on each try
# * post results on each try
...
@@ -24,9 +27,9 @@
...
@@ -24,9 +27,9 @@
LOG_FILE
=
/var/log/test-script-deployment.log
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
if
[
-z
"
$LOG_FILE
"
]
;
then
echo
"Output log file is missing"
echo
"Output log file is missing"
...
@@ -34,79 +37,73 @@ if [ -z "$LOG_FILE" ] ; then
...
@@ -34,79 +37,73 @@ if [ -z "$LOG_FILE" ] ; then
fi
fi
if
[
-z
"
$URL
"
]
;
then
if
[
-z
"
$URL
"
]
;
then
echo
"URL is missing
"
>>
$LOG_FILE
2>&1
echo
"URL is missing
."
>>
"
$LOG_FILE
"
2>&1
exit
1
exit
1
fi
fi
if
[
-z
"
$WAITTIME
"
]
;
then
export
WAITTIME
=
${
WAITTIME
:-
360
}
echo
"WAITTIME missing"
>>
$LOG_FILE
2>&1
echo
"INFO: WAITTIME is
$WAITTIME
"
>>
"
$LOG_FILE
"
2>&1
exit
1
export
TRIES
=
${
TRIES
:-
80
}
fi
echo
"INFO: TRIES is
$TRIES
"
>>
"
$LOG_FILE
"
2>&1
if
[
-z
"
$TRIES
"
]
;
then
echo
"TRIES missing"
>>
$LOG_FILE
2>&1
exit
1
fi
DEPLOYMENT_SCRIPT
=
/tmp/test-script-deployment.bash.
$$
DEPLOYMENT_SCRIPT
=
/tmp/test-script-deployment.bash.
"
$$
"
wget
-O
$DEPLOYMENT_SCRIPT
-q
$URL
wget
-O
"
$DEPLOYMENT_SCRIPT
"
-q
"
$URL
"
if
[[
!
-s
"
$DEPLOYMENT_SCRIPT
"
]]
;
then
if
[[
!
-s
"
$DEPLOYMENT_SCRIPT
"
]]
;
then
echo
"exit 1"
>
$DEPLOYMENT_SCRIPT
echo
"exit 1"
>
"
$DEPLOYMENT_SCRIPT
"
fi
fi
function
add_log
()
function
add_log
()
{
{
LOG_FILE
=
$1
LOG_FILE
=
"
$1
"
for
f
in
/opt/slapos/log/slapos-node-
{
software,instance
}
.log
;
do
for
f
in
/opt/slapos/log/slapos-node-
{
software,instance
}
.log
;
do
echo
"Tail of '
$f
':"
>>
$LOG_FILE
echo
"Tail of '
$f
':"
>>
"
$LOG_FILE
"
tail
-n
500
$f
>>
$LOG_FILE
tail
-n
500
"
$f
"
>>
"
$LOG_FILE
"
done
done
}
}
function
add_checks
()
function
add_checks
()
{
{
LOG_FILE
=
$1
LOG_FILE
=
"
$1
"
echo
'lsof -Pni'
>>
$LOG_FILE
2>&1
echo
'lsof -Pni'
>>
"
$LOG_FILE
"
2>&1
lsof
-Pni
>>
$LOG_FILE
2>&1
lsof
-Pni
>>
"
$LOG_FILE
"
2>&1
echo
'iptables-save'
>>
$LOG_FILE
2>&1
echo
'iptables-save'
>>
"
$LOG_FILE
"
2>&1
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
for
f
in
/tmp/playbook-
*
;
do
echo
"
$f
"
;
cat
"
$f
"
;
echo
;
done
>>
"
$LOG_FILE
"
2>&1
echo
'slapos node status'
>>
$LOG_FILE
2>&1
echo
'slapos node status'
>>
"
$LOG_FILE
"
2>&1
slapos node status
>>
$LOG_FILE
2>&1
slapos node status
>>
"
$LOG_FILE
"
2>&1
}
}
function
upload
()
function
upload
()
{
{
try
=
$1
try
=
"
$1
"
LOG_FILE
=
$2
LOG_FILE
=
"
$2
"
add_log
$LOG_FILE
add_log
"
$LOG_FILE
"
add_checks
$LOG_FILE
add_checks
"
$LOG_FILE
"
t
=
`
date
'+%Y%m%d%H%S'
`
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/
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
try
=
1
while
true
;
do
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
/bin/bash
$DEPLOYMENT_SCRIPT
>>
$LOG_FILE
2>&1
result
=
"
$?
"
result
=
$?
if
[
"
$result
"
==
0
]
;
then
if
[
$result
==
0
]
;
then
echo
"
$0
: Try
$try
. Script executed successfully."
>>
"
$LOG_FILE
"
2>&1
echo
"
$0
: Try
$try
. Script executed successfully."
>>
$LOG_FILE
2>&1
upload
"
$try
"
"
$LOG_FILE
"
upload
$try
$LOG_FILE
break
break
fi
fi
if
((
try
>
TRIES
))
;
then
if
((
try
>
TRIES
))
;
then
echo
"
$0
: Try
$try
. Amount of tries
$TRIES
exceeded, giving up."
>>
$LOG_FILE
2>&1
echo
"
$0
: Try
$try
. Amount of tries
$TRIES
exceeded, giving up."
>>
$LOG_FILE
2>&1
upload
$try
$LOG_FILE
upload
"
$try
"
"
$LOG_FILE
"
break
break
fi
fi
# wait WAITTIME before checking the state
# wait WAITTIME before checking the state
echo
"
$0
: Try
$try
. Sleeping
$WAITTIME
before retry."
>>
$LOG_FILE
2>&1
echo
"
$0
: Try
$try
. Sleeping
$WAITTIME
before retry."
>>
$LOG_FILE
2>&1
upload
$try
$LOG_FILE
upload
"
$try
"
"
$LOG_FILE
"
sleep
$WAITTIME
sleep
"
$WAITTIME
"
((
try++
))
((
try++
))
done
done
exit
$result
exit
"
$result
"
software/erp5testnode/testsuite/deploy-test/instance-deploy-test.cfg.jinja2
View file @
94324cfb
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
{% set test_type = slapparameter_dict.get('test-type', 'script-from-url') -%}
{% set test_type = slapparameter_dict.get('test-type', 'script-from-url') -%}
{# Choose parameters according to test type -#}
{# Choose parameters according to test type -#}
{% if test_type == 'script-from-url' -%}
{% if test_type == 'script-from-url' -%}
{% set script_url = slapparameter_dict.get('script-to-test-url') -%}
{% set data_to_vm = slapparameter_dict.get('data-to-vm') -%}
{% set test_yml_path = '/not/required' -%}
{% elif test_type == 'cloned-playbook' -%}
{% elif test_type == 'cloned-playbook' -%}
{% set script_url = 'http://10.0.2.100/standalone-local-playbook' -%}
{% set script_url = 'http://10.0.2.100/standalone-local-playbook' -%}
{% set test_yml_path = slapparameter_dict.get('yml-path-to-test') -%}
{% set test_yml_path = slapparameter_dict.get('yml-path-to-test') -%}
...
@@ -38,10 +37,7 @@ config-bootstrap-script-url = {{ in_vm_test_script }}#{{ in_vm_test_script_md5 }
...
@@ -38,10 +37,7 @@ config-bootstrap-script-url = {{ in_vm_test_script }}#{{ in_vm_test_script_md5 }
# Script configuration
# Script configuration
config-data-to-vm =
config-data-to-vm =
URL={{ script_url }}
{{ data_to_vm }}
WAITTIME={{ waittime }}
TRIES={{ tries }}
TEST_YML_PATH={{ test_yml_path }}
# require HTTP server
# require HTTP server
config-enable-http-server = true
config-enable-http-server = true
...
...
software/erp5testnode/testsuite/deploy-test/instance.cfg.in
View file @
94324cfb
...
@@ -48,8 +48,6 @@ context =
...
@@ -48,8 +48,6 @@ context =
raw bin_directory ${buildout:bin-directory}
raw bin_directory ${buildout:bin-directory}
raw in_vm_test_script ${deploy-script-controller-script:location}
raw in_vm_test_script ${deploy-script-controller-script:location}
raw in_vm_test_script_md5 ${deploy-script-controller-script:md5sum}
raw in_vm_test_script_md5 ${deploy-script-controller-script:md5sum}
raw waittime ${deploy-script-controller-script:waittime}
raw tries ${deploy-script-controller-script:tries}
section test_image_repository test-image-repository
section test_image_repository test-image-repository
[test-image-repository]
[test-image-repository]
...
...
software/erp5testnode/testsuite/deploy-test/software.cfg
View file @
94324cfb
...
@@ -43,9 +43,6 @@ output = ${buildout:directory}/template-original.kvm.cfg
...
@@ -43,9 +43,6 @@ output = ${buildout:directory}/template-original.kvm.cfg
[deploy-script-controller-script]
[deploy-script-controller-script]
location = ${:_profile_base_location_}/${:filename}
location = ${:_profile_base_location_}/${:filename}
# configuration
waittime = 360
tries = 80
[standalone-local-playbook]
[standalone-local-playbook]
filename = standalone-local-playbook
filename = standalone-local-playbook
...
...
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