Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4a65764c
Unverified
Commit
4a65764c
authored
Jul 27, 2019
by
Erik Wilson
Committed by
GitHub
Jul 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #682 from erikwilson/sonobuoy-logs-cleanup
Cleanup sonobuoy logging
parents
c86e9506
9452dec0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
27 deletions
+39
-27
sonobuoy
scripts/sonobuoy
+6
-17
sonobuoy-e2e-tests
scripts/sonobuoy-e2e-tests
+33
-10
No files found.
scripts/sonobuoy
View file @
4a65764c
...
...
@@ -87,32 +87,20 @@ export -f wait-for-services
# ---
haste
()
{
a
=
$(
cat
)
curl
-X
POST
-s
-d
"
$a
"
https://hastebin.com/documents |
\
awk
-F
'"'
'{print "https://hastebin.com/"$4}'
}
export
-f
haste
# ---
dump-container-logs
()
{
set
+xe
set
-v
mkdir
-p
${
LOGS
}
for
container
in
${
CONTAINERS
}
;
do
echo
"logs for container:
${
container
}
"
echo
" k3s service log: "
$(
docker logs
${
container
}
2>&1 | haste
)
echo
" containerd logs: "
$(
docker
cp
${
container
}
:/var/lib/rancher/k3s/agent/containerd/containerd.log - | haste
)
docker
cp
${
container
}
:/var/lib/rancher/k3s/agent/containerd/containerd.log
${
LOGS
}
/containerd-
${
container
}
.log
docker logs
${
container
}
>
${
LOGS
}
/
${
container
}
.log 2>&1
done
set
+v
set
-xe
}
export
-f
dump-container-logs
# ---
sonobuoy-destruct
()
{
sonobuoy logs
mkdir
-p
${
LOGS
}
sonobuoy logs
>
${
LOGS
}
/
$i
-sonobuoy
.log 2>&1
sonobuoy delete
--wait
}
export
-f
sonobuoy-destruct
...
...
@@ -179,6 +167,7 @@ trap cleanup EXIT
K3S_PORT
=
$(
timeout
--foreground
5s bash
-c
get-port
)
OUTPUT
=
$(
pwd
)
/sonobuoy-output/
${
K3S_PORT
}
LOGS
=
$(
pwd
)
/logs/
$$
E2E
=
"
${
OUTPUT
}
/e2e"
E2E_LOG
=
"plugins/e2e/results/e2e.log"
RESULTS
=
"
${
E2E
}
/
${
E2E_LOG
}
"
...
...
scripts/sonobuoy-e2e-tests
View file @
4a65764c
...
...
@@ -3,15 +3,6 @@ set -e -x
cd
$(
dirname
$0
)
/..
cleanup
()
{
exit_code
=
$?
set
+e
wait
echo
"Finished the tests!"
exit
${
exit_code
}
}
trap
cleanup EXIT
if
[
-z
"
$K3S_IMAGE
"
]
;
then
source
$(
dirname
$0
)
/version.sh
TAG
=
${
TAG
:-${
VERSION
}${
SUFFIX
}}
...
...
@@ -32,7 +23,6 @@ run-sonobuoy() {
pids+
=(
$!
)
}
log_output
=
${
OUTPUT
}
/e2e-STATUS-
${
ARCH
}
-parallel
.log
\
run-sonobuoy
--e2e-focus
=
'\[Conformance\]'
--e2e-skip
=
'\[Serial\]'
--e2e-parallel
=
y
...
...
@@ -41,6 +31,39 @@ sleep 60
log_output
=
${
OUTPUT
}
/e2e-STATUS-
${
ARCH
}
-serial
.log
\
run-sonobuoy
--e2e-focus
=
'\[Serial\].*\[Conformance\]'
show-logs
()
{
for
pid
in
"
${
pids
[@]
}
"
;
do
logdir
=
$(
pwd
)
/logs/
${
pid
}
if
[
!
-d
$logdir
]
;
then
continue
fi
echo
echo
"#- Begin: logs for sonobuoy run pid
${
pid
}
"
for
log
in
$(
pwd
)
/logs/
${
pid
}
/
*
;
do
if
[
-f
${
log
}
]
;
then
echo
echo
"#- Start:
${
log
}
"
cat
${
log
}
echo
"#- End:
${
log
}
"
echo
fi
done
echo
"#- Finish: logs for sonobuoy run pid
${
pid
}
"
echo
done
}
cleanup
()
{
exit_status
=
$?
set
+e +x
wait
echo
"Finished the tests!"
if
[
"
${
exit_status
}
"
-ne
"0"
]
;
then
show-logs
fi
exit
${
exit_status
}
}
trap
cleanup EXIT
for
pid
in
"
${
pids
[@]
}
"
;
do
wait
$pid
||
exit
$?
...
...
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