-
Notifications
You must be signed in to change notification settings - Fork 181
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
Build versioned v2plugin from versioned binaries #1040
Changes from all commits
3215ee1
0ce1f51
f750f16
13fcf40
ca1b582
8446866
be82f8c
a86597d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# we want to get the git commit SHA but not all the binary repo data | ||
.git/objects/pack | ||
bin/ | ||
**/*.pyc | ||
.vagrant | ||
vagrant/ | ||
docs/ | ||
scripts/gobgp | ||
# this is the dockerfile for binary compilation, other dockerfiles | ||
# may want archive artifacts, but this one does not | ||
*.tar | ||
**/*.tar.gz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same on this guy |
||
*.bz2 | ||
# export from a docker container, no need to copy into any docker containers | ||
install/v2plugin/rootfs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,12 @@ RUN mkdir -p /run/docker/plugins /etc/openvswitch /var/run/contiv/log \ | |
&& wget https://github.com/andyshinn/alpine-pkg-glibc/releases/download/2.23-r1/glibc-2.23-r1.apk \ | ||
&& apk --no-cache add glibc-2.23-r1.apk | ||
|
||
COPY netplugin netmaster netctl startcontiv.sh / | ||
# copy in binaries and scripts | ||
ARG TAR_FILE | ||
ADD ${TAR_FILE} / | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're copying local files, use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the ADD exploded the tar file, I'd have to create another layer for a RUN to expand, there is nothing suggesting deprecation on the docs: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, right. "TAR_FILE" lol (used to looking for .tar.gz and so on) 😂 |
||
COPY startcontiv.sh / | ||
|
||
# this container is never run, it is exported for docker to run as a plugin, | ||
# the startcontiv.sh script and the netplugin binaries are copied into the | ||
# plugin's rootfs after export, this avoids copying into and out of container | ||
ENTRYPOINT ["/startcontiv.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Script to create the docker v2 plugin | ||
# run this script from contiv/netplugin directory | ||
|
||
echo "Creating rootfs for v2plugin ", ${CONTIV_V2PLUGIN_NAME} | ||
rm -rf install/v2plugin/rootfs | ||
rm install/v2plugin/config.json | ||
cat install/v2plugin/config.template | grep -v "##" > install/v2plugin/config.json | ||
sed -i "s%PluginName%${CONTIV_V2PLUGIN_NAME}%" install/v2plugin/config.json | ||
cp bin/netplugin bin/netmaster bin/netctl install/v2plugin | ||
docker build -t contivrootfs install/v2plugin | ||
id=$(docker create contivrootfs true) | ||
mkdir -p install/v2plugin/rootfs | ||
sudo docker export "${id}" | sudo tar -x -C install/v2plugin/rootfs | ||
# requires NETPLUGIN_CONTAINER_TAG for contivrootfs image | ||
# requires CONTIV_V2PLUGIN_NAME, the Network Driver name for requests to | ||
# dockerd, should look like contiv/v2plugin:$NETPLUGIN_CONTAINER_TAG | ||
# requires TAR_FILE to point to the netplugin binaries | ||
# requires V2PLUGIN_TAR_FILENAME to point to the v2plugin archive | ||
|
||
set -euxo pipefail | ||
|
||
echo "Creating rootfs for v2plugin: ${CONTIV_V2PLUGIN_NAME}" | ||
|
||
|
||
# config.json is docker's runtime configuration for the container | ||
# delete comments and replace placeholder with ${CONTIV_V2PLUGIN_NAME} | ||
sed '/##/d;s/__CONTIV_V2PLUGIN_NAME__/${CONTIV_V2PLUGIN_NAME}/' \ | ||
install/v2plugin/config.template > install/v2plugin/config.json | ||
|
||
# copy over binaries | ||
cp ${TAR_FILE} install/v2plugin/ | ||
|
||
DOCKER_IMAGE=contivrootfs:${NETPLUGIN_CONTAINER_TAG} | ||
docker build -t ${DOCKER_IMAGE} \ | ||
--build-arg TAR_FILE=$(basename "${TAR_FILE}") install/v2plugin | ||
|
||
rm install/v2plugin/${TAR_FILE} # this was a copy of netplugin archive | ||
|
||
# creates a ready to run container but doesn't run it | ||
id=$(docker create $DOCKER_IMAGE true) | ||
|
||
# create the rootfs archive based on the created container contents | ||
docker export "${id}" > install/v2plugin/${V2PLUGIN_TAR_FILENAME} | ||
|
||
# clean up created container | ||
docker rm -vf "${id}" | ||
docker rmi contivrootfs | ||
rm install/v2plugin/netplugin install/v2plugin/netmaster install/v2plugin/netctl | ||
|
||
echo netplugin\'s docker plugin rootfs is archived at install/v2plugin/${V2PLUGIN_TAR_FILENAME} |
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.
Forgot to mention this earlier... could you do a
git rm **/*.pyc
and see if anything is currently checked in which shouldn't be? Could also be in a separate PR