-
Notifications
You must be signed in to change notification settings - Fork 16
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
systemtests now run completely in containers #46
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM ubuntu:16.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get -y upgrade && \ | ||
apt-get -y install curl build-essential docker.io | ||
|
||
RUN curl -O https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz | ||
RUN tar -C /usr/local -xzf go1.7.4.linux-amd64.tar.gz && rm go1.7.4.linux-amd64.tar.gz | ||
|
||
ENV PATH="/usr/local/go/bin:$PATH" | ||
ENV GOPATH="/go" | ||
|
||
RUN mkdir -p /go/src/github.com/contiv/ccn_proxy | ||
|
||
WORKDIR /go/src/github.com/contiv/ccn_proxy | ||
|
||
ENTRYPOINT ["/bin/bash"] |
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,20 +1,7 @@ | ||
FROM ubuntu:16.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get -y upgrade && \ | ||
apt-get -y install curl build-essential docker.io | ||
|
||
RUN curl -O https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz | ||
RUN tar -C /usr/local -xzf go1.7.4.linux-amd64.tar.gz && rm go1.7.4.linux-amd64.tar.gz | ||
|
||
ENV PATH="/usr/local/go/bin:$PATH" | ||
ENV GOPATH="/go" | ||
FROM ccn_proxy_build_base | ||
|
||
COPY ./ /go/src/github.com/contiv/ccn_proxy | ||
|
||
WORKDIR /go/src/github.com/contiv/ccn_proxy | ||
|
||
RUN scripts/build-in-container.sh | ||
|
||
ENTRYPOINT ["docker", "build"] |
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,9 @@ | ||
FROM ccn_proxy_build_base | ||
|
||
RUN go get github.com/gordonklaus/ineffassign | ||
RUN go get github.com/golang/lint/golint | ||
RUN go get github.com/fzipp/gocyclo | ||
RUN go get github.com/client9/misspell/... | ||
RUN go get github.com/remyoudompheng/go-misc/deadcode/... | ||
|
||
ENTRYPOINT ["/bin/bash", "./scripts/checks_in_container.sh"] |
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,9 @@ | ||
FROM ccn_proxy_build_base | ||
|
||
# go-check must be installed to run systemtests | ||
RUN go get gopkg.in/check.v1 | ||
|
||
COPY ./ /go/src/github.com/contiv/ccn_proxy | ||
|
||
ENTRYPOINT ["/bin/bash"] | ||
#, "./scripts/systemtests_in_container.sh"] |
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,85 +1,14 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -e | ||
set -euo pipefail | ||
|
||
dirs=$(go list ./... | sed -e 's!github.com/contiv/ccn_proxy!.!g' | grep -v ./vendor) | ||
files=$(find . -type f -name '*.go' | grep -v ./vendor) | ||
CHECKS_CONTAINER_NAME="ccn_proxy_checks" | ||
|
||
echo "Running gofmt..." | ||
set +e | ||
out=$(gofmt -s -l ${files}) | ||
set -e | ||
# gofmt can include empty lines in its output | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "gofmt errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
docker build -t "ccn_proxy_build_base" -f ./build/Dockerfile.base . | ||
docker build -t $CHECKS_CONTAINER_NAME -f ./build/Dockerfile.checks . | ||
|
||
echo "Running ineffassign..." | ||
[ -n "`which ineffassign`" ] || go get github.com/gordonklaus/ineffassign | ||
for i in ${dirs} | ||
do | ||
ineffassign $i | ||
done | ||
|
||
echo "Running golint..." | ||
[ -n "`which golint`" ] || go get github.com/golang/lint/golint | ||
set +e | ||
out=$(golint ./... | grep -vE '^vendor') | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "golint errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running govet..." | ||
set +e | ||
out=$(go tool vet -composites=false ${dirs} 2>&1 | grep -v vendor) | ||
set -e | ||
|
||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "go vet errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running gocyclo..." | ||
[ -n "`which gocyclo`" ] || go get github.com/fzipp/gocyclo | ||
set +e | ||
out=$(gocyclo -over 15 . | grep -v vendor) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "gocycle errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running misspell..." | ||
[ -n "`which misspell`" ] || go get github.com/client9/misspell/... | ||
set +e | ||
out=$(misspell -locale US -error -i exportfs ${files}) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "misspell errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running deadcode..." | ||
[ -n "`which deadcode`" ] || go get github.com/remyoudompheng/go-misc/deadcode/... | ||
set +e | ||
out=$(deadcode ${dirs} 2>&1) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "deadcode errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
# the ccn_proxy directory exists in the base image, but it's empty so we'll | ||
# bindmount the current directory into it. | ||
docker run --rm \ | ||
-v $(pwd):/go/src/github.com/contiv/ccn_proxy:ro \ | ||
$CHECKS_CONTAINER_NAME |
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,82 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export PATH="/go/bin:$PATH" | ||
|
||
dirs=$(go list ./... | sed -e 's!github.com/contiv/ccn_proxy!.!g' | grep -v ./vendor) | ||
files=$(find . -type f -name '*.go' | grep -v ./vendor) | ||
|
||
echo "Running gofmt..." | ||
set +e | ||
out=$(gofmt -s -l ${files}) | ||
set -e | ||
# gofmt can include empty lines in its output | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "gofmt errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running ineffassign..." | ||
for i in ${dirs} | ||
do | ||
ineffassign $i | ||
done | ||
|
||
echo "Running golint..." | ||
set +e | ||
out=$(golint ./... | grep -vE '^vendor') | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "golint errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running govet..." | ||
set +e | ||
out=$(go tool vet -composites=false ${dirs} 2>&1 | grep -v vendor) | ||
set -e | ||
|
||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "go vet errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running gocyclo..." | ||
set +e | ||
out=$(gocyclo -over 15 . | grep -v vendor) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "gocyclo errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running misspell..." | ||
set +e | ||
out=$(misspell -locale US -error -i exportfs ${files}) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "misspell errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi | ||
|
||
echo "Running deadcode..." | ||
set +e | ||
out=$(deadcode ${dirs} 2>&1) | ||
set -e | ||
if [ "`echo \"${out}\" | sed '/^$/d' | wc -l`" -gt 0 ] | ||
then | ||
echo 1>&2 "deadcode errors in:" | ||
echo 1>&2 "${out}" | ||
exit 1 | ||
fi |
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will having this local save us some CI headaches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking that we put it into the repo itself? This will permanently increase the size of the repo by ~70mb for each version we upgrade to, and Github will start yelling at us and telling us to use their Large File Storage service 🙃
Also because we
COPY
the whole repo into our build container, it'll slow down almost every Docker-related operation we do here... 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points :) Ignore the suggestion. I wish we could build and push this to docker hub once and reuse it, though docker pull has its reliability issues too.