Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store KinD logs artifact in E2E tests #1250

Merged
merged 14 commits into from
Jan 24, 2020
Merged

Store KinD logs artifact in E2E tests #1250

merged 14 commits into from
Jan 24, 2020

Conversation

nfnt
Copy link
Member

@nfnt nfnt commented Jan 7, 2020

What this PR does / why we need it:
Updates the CI configuration to storage the cluster logs as tarball. This allows us to better debug CI failures like, e.g., #1235.

@nfnt
Copy link
Member Author

nfnt commented Jan 7, 2020

Oh, it isn't that easy, because these test are run in a separate container and we can't access its contents. Have to find a different approach to not use test/Dockerfile.

@nfnt nfnt force-pushed the nfnt/e2e-test-store-logs branch 3 times, most recently from 7616e40 to 9a21216 Compare January 8, 2020 09:50
@nfnt
Copy link
Member Author

nfnt commented Jan 8, 2020

By copying the cluster logs from the exited container using docker cp, it is possible to retrieve them in the CI.
E2E test artifacts

test/run_tests.sh Outdated Show resolved Hide resolved
@nfnt nfnt requested a review from ANeumann82 January 8, 2020 14:37
Copy link
Member

@ANeumann82 ANeumann82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first question that springs to my mind is - why not just put the logs into a directory mounted into the container with -v, all the more since we already use this mechanism to expose the reports directory?

Your approach would also work but strikes me as a lot of complexity (random string generation, explicit container name, explicit imperative cleanup, potentially fragile manipulation of kudo-e2e-test.yaml) that could be easily avoided.


# "TARGET" is a Makefile target that runs tests
TARGET=$1

INTEGRATION_OUTPUT_JUNIT=${INTEGRATION_OUTPUT_JUNIT:-false}

CONTAINER_POSTFIX=$(< /dev/urandom base64 | tr -dc '[:alpha:]' | head -c 8 || true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, do we really want to continue if this is too short (possibly empty)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid a SIGPIPE.

test/run_tests.sh Outdated Show resolved Hide resolved
test/run_tests.sh Outdated Show resolved Hide resolved
test/run_tests.sh Outdated Show resolved Hide resolved
test/run_tests.sh Outdated Show resolved Hide resolved
@nfnt
Copy link
Member Author

nfnt commented Jan 9, 2020

@porridge Yeah, mounting a directory seems to be the easiest approach, I somehow didn't see that we already do this for the reports.

@nfnt nfnt force-pushed the nfnt/e2e-test-store-logs branch 3 times, most recently from 726ce0d to d594436 Compare January 10, 2020 10:12
Co-Authored-By: Marcin Owsiany <mowsiany@D2iQ.com>
@nfnt
Copy link
Member Author

nfnt commented Jan 10, 2020

Mounting directories didn't work due to file permission issues. I'm keeping the docker cp approach.

@nfnt nfnt requested a review from porridge January 10, 2020 10:40
@porridge
Copy link
Member

I ran some experiments, and it turns out that circleci runs the job as user circleci which does not have access to some of the log files which kind creates.

A strategically placed recursive chmod in run_tests.sh is enough to make it work, though.

Could I convince you to go back to the path of exposing these with -v? Apart from being less complex, this would fix the file access issue for any other user of this script...

@nfnt
Copy link
Member Author

nfnt commented Jan 22, 2020

@porridge Thanks for looking into this! I'll change this to directory mounts & chmod.

@nfnt
Copy link
Member Author

nfnt commented Jan 22, 2020

@porridge Log collection is now using a mounted folder, ptal.

Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason you're telling CircleCi to store the tarball, rather than directly the directory with logs?

test/run_tests.sh Outdated Show resolved Hide resolved
test/run_tests.sh Show resolved Hide resolved
Jan Schlicht and others added 2 commits January 24, 2020 09:55
Co-Authored-By: Marcin Owsiany <mowsiany@D2iQ.com>
@nfnt
Copy link
Member Author

nfnt commented Jan 24, 2020

@porridge It's a tarball because when debugging you usually have to look at multiple files to figure out what's wrong. Better have them all at once.

@nfnt nfnt merged commit 9fb5fcd into master Jan 24, 2020
@nfnt nfnt deleted the nfnt/e2e-test-store-logs branch January 24, 2020 09:54
@porridge
Copy link
Member

@porridge It's a tarball because when debugging you usually have to look at multiple files to figure out what's wrong. Better have them all at once.

So you cannot browse their content within CircleCI UI? Download only?

ANeumann82 pushed a commit that referenced this pull request Feb 13, 2020
Co-Authored-By: Marcin Owsiany <mowsiany@D2iQ.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
runyontr pushed a commit that referenced this pull request Mar 11, 2020
Co-Authored-By: Marcin Owsiany <mowsiany@D2iQ.com>
Signed-off-by: Thomas Runyon <runyontr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants