forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Roman Mohr <[email protected]>
- Loading branch information
Showing
16 changed files
with
218 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ cluster/local/certs | |
**.pem | ||
**.crt | ||
**.csr | ||
_out |
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM fedora:27 | ||
|
||
ENV LIBVIRT_VERSION 3.7.0 | ||
|
||
RUN dnf -y install libvirt-devel-${LIBVIRT_VERSION} make git mercurial sudo gcc findutils gradle rsync-daemon rsync && \ | ||
dnf -y clean all | ||
|
||
ENV GIMME_GO_VERSION=1.9.2 | ||
|
||
RUN mkdir -p /gimme && curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | HOME=/gimme bash >> /etc/profile.d/gimme.sh | ||
|
||
ENV GOPATH="/go" GOBIN="/usr/bin" | ||
|
||
ADD rsyncd.conf /etc/rsyncd.conf | ||
|
||
RUN \ | ||
mkdir -p /go && \ | ||
source /etc/profile.d/gimme.sh && \ | ||
go get github.com/mattn/goveralls && \ | ||
go get -u github.com/Masterminds/glide && \ | ||
go get golang.org/x/tools/cmd/goimports && \ | ||
go get -u mvdan.cc/sh/cmd/shfmt && \ | ||
go get -u github.com/golang/mock/gomock && \ | ||
go get -u github.com/rmohr/mock/mockgen && \ | ||
go get -u github.com/rmohr/go-swagger-utils/swagger-doc && \ | ||
go get -u github.com/onsi/ginkgo/ginkgo && \ | ||
go get -u k8s.io/code-generator/cmd/deepcopy-gen && \ | ||
go get -u k8s.io/code-generator/cmd/defaulter-gen | ||
|
||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT [ "/entrypoint.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,5 @@ | ||
#!/bin/bash | ||
|
||
source /etc/profile.d/gimme.sh | ||
export GOPATH="/root/go" | ||
"$@" |
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,14 @@ | ||
gid = 0 | ||
uid = 0 | ||
log file = /dev/stdout | ||
reverse lookup = no | ||
[build] | ||
hosts allow = * | ||
read only = false | ||
path = /root/go/src/kubevirt.io/kubevirt/ | ||
comment = input sources | ||
[out] | ||
hosts allow = * | ||
read only = false | ||
path = /root/go/src/kubevirt.io/kubevirt/_out | ||
comment = build output |
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,51 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DIR="$( | ||
cd "$(dirname "$0")" | ||
pwd | ||
)" | ||
DOCKER_DIR=${DIR}/docker-builder | ||
KUBEVIRT_DIR="$( | ||
cd "$DIR/../" | ||
pwd | ||
)" | ||
|
||
BUILDER=${BUILDER_NAME:-kubevirtbuilder} | ||
RSYNCD_PORT=${RSYNCD_PORT:-10873} | ||
|
||
# Build the build container | ||
(cd ${DOCKER_DIR} && docker build . -q -t ${BUILDER}) | ||
|
||
# Create the persistent docker volume | ||
if [ -z "$(docker volume list | grep ${BUILDER})" ]; then | ||
docker volume create --name ${BUILDER} | ||
fi | ||
|
||
# Make sure that the output directory exists | ||
docker run -v "${BUILDER}:/root:rw,z" --rm -it ${BUILDER} mkdir -p /root/go/src/kubevirt.io/kubevirt/_out | ||
|
||
# Start an rsyncd instance and make sure it gets stopped after the script exits | ||
RSYNC_CID=$(docker run -d -v "${BUILDER}:/root:rw,z" -p 127.0.0.1:${RSYNCD_PORT}:873 ${BUILDER} /usr/bin/rsync --no-detach --daemon --verbose) | ||
function finish() { | ||
docker stop ${RSYNC_CID} | ||
docker rm ${RSYNC_CID} | ||
} | ||
trap finish EXIT | ||
# TODO really check if rsyncd comes up. For now just give it some time to come up | ||
sleep 1 | ||
|
||
_rsync() { | ||
rsync -avl "$@" | ||
} | ||
|
||
# Copy kubevirt into the persistent docker volume | ||
_rsync --delete --exclude '.glide*' --exclude "cluster/vagrant/.kubeconfig" --exclude "cluster/vagrant/.kubectl" --exclude "vendor" --exclude "_out" --exclude ".vagrant" ${KUBEVIRT_DIR}/ "rsync://[email protected]:${RSYNCD_PORT}/build" | ||
|
||
# Run the command | ||
docker run --rm -v "${BUILDER}:/root:rw,z" -w "/root/go/src/kubevirt.io/kubevirt" -it ${BUILDER} "$@" | ||
|
||
# Copy the whole kubevirt data out to get generated sources and formatting changes | ||
_rsync --exclude '.glide*' --exclude "vendor" --exclude "_out" --exclude ".vagrant" --exclude ".git" "rsync://[email protected]:${RSYNCD_PORT}/build" ${KUBEVIRT_DIR}/ | ||
# Copy the build output out of the container, make sure that _out exactly matches the build result | ||
_rsync --delete "rsync://[email protected]:${RSYNCD_PORT}/out" $KUBEVIRT_DIR/_out |
Oops, something went wrong.