-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This enhances the integration test suite in a variety of ways: - Both minikube and KiND are now supported, and run in github actions - Tests run in their own namespace, which is intelligently cleaned up - Images are uploaded to a test backend via docker registry API - Buildkit is used to significantly speed up incremental image builds This commit also fixes a bug where failed jobs would not report their failure. Co-authored-by: Aaron Olson <[email protected]> Co-authored-by: Zeeshan Qureshi <[email protected]>
- Loading branch information
1 parent
2f2174a
commit b41eb65
Showing
13 changed files
with
810 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,37 @@ | ||
# syntax = docker/dockerfile:1.2 | ||
ARG bpftraceversion=v0.13.0 | ||
FROM quay.io/iovisor/bpftrace:$bpftraceversion as bpftrace | ||
|
||
FROM golang:1.15-buster as gobuilder | ||
ARG GIT_ORG=iovisor | ||
ENV GIT_ORG=$GIT_ORG | ||
RUN apt-get update | ||
RUN apt-get install -y make bash git | ||
RUN apt-get update && apt-get install -y make bash git && apt-get clean | ||
|
||
ADD . /go/src/github.com/iovisor/kubectl-trace | ||
WORKDIR /go/src/github.com/iovisor/kubectl-trace | ||
|
||
RUN make _output/bin/trace-runner | ||
# first copy the go mod files and sync the module cache as this step is expensive | ||
COPY go.* . | ||
RUN go mod download | ||
|
||
# Now copy the rest of the source code one by one | ||
# note any changes in any of these files or subdirectories is expected to bust the cache | ||
# We copy only the code directories, makefile, and git directory in order to prevent | ||
# busting the cache. Due to limitations in docker syntax, this must be done one-per-line | ||
COPY Makefile . | ||
COPY cmd cmd | ||
COPY pkg pkg | ||
|
||
# This buildkit feature reduces the build time from ~50s → 5s by preserving the compiler cache | ||
RUN --mount=type=cache,target=/root/.cache/go-build make _output/bin/trace-runner | ||
|
||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y xz-utils | ||
# Install CA certificates | ||
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates && apt-get clean | ||
|
||
COPY --from=gobuilder /go/src/github.com/iovisor/kubectl-trace/_output/bin/trace-runner /bin/trace-runner | ||
COPY --from=bpftrace /usr/bin/bpftrace /usr/bin/bpftrace | ||
COPY --from=gobuilder /go/src/github.com/iovisor/kubectl-trace/_output/bin/trace-runner /bin/trace-runner | ||
|
||
COPY /build/hooks/prestop /bin/hooks/prestop | ||
|
||
ENTRYPOINT ["/bin/trace-runner"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -uo pipefail | ||
|
||
if [[ "$#" -gt "1" ]]; then | ||
echo "usage: prestop [SLEEP_SECONDS]" | ||
exit 41 | ||
fi | ||
|
||
sleep_seconds=0 | ||
if [[ "$#" -eq "1" ]]; then | ||
sleep_seconds="$1" | ||
fi | ||
|
||
tpid=`pgrep --oldest trace-runner` | ||
if [[ -z "$tpid" ]]; then | ||
echo "could not find trace-runner" | ||
exit 21 | ||
fi | ||
|
||
cpid=`pgrep --oldest -P $tpid` | ||
if [[ -z "$cpid" ]]; then | ||
echo "could not find first child of trace-runner" | ||
exit 22 | ||
fi | ||
|
||
kill -SIGINT $cpid | ||
|
||
## Give some time to trace-runner to cleanup before pod kill timeout starts. | ||
sleep $sleep_seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.