Initial commit

This commit is contained in:
Ria Bhatia
2017-12-04 13:32:57 -06:00
committed by Erik St. Martin
commit 0075e5b0f3
9056 changed files with 2523100 additions and 0 deletions

146
vendor/github.com/hyperhq/hypercli/hack/.vendor-helpers.sh generated vendored Executable file
View File

@@ -0,0 +1,146 @@
#!/usr/bin/env bash
PROJECT=github.com/docker/docker
# Downloads dependencies into vendor/ directory
mkdir -p vendor
if ! go list github.com/docker/docker/docker &> /dev/null; then
rm -rf .gopath
mkdir -p .gopath/src/github.com/docker
ln -sf ../../../.. .gopath/src/${PROJECT}
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
fi
export GOPATH="$GOPATH:${PWD}/vendor"
find='find'
if [ "$(go env GOHOSTOS)" = 'windows' ]; then
find='/usr/bin/find'
fi
clone() {
local vcs="$1"
local pkg="$2"
local rev="$3"
local url="$4"
: ${url:=https://$pkg}
local target="vendor/src/$pkg"
echo -n "$pkg @ $rev: "
if [ -d "$target" ]; then
echo -n 'rm old, '
rm -rf "$target"
fi
echo -n 'clone, '
case "$vcs" in
git)
git clone --quiet --no-checkout "$url" "$target"
( cd "$target" && git checkout --quiet "$rev" && git reset --quiet --hard "$rev" )
;;
hg)
hg clone --quiet --updaterev "$rev" "$url" "$target"
;;
esac
echo -n 'rm VCS, '
( cd "$target" && rm -rf .{git,hg} )
echo -n 'rm vendor, '
( cd "$target" && rm -rf vendor Godeps/_workspace )
echo done
}
# get an ENV from the Dockerfile with support for multiline values
_dockerfile_env() {
local e="$1"
awk '
$1 == "ENV" && $2 == "'"$e"'" {
sub(/^ENV +([^ ]+) +/, "");
inEnv = 1;
}
inEnv {
if (sub(/\\$/, "")) {
printf "%s", $0;
next;
}
print;
exit;
}
' ${DOCKER_FILE:="Dockerfile"}
}
clean() {
local packages=(
"${PROJECT}/docker" # package main
"${PROJECT}/integration-cli" # external tests
)
local dockerPlatforms=( ${DOCKER_ENGINE_OSARCH:="linux/amd64"} $(_dockerfile_env DOCKER_CROSSPLATFORMS) )
local dockerBuildTags="$(_dockerfile_env DOCKER_BUILDTAGS)"
local buildTagCombos=(
''
'experimental'
'pkcs11'
"$dockerBuildTags"
"daemon $dockerBuildTags"
"daemon cgo $dockerBuildTags"
"experimental $dockerBuildTags"
"experimental daemon $dockerBuildTags"
"experimental daemon cgo $dockerBuildTags"
"pkcs11 $dockerBuildTags"
"pkcs11 daemon $dockerBuildTags"
"pkcs11 daemon cgo $dockerBuildTags"
)
echo
echo -n 'collecting import graph, '
local IFS=$'\n'
local imports=( $(
for platform in "${dockerPlatforms[@]}"; do
export GOOS="${platform%/*}";
export GOARCH="${platform##*/}";
for buildTags in "${buildTagCombos[@]}"; do
go list -e -tags "$buildTags" -f '{{join .Deps "\n"}}' "${packages[@]}"
go list -e -tags "$buildTags" -f '{{join .TestImports "\n"}}' "${packages[@]}"
done
done | grep -vE "^${PROJECT}" | sort -u
) )
imports=( $(go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' "${imports[@]}") )
unset IFS
echo -n 'pruning unused packages, '
findArgs=(
# This directory contains only .c and .h files which are necessary
-path vendor/src/github.com/mattn/go-sqlite3/code
)
for import in "${imports[@]}"; do
[ "${#findArgs[@]}" -eq 0 ] || findArgs+=( -or )
findArgs+=( -path "vendor/src/$import" )
done
local IFS=$'\n'
local prune=( $($find vendor -depth -type d -not '(' "${findArgs[@]}" ')') )
unset IFS
for dir in "${prune[@]}"; do
$find "$dir" -maxdepth 1 -not -type d -not -name 'LICENSE*' -not -name 'COPYING*' -exec rm -v -f '{}' ';'
rmdir "$dir" 2>/dev/null || true
done
echo -n 'pruning unused files, '
$find vendor -type f -name '*_test.go' -exec rm -v '{}' ';'
echo done
}
# Fix up hard-coded imports that refer to Godeps paths so they'll work with our vendoring
fix_rewritten_imports () {
local pkg="$1"
local remove="${pkg}/Godeps/_workspace/src/"
local target="vendor/src/$pkg"
echo "$pkg: fixing rewritten imports"
$find "$target" -name \*.go -exec sed -i -e "s|\"${remove}|\"|g" {} \;
}

View File

@@ -0,0 +1,241 @@
# Jenkins CI script for Windows to Linux CI.
# Heavily modified by John Howard (@jhowardmsft) December 2015 to try to make it more reliable.
set +x
SCRIPT_VER="4-Jan-2016 15:19 PST"
# TODO to make (even) more resilient:
# - Check if jq is installed
# - Make sure bash is v4.3 or later. Can't do until all Azure nodes on the latest version
# - Make sure we are not running as local system. Can't do until all Azure nodes are updated.
# - Error if docker versions are not equal. Can't do until all Azure nodes are updated
# - Error if go versions are not equal. Can't do until all Azure nodes are updated.
# - Error if running 32-bit posix tools. Probably can take from bash --version and check contains "x86_64"
# - Warn if the CI directory cannot be deleted afterwards. Otherwise turdlets are left behind
# - Use %systemdrive% ($SYSTEMDRIVE) rather than hard code to c: for TEMP
# - Consider cross builing the Windows binary and copy across. That's a bit of a heavy lift. Only reason
# for doing that is that it mirrors the actual release process for docker.exe which is cross-built.
# However, should absolutely not be a problem if built natively, so nit-picking.
# - Tidy up of images and containers. Either here, or in the teardown script.
ec=0
echo INFO: Started at `date`. Script version $SCRIPT_VER
# get the ip
ip="${DOCKER_HOST#*://}"
ip="${ip%%:*}"
# make sure it is the right DOCKER_HOST. No, this is not a typo, it really
# is at port 2357. This is the daemon which is running on the Linux host.
# The way CI works is to launch a second daemon, docker-in-docker, which
# listens on port 2375 and is built from sources matching the PR. That's the
# one which is tested against.
export DOCKER_HOST="tcp://$ip:2357"
# Save for use by make.sh and scripts it invokes
export MAIN_DOCKER_HOST="$DOCKER_HOST"
# Verify we can get the remote node to respond to _ping
if [ $ec -eq 0 ]; then
reply=`curl -s http://$ip:2357/_ping`
if [ "$reply" != "OK" ]; then
ec=1
echo "ERROR: Failed to get OK response from Linux node at $ip:2357. It may be down."
echo " Try re-running this CI job, or ask on #docker-dev or #docker-maintainers"
echo " to see if the node is up and running."
echo
echo "Regular ping output for remote host below. It should reply. If not, it needs restarting."
ping $ip
else
echo "INFO: The Linux nodes outer daemon replied to a ping. Good!"
fi
fi
# Get the version from the remote node. Note this may fail if jq is not installed.
# That's probably worth checking to make sure, just in case.
if [ $ec -eq 0 ]; then
remoteVersion=`curl -s http://$ip:2357/version | jq -c '.Version'`
echo "INFO: Remote daemon is running docker version $remoteVersion"
fi
# Compare versions. We should really fail if result is no 1. Output at end of script.
if [ $ec -eq 0 ]; then
uniques=`docker version | grep Version | /usr/bin/sort -u | wc -l`
fi
# Make sure we are in repo
if [ $ec -eq 0 ]; then
if [ ! -d hack ]; then
echo "ERROR: Are you sure this is being launched from a the root of docker repository?"
echo " If this is a Windows CI machine, it should be c:\jenkins\gopath\src\github.com\docker\docker."
echo " Current directory is `pwd`"
ec=1
fi
fi
# Get the commit has and verify we have something
if [ $ec -eq 0 ]; then
export COMMITHASH=$(git rev-parse --short HEAD)
echo INFO: Commmit hash is $COMMITHASH
if [ -z $COMMITHASH ]; then
echo "ERROR: Failed to get commit hash. Are you sure this is a docker repository?"
ec=1
fi
fi
# Redirect to a temporary location. Check is here for local runs from Jenkins machines just in case not
# in the right directory where the repo is cloned. We also redirect TEMP to not use the environment
# TEMP as when running as a standard user (not local system), it otherwise exposes a bug in posix tar which
# will cause CI to fail from Windows to Linux. Obviously it's not best practice to ever run as local system...
if [ $ec -eq 0 ]; then
export TEMP=/c/CI/CI-$COMMITHASH
export TMP=$TMP
/usr/bin/mkdir -p $TEMP # Make sure Linux mkdir for -p
fi
# Tidy up time
if [ $ec -eq 0 ]; then
echo INFO: Deleting pre-existing containers and images...
# Force remove all containers based on a previously built image with this commit
! docker rm -f $(docker ps -aq --filter "ancestor=docker:$COMMITHASH") &>/dev/null
# Force remove any container with this commithash as a name
! docker rm -f $(docker ps -aq --filter "name=docker-$COMMITHASH") &>/dev/null
# Force remove the image if it exists
! docker rmi -f "docker-$COMMITHASH" &>/dev/null
# This SHOULD never happen, but just in case, also blow away any containers
# that might be around.
! if [ ! `docker ps -aq | wc -l` -eq 0 ]; then
echo WARN: There were some leftover containers. Cleaning them up.
! docker rm -f $(docker ps -aq)
fi
fi
# Provide the docker version for debugging purposes. If these fail, game over.
# as the Linux box isn't responding for some reason.
if [ $ec -eq 0 ]; then
echo INFO: Docker version and info of the outer daemon on the Linux node
echo
docker version
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: The main linux daemon does not appear to be running. Has the Linux node crashed?"
fi
echo
fi
# Same as above, but docker info
if [ $ec -eq 0 ]; then
echo
docker info
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: The main linux daemon does not appear to be running. Has the Linux node crashed?"
fi
echo
fi
# build the daemon image
if [ $ec -eq 0 ]; then
echo "INFO: Running docker build on Linux host at $DOCKER_HOST"
set -x
docker build --rm --force-rm -t "docker:$COMMITHASH" .
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: docker build failed"
fi
fi
# Start the docker-in-docker daemon from the image we just built
if [ $ec -eq 0 ]; then
echo "INFO: Starting build of a Linux daemon to test against, and starting it..."
set -x
docker run --pid host --privileged -d --name "docker-$COMMITHASH" --net host "docker:$COMMITHASH" bash -c 'echo "INFO: Compiling" && date && hack/make.sh binary && echo "INFO: Compile complete" && date && cp bundles/$(cat VERSION)/binary/docker /bin/docker && echo "INFO: Starting daemon" && exec docker daemon -D -H tcp://0.0.0.0:2375'
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: Failed to compile and start the linux daemon"
fi
fi
# Build locally.
if [ $ec -eq 0 ]; then
echo "INFO: Starting local build of Windows binary..."
set -x
export TIMEOUT="120m"
export DOCKER_HOST="tcp://$ip:2375"
export DOCKER_TEST_HOST="tcp://$ip:2375"
unset DOCKER_CLIENTONLY
export DOCKER_REMOTE_DAEMON=1
hack/make.sh binary
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: Build of binary on Windows failed"
fi
fi
# Make a local copy of the built binary and ensure that is first in our path
if [ $ec -eq 0 ]; then
VERSION=$(< ./VERSION)
cp bundles/$VERSION/binary/docker.exe $TEMP
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: Failed to copy built binary to $TEMP"
fi
export PATH=$TEMP:$PATH
fi
# Run the integration tests
if [ $ec -eq 0 ]; then
echo "INFO: Running Integration tests..."
set -x
hack/make.sh test-integration-cli
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: CLI test failed."
# Next line is useful, but very long winded if included
# docker -H=$MAIN_DOCKER_HOST logs "docker-$COMMITHASH"
fi
fi
# Tidy up any temporary files from the CI run
if [ ! -z $COMMITHASH ]; then
rm -rf $TEMP
fi
# CI Integrity check - ensure we are using the same version of go as present in the Dockerfile
GOVER_DOCKERFILE=`grep 'ENV GO_VERSION' Dockerfile | awk '{print $3}'`
GOVER_INSTALLED=`go version | awk '{print $3}'`
if [ "${GOVER_INSTALLED:2}" != "$GOVER_DOCKERFILE" ]; then
ec=1 # Uncomment to make CI fail once all nodes are updated.
echo
echo "---------------------------------------------------------------------------"
echo "ERROR: CI should be using go version $GOVER_DOCKERFILE, but is using ${GOVER_INSTALLED:2}"
echo " This is currently a warning, but should (will) become an error in the future."
echo "---------------------------------------------------------------------------"
echo
fi
# Check the Linux box is running a matching version of docker
if [ "$uniques" -ne 1 ]; then
ec=1 # Uncomment to make CI fail once all nodes are updated.
echo
echo "---------------------------------------------------------------------------"
echo "ERROR: This CI node is not running the same version of docker as the daemon."
echo " This is a CI configuration issue"
echo "---------------------------------------------------------------------------"
echo
fi
# Tell the user how we did.
if [ $ec -eq 0 ]; then
echo INFO: Completed successfully at `date`.
else
echo ERROR: Failed with exitcode $ec at `date`.
fi
exit $ec

View File

@@ -0,0 +1,3 @@
These files under this directory are for reference only.
They are used by Jenkins for CI runs.

33
vendor/github.com/hyperhq/hypercli/hack/dind generated vendored Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -e
# DinD: a wrapper script which allows docker to be run inside a docker container.
# Original version by Jerome Petazzoni <jerome@docker.com>
# See the blog post: https://blog.docker.com/2013/09/docker-can-now-run-within-docker/
#
# This script should be executed inside a docker container in privilieged mode
# ('docker run --privileged', introduced in docker 0.6).
# Usage: dind CMD [ARG...]
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
export container=docker
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
mount -t securityfs none /sys/kernel/security || {
echo >&2 'Could not mount /sys/kernel/security.'
echo >&2 'AppArmor detection and --privileged mode might break.'
}
fi
# Mount /tmp (conditionally)
if ! mountpoint -q /tmp; then
mount -t tmpfs none /tmp
fi
if [ $# -gt 0 ]; then
exec "$@"
fi
echo >&2 'ERROR: No command specified.'
echo >&2 'You probably want to run hack/make.sh, or maybe a shell?'

15
vendor/github.com/hyperhq/hypercli/hack/generate-authors.sh generated vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."
# see also ".mailmap" for how email addresses and names are deduplicated
{
cat <<-'EOH'
# This file lists all individuals having contributed content to the repository.
# For how it is generated, see `hack/generate-authors.sh`.
EOH
echo
git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf
} > AUTHORS

View File

@@ -0,0 +1,64 @@
#!/bin/bash
if [ "${REGION}" == "" ];then
REGION="us-west-1"
fi
if [ "$@" != "./build.sh" ];then
#ensure config for hyper cli
mkdir -p ~/.hyper
cat > ~/.hyper/config.json <<EOF
{
"clouds": {
"${DOCKER_HOST}": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}"
},
"tcp://*.hyper.sh:443": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}",
"region": "${REGION}"
}
}
}
EOF
echo "##############################################################################################"
echo "## Welcome to integration test env ##"
echo "##############################################################################################"
#show config for hyper cli
echo "Current hyper config: ~/.hyper/config.json"
echo "----------------------------------------------------------------------------------------------"
cat ~/.hyper/config.json \
| sed 's/"secretkey":.*/"secretkey": "******************************",/g' \
| sed 's/"auth":.*/"auth": "******************************"/g'
echo "----------------------------------------------------------------------------------------------"
#show example
cat <<EOF
Run in container(example):
./build.sh # build hyper cli
-----------------------------------------------------------
hypercli info | grep "ID" # get tennat id
hypercli pull busybox # pull image
hypercli images # list images
-----------------------------------------------------------
cd integration-cli && go test # start autotest
# 'hypercli' is the alias of 'hyper --region \${DOCKER_HOST}'
EOF
fi
#execute command
if [ $# -ne 0 ];then
eval $@
if [ "$@" == "./build.sh" ];then
#show make result
if [ $? -eq 0 ];then
echo "OK:)"
else
echo "Failed:("
fi
fi
fi

View File

@@ -0,0 +1,113 @@
#!/bin/bash
env
if [ "${REGION}" == "" ];then
REGION="us-west-1"
fi
# set default value of DOCKER_HOST and BRANCH
if [[ "$DOCKER_HOST" == "" ]];then
DOCKER_HOST="tcp://us-west-1.hyper.sh:443"
fi
PR=""
if [[ "${BRANCH:0:1}" == "#" ]];then
PR=${BRANCH:1}
BRANCH=""
echo "========== Task: test PR #${PR} =========="
else
if [[ "${BRANCH}" == "" ]];then
BRANCH="master"
fi
echo "========== Task: test BRANCH ${BRANCH} =========="
fi
if [[ "${ACCESS_KEY}" == "" ]] || [[ "${SECRET_KEY}" == "" ]];then
echo "Error: Please set ACCESS_KEY and SECRET_KEY"
exit 1
fi
if [[ "$@" != "./build.sh" ]];then
#ensure config for hyper cli
mkdir -p ~/.hyper
cat > ~/.hyper/config.json <<EOF
{
"clouds": {
"${DOCKER_HOST}": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}"
},
"tcp://*.hyper.sh:443": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}",
"region": "${REGION}"
}
}
}
EOF
echo "========== config git proxy =========="
if [ "${http_proxy}" != "" ];then
git config --global http.proxy ${http_proxy}
fi
if [ "${https_proxy}" != "" ];then
git config --global https.proxy ${https_proxy}
fi
git config --list | grep proxy
echo "========== ping github.com =========="
ping -c 6 -W 10 github.com
echo "========== Clone hypercli repo =========="
mkdir -p /go/src/github.com/{hyperhq,docker}
cd /go/src/github.com/hyperhq
git clone https://github.com/hyperhq/hypercli.git
echo "========== Build hypercli =========="
cd /go/src/github.com/hyperhq/hypercli
if [[ "${BRANCH}" != "" ]];then
echo "checkout branch :${BRANCH}"
git checkout ${BRANCH}
elif [[ "${PR}" != "" ]];then
echo "checkout pr :#$PR"
git fetch origin pull/${PR}/head:pr-${PR}
git checkout pr-${PR}
fi
if [[ $? -ne 0 ]];then
echo "Branch ${BRANCH} not exist!"
exit 1
fi
./build.sh
ln -s /go/src/github.com/hyperhq/hypercli /go/src/github.com/docker/docker
ln -s /go/src/github.com/hyperhq/hypercli/hyper/hyper /usr/bin/hyper
echo alias hypercli=\"hyper --region \${DOCKER_HOST}\" >> /root/.bashrc
source /root/.bashrc
echo "##############################################################################################"
echo "## Welcome to integration test env ##"
echo "##############################################################################################"
#show config for hyper cli
echo "Current hyper config: ~/.hyper/config.json"
echo "----------------------------------------------------------------------------------------------"
cat ~/.hyper/config.json \
| sed 's/"secretkey":.*/"secretkey": "******************************",/g' \
| sed 's/"auth":.*/"auth": "******************************"/g'
echo "----------------------------------------------------------------------------------------------"
fi
#execute command
if [[ $# -ne 0 ]];then
echo "========== Test Cmd: $@ =========="
cd /go/src/github.com/hyperhq/hypercli/integration-cli && $@
if [[ "$@" == "./build.sh" ]];then
#show make result
if [[ $? -eq 0 ]];then
echo "OK:)"
else
echo "Failed:("
fi
fi
fi

494
vendor/github.com/hyperhq/hypercli/hack/install.sh generated vendored Executable file
View File

@@ -0,0 +1,494 @@
#!/bin/sh
set -e
#
# This script is meant for quick & easy install via:
# 'curl -sSL https://get.docker.com/ | sh'
# or:
# 'wget -qO- https://get.docker.com/ | sh'
#
# For test builds (ie. release candidates):
# 'curl -fsSL https://test.docker.com/ | sh'
# or:
# 'wget -qO- https://test.docker.com/ | sh'
#
# For experimental builds:
# 'curl -fsSL https://experimental.docker.com/ | sh'
# or:
# 'wget -qO- https://experimental.docker.com/ | sh'
#
# Docker Maintainers:
# To update this script on https://get.docker.com,
# use hack/release.sh during a normal release,
# or the following one-liner for script hotfixes:
# s3cmd put --acl-public -P hack/install.sh s3://get.docker.com/index
#
url="https://get.docker.com/"
apt_url="https://apt.dockerproject.org"
yum_url="https://yum.dockerproject.org"
gpg_fingerprint="58118E89F3A912897C070ADBF76221572C52609D"
command_exists() {
command -v "$@" > /dev/null 2>&1
}
echo_docker_as_nonroot() {
if command_exists docker && [ -e /var/run/docker.sock ]; then
(
set -x
$sh_c 'docker version'
) || true
fi
your_user=your-user
[ "$user" != 'root' ] && your_user="$user"
# intentionally mixed spaces and tabs here -- tabs are stripped by "<<-EOF", spaces are kept in the output
cat <<-EOF
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker $your_user
Remember that you will have to log out and back in for this to take effect!
EOF
}
# Check if this is a forked Linux distro
check_forked() {
# Check for lsb_release command existence, it usually exists in forked distros
if command_exists lsb_release; then
# Check if the `-u` option is supported
set +e
lsb_release -a -u > /dev/null 2>&1
lsb_release_exit_code=$?
set -e
# Check if the command has exited successfully, it means we're in a forked distro
if [ "$lsb_release_exit_code" = "0" ]; then
# Print info about current distro
cat <<-EOF
You're using '$lsb_dist' version '$dist_version'.
EOF
# Get the upstream release info
lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[[:space:]]')
dist_version=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'codename' | cut -d ':' -f 2 | tr -d '[[:space:]]')
# Print info about upstream distro
cat <<-EOF
Upstream release is '$lsb_dist' version '$dist_version'.
EOF
else
if [ -r /etc/debian_version ] && [ "$lsb_dist" != "ubuntu" ]; then
# We're Debian and don't even know it!
lsb_dist=debian
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
case "$dist_version" in
8|'Kali Linux 2')
dist_version="jessie"
;;
7)
dist_version="wheezy"
;;
esac
fi
fi
fi
}
rpm_import_repository_key() {
local key=$1; shift
local tmpdir=$(mktemp -d)
chmod 600 "$tmpdir"
gpg --homedir "$tmpdir" --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"
gpg --homedir "$tmpdir" --export --armor "$key" > "$tmpdir"/repo.key
rpm --import "$tmpdir"/repo.key
rm -rf "$tmpdir"
}
semverParse() {
major="${1%%.*}"
minor="${1#$major.}"
minor="${minor%%.*}"
patch="${1#$major.$minor.}"
patch="${patch%%[-.]*}"
}
do_install() {
case "$(uname -m)" in
*64)
;;
*)
cat >&2 <<-'EOF'
Error: you are not using a 64bit platform.
Docker currently only supports 64bit platforms.
EOF
exit 1
;;
esac
if command_exists docker; then
version="$(docker -v | awk -F '[ ,]+' '{ print $3 }')"
MAJOR_W=1
MINOR_W=10
semverParse $version
shouldWarn=0
if [ $major -lt $MAJOR_W ]; then
shouldWarn=1
fi
if [ $major -le $MAJOR_W ] && [ $minor -lt $MINOR_W ]; then
shouldWarn=1
fi
cat >&2 <<-'EOF'
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
EOF
if [ $shouldWarn -eq 1 ]; then
cat >&2 <<-'EOF'
again to update Docker, we urge you to migrate your image store before upgrading
to v1.10+.
You can find instructions for this here:
https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration
EOF
else
cat >&2 <<-'EOF'
again to update Docker, you can safely ignore this message.
EOF
fi
cat >&2 <<-'EOF'
You may press Ctrl+C now to abort this script.
EOF
( set -x; sleep 20 )
fi
user="$(id -un 2>/dev/null || true)"
sh_c='sh -c'
if [ "$user" != 'root' ]; then
if command_exists sudo; then
sh_c='sudo -E sh -c'
elif command_exists su; then
sh_c='su -c'
else
cat >&2 <<-'EOF'
Error: this installer needs the ability to run commands as root.
We are unable to find either "sudo" or "su" available to make this happen.
EOF
exit 1
fi
fi
curl=''
if command_exists curl; then
curl='curl -sSL'
elif command_exists wget; then
curl='wget -qO-'
elif command_exists busybox && busybox --list-modules | grep -q wget; then
curl='busybox wget -qO-'
fi
# check to see which repo they are trying to install from
if [ -z "$repo" ]; then
repo='main'
if [ "https://test.docker.com/" = "$url" ]; then
repo='testing'
elif [ "https://experimental.docker.com/" = "$url" ]; then
repo='experimental'
fi
fi
# perform some very rudimentary platform detection
lsb_dist=''
dist_version=''
if command_exists lsb_release; then
lsb_dist="$(lsb_release -si)"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then
lsb_dist='debian'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then
lsb_dist='fedora'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/oracle-release ]; then
lsb_dist='oracleserver'
fi
if [ -z "$lsb_dist" ]; then
if [ -r /etc/centos-release ] || [ -r /etc/redhat-release ]; then
lsb_dist='centos'
fi
fi
if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
fi
lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')"
case "$lsb_dist" in
ubuntu)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")"
fi
;;
debian)
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
case "$dist_version" in
8)
dist_version="jessie"
;;
7)
dist_version="wheezy"
;;
esac
;;
oracleserver)
# need to switch lsb_dist to match yum repo URL
lsb_dist="oraclelinux"
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//')"
;;
fedora|centos)
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//')"
;;
*)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
fi
;;
esac
# Check if this is a forked Linux distro
check_forked
# Run setup for each distro accordingly
case "$lsb_dist" in
amzn)
(
set -x
$sh_c 'sleep 3; yum -y -q install docker'
)
echo_docker_as_nonroot
exit 0
;;
'opensuse project'|opensuse)
echo 'Going to perform the following operations:'
if [ "$repo" != 'main' ]; then
echo ' * add repository obs://Virtualization:containers'
fi
echo ' * install Docker'
$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
if [ "$repo" != 'main' ]; then
# install experimental packages from OBS://Virtualization:containers
(
set -x
zypper -n ar -f obs://Virtualization:containers Virtualization:containers
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
)
fi
(
set -x
zypper -n install docker
)
echo_docker_as_nonroot
exit 0
;;
'suse linux'|sle[sd])
echo 'Going to perform the following operations:'
if [ "$repo" != 'main' ]; then
echo ' * add repository obs://Virtualization:containers'
echo ' * install experimental Docker using packages NOT supported by SUSE'
else
echo ' * add the "Containers" module'
echo ' * install Docker using packages supported by SUSE'
fi
$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
if [ "$repo" != 'main' ]; then
# install experimental packages from OBS://Virtualization:containers
echo >&2 'Warning: installing experimental packages from OBS, these packages are NOT supported by SUSE'
(
set -x
zypper -n ar -f obs://Virtualization:containers/SLE_12 Virtualization:containers
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
)
else
# Add the containers module
# Note well-1: the SLE machine must already be registered against SUSE Customer Center
# Note well-2: the `-r ""` is required to workaround a known issue of SUSEConnect
(
set -x
SUSEConnect -p sle-module-containers/12/x86_64 -r ""
)
fi
(
set -x
zypper -n install docker
)
echo_docker_as_nonroot
exit 0
;;
ubuntu|debian)
export DEBIAN_FRONTEND=noninteractive
did_apt_get_update=
apt_get_update() {
if [ -z "$did_apt_get_update" ]; then
( set -x; $sh_c 'sleep 3; apt-get update' )
did_apt_get_update=1
fi
}
# aufs is preferred over devicemapper; try to ensure the driver is available.
if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then
if uname -r | grep -q -- '-generic' && dpkg -l 'linux-image-*-generic' | grep -q '^ii' 2>/dev/null; then
kern_extras="linux-image-extra-$(uname -r) linux-image-extra-virtual"
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q '"$kern_extras" ) || true
if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then
echo >&2 'Warning: tried to install '"$kern_extras"' (for AUFS)'
echo >&2 ' but we still have no AUFS. Docker may not work. Proceeding anyways!'
( set -x; sleep 10 )
fi
else
echo >&2 'Warning: current kernel is not supported by the linux-image-extra-virtual'
echo >&2 ' package. We have no AUFS support. Consider installing the packages'
echo >&2 ' linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.'
( set -x; sleep 10 )
fi
fi
# install apparmor utils if they're missing and apparmor is enabled in the kernel
# otherwise Docker will fail to start
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then
if command -v apparmor_parser >/dev/null 2>&1; then
echo 'apparmor is enabled in the kernel and apparmor utils were already installed'
else
echo 'apparmor is enabled in the kernel, but apparmor_parser missing'
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q apparmor' )
fi
fi
if [ ! -e /usr/lib/apt/methods/https ]; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q apt-transport-https ca-certificates' )
fi
if [ -z "$curl" ]; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' )
curl='curl -sSL'
fi
(
set -x
$sh_c "apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys ${gpg_fingerprint}"
$sh_c "mkdir -p /etc/apt/sources.list.d"
$sh_c "echo deb [arch=$(dpkg --print-architecture)] ${apt_url}/repo ${lsb_dist}-${dist_version} ${repo} > /etc/apt/sources.list.d/docker.list"
$sh_c 'sleep 3; apt-get update; apt-get install -y -q docker-engine'
)
echo_docker_as_nonroot
exit 0
;;
fedora|centos|oraclelinux)
$sh_c "cat >/etc/yum.repos.d/docker-${repo}.repo" <<-EOF
[docker-${repo}-repo]
name=Docker ${repo} Repository
baseurl=${yum_url}/repo/${repo}/${lsb_dist}/${dist_version}
enabled=1
gpgcheck=1
gpgkey=${yum_url}/gpg
EOF
if [ "$lsb_dist" = "fedora" ] && [ "$dist_version" -ge "22" ]; then
(
set -x
$sh_c 'sleep 3; dnf -y -q install docker-engine'
)
else
(
set -x
$sh_c 'sleep 3; yum -y -q install docker-engine'
)
fi
echo_docker_as_nonroot
exit 0
;;
gentoo)
if [ "$url" = "https://test.docker.com/" ]; then
# intentionally mixed spaces and tabs here -- tabs are stripped by "<<-'EOF'", spaces are kept in the output
cat >&2 <<-'EOF'
You appear to be trying to install the latest nightly build in Gentoo.'
The portage tree should contain the latest stable release of Docker, but'
if you want something more recent, you can always use the live ebuild'
provided in the "docker" overlay available via layman. For more'
instructions, please see the following URL:'
https://github.com/tianon/docker-overlay#using-this-overlay'
After adding the "docker" overlay, you should be able to:'
emerge -av =app-emulation/docker-9999'
EOF
exit 1
fi
(
set -x
$sh_c 'sleep 3; emerge app-emulation/docker'
)
exit 0
;;
esac
# intentionally mixed spaces and tabs here -- tabs are stripped by "<<-'EOF'", spaces are kept in the output
cat >&2 <<-'EOF'
Either your platform is not easily detectable, is not supported by this
installer script (yet - PRs welcome! [hack/install.sh]), or does not yet have
a package for Docker. Please visit the following URL for more detailed
installation instructions:
https://docs.docker.com/engine/installation/
EOF
exit 1
}
# wrapped up in a function so that we have some protection against only getting
# half the file during "curl | sh"
do_install

321
vendor/github.com/hyperhq/hypercli/hack/make.sh generated vendored Executable file
View File

@@ -0,0 +1,321 @@
#!/usr/bin/env bash
set -e
# This script builds various binary artifacts from a checkout of the docker
# source code.
#
# Requirements:
# - The current directory should be a checkout of the docker source code
# (https://github.com/docker/docker). Whatever version is checked out
# will be built.
# - The VERSION file, at the root of the repository, should exist, and
# will be used as Docker binary version and package version.
# - The hash of the git commit will also be included in the Docker binary,
# with the suffix -unsupported if the repository isn't clean.
# - The script is intended to be run inside the docker container specified
# in the Dockerfile at the root of the source. In other words:
# DO NOT CALL THIS SCRIPT DIRECTLY.
# - The right way to call this script is to invoke "make" from
# your checkout of the Docker repository.
# the Makefile will do a "docker build -t docker ." and then
# "docker run hack/make.sh" in the resulting image.
#
set -o pipefail
export DOCKER_PKG='github.com/docker/docker'
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export MAKEDIR="$SCRIPTDIR/make"
# We're a nice, sexy, little shell script, and people might try to run us;
# but really, they shouldn't. We want to be in a container!
inContainer="AssumeSoInitially"
if [ "$(go env GOHOSTOS)" = 'windows' ]; then
if [ -z "$FROM_DOCKERFILE" ]; then
unset inContainer
fi
else
if [ "$PWD" != "/go/src/$DOCKER_PKG" ] || [ -z "$DOCKER_CROSSPLATFORMS" ]; then
unset inContainer
fi
fi
if [ -z "$inContainer" ]; then
{
echo "# WARNING! I don't seem to be running in a Docker container."
echo "# The result of this command might be an incorrect build, and will not be"
echo "# officially supported."
echo "#"
echo "# Try this instead: make all"
echo "#"
} >&2
fi
echo
# List of bundles to create when no argument is passed
DEFAULT_BUNDLES=(
validate-dco
validate-gofmt
validate-lint
validate-pkg
validate-test
validate-toml
validate-vet
binary
dynbinary
test-unit
test-integration-cli
test-docker-py
cover
cross
tgz
)
VERSION=$(< ./VERSION)
if command -v git &> /dev/null && git rev-parse &> /dev/null; then
GITCOMMIT=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
GITCOMMIT="$GITCOMMIT-unsupported"
fi
! BUILDTIME=$(date --rfc-3339 ns | sed -e 's/ /T/') &> /dev/null
if [ -z $BUILDTIME ]; then
# If using bash 3.1 which doesn't support --rfc-3389, eg Windows CI
BUILDTIME=$(date -u)
fi
elif [ "$DOCKER_GITCOMMIT" ]; then
GITCOMMIT="$DOCKER_GITCOMMIT"
else
echo >&2 'error: .git directory missing and DOCKER_GITCOMMIT not specified'
echo >&2 ' Please either build with the .git directory accessible, or specify the'
echo >&2 ' exact (--short) commit hash you are building using DOCKER_GITCOMMIT for'
echo >&2 ' future accountability in diagnosing build issues. Thanks!'
exit 1
fi
if [ "$AUTO_GOPATH" ]; then
rm -rf .gopath
mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
fi
if [ ! "$GOPATH" ]; then
echo >&2 'error: missing GOPATH; please see https://golang.org/doc/code.html#GOPATH'
echo >&2 ' alternatively, set AUTO_GOPATH=1'
exit 1
fi
if [ "$DOCKER_EXPERIMENTAL" ]; then
echo >&2 '# WARNING! DOCKER_EXPERIMENTAL is set: building experimental features'
echo >&2
DOCKER_BUILDTAGS+=" experimental pkcs11"
fi
if [ -z "$DOCKER_CLIENTONLY" ]; then
DOCKER_BUILDTAGS+=" daemon"
if pkg-config libsystemd-journal 2> /dev/null ; then
DOCKER_BUILDTAGS+=" journald"
fi
fi
# test whether "btrfs/version.h" exists and apply btrfs_noversion appropriately
if \
command -v gcc &> /dev/null \
&& ! gcc -E - -o /dev/null &> /dev/null <<<'#include <btrfs/version.h>' \
; then
DOCKER_BUILDTAGS+=' btrfs_noversion'
fi
# test whether "libdevmapper.h" is new enough to support deferred remove
# functionality.
if \
command -v gcc &> /dev/null \
&& ! ( echo -e '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -ldevmapper -xc - -o /dev/null &> /dev/null ) \
; then
DOCKER_BUILDTAGS+=' libdm_no_deferred_remove'
fi
# Use these flags when compiling the tests and final binary
IAMSTATIC='true'
source "$SCRIPTDIR/make/.go-autogen"
if [ -z "$DOCKER_DEBUG" ]; then
LDFLAGS='-w'
fi
LDFLAGS_STATIC=''
EXTLDFLAGS_STATIC='-static'
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
# with options like -race.
ORIG_BUILDFLAGS=( -tags "autogen netgo static_build sqlite_omit_load_extension $DOCKER_BUILDTAGS" -installsuffix netgo )
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
# When $DOCKER_INCREMENTAL_BINARY is set in the environment, enable incremental
# builds by installing dependent packages to the GOPATH.
REBUILD_FLAG="-a"
if [ "$DOCKER_INCREMENTAL_BINARY" ]; then
REBUILD_FLAG="-i"
fi
ORIG_BUILDFLAGS+=( $REBUILD_FLAG )
BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
# Test timeout.
if [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
: ${TIMEOUT:=210m}
else
: ${TIMEOUT:=120m}
fi
TESTFLAGS+=" -test.timeout=${TIMEOUT}"
LDFLAGS_STATIC_DOCKER="
$LDFLAGS_STATIC
-extldflags \"$EXTLDFLAGS_STATIC\"
"
if [ "$(uname -s)" = 'FreeBSD' ]; then
# Tell cgo the compiler is Clang, not GCC
# https://code.google.com/p/go/source/browse/src/cmd/cgo/gcc.go?spec=svne77e74371f2340ee08622ce602e9f7b15f29d8d3&r=e6794866ebeba2bf8818b9261b54e2eef1c9e588#752
export CC=clang
# "-extld clang" is a workaround for
# https://code.google.com/p/go/issues/detail?id=6845
LDFLAGS="$LDFLAGS -extld clang"
fi
# If sqlite3.h doesn't exist under /usr/include,
# check /usr/local/include also just in case
# (e.g. FreeBSD Ports installs it under the directory)
if [ ! -e /usr/include/sqlite3.h ] && [ -e /usr/local/include/sqlite3.h ]; then
export CGO_CFLAGS='-I/usr/local/include'
export CGO_LDFLAGS='-L/usr/local/lib'
fi
HAVE_GO_TEST_COVER=
if \
go help testflag | grep -- -cover > /dev/null \
&& go tool -n cover > /dev/null 2>&1 \
; then
HAVE_GO_TEST_COVER=1
fi
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
# You can use this to select certain tests to run, eg.
#
# TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
#
# For integration-cli test, we use [gocheck](https://labix.org/gocheck), if you want
# to run certain tests on your local host, you should run with command:
#
# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration-cli
#
go_test_dir() {
dir=$1
coverpkg=$2
testcover=()
if [ "$HAVE_GO_TEST_COVER" ]; then
# if our current go install has -cover, we want to use it :)
mkdir -p "$DEST/coverprofiles"
coverprofile="docker${dir#.}"
coverprofile="$ABS_DEST/coverprofiles/${coverprofile//\//-}"
testcover=( -cover -coverprofile "$coverprofile" $coverpkg )
fi
(
echo '+ go test' $TESTFLAGS "${DOCKER_PKG}${dir#.}"
cd "$dir"
export DEST="$ABS_DEST" # we're in a subshell, so this is safe -- our integration-cli tests need DEST, and "cd" screws it up
test_env go test ${testcover[@]} -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS
)
}
test_env() {
# use "env -i" to tightly control the environment variables that bleed into the tests
env -i \
DEST="$DEST" \
DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
DOCKER_HOST="$DOCKER_HOST" \
DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \
DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
GOPATH="$GOPATH" \
HOME="$ABS_DEST/fake-HOME" \
PATH="$PATH" \
TEMP="$TEMP" \
"$@"
}
# a helper to provide ".exe" when it's appropriate
binary_extension() {
if [ "$(go env GOOS)" = 'windows' ]; then
echo -n '.exe'
fi
}
hash_files() {
while [ $# -gt 0 ]; do
f="$1"
shift
dir="$(dirname "$f")"
base="$(basename "$f")"
for hashAlgo in md5 sha256; do
if command -v "${hashAlgo}sum" &> /dev/null; then
(
# subshell and cd so that we get output files like:
# $HASH docker-$VERSION
# instead of:
# $HASH /go/src/github.com/.../$VERSION/binary/docker-$VERSION
cd "$dir"
"${hashAlgo}sum" "$base" > "$base.$hashAlgo"
)
fi
done
done
}
bundle() {
local bundle="$1"; shift
echo "---> Making bundle: $(basename "$bundle") (in $DEST)"
source "$SCRIPTDIR/make/$bundle" "$@"
}
main() {
# We want this to fail if the bundles already exist and cannot be removed.
# This is to avoid mixing bundles from different versions of the code.
mkdir -p bundles
if [ -e "bundles/$VERSION" ] && [ -z "$KEEPBUNDLE" ]; then
echo "bundles/$VERSION already exists. Removing."
rm -fr "bundles/$VERSION" && mkdir "bundles/$VERSION" || exit 1
echo
fi
if [ "$(go env GOHOSTOS)" != 'windows' ]; then
# Windows and symlinks don't get along well
rm -f bundles/latest
ln -s "$VERSION" bundles/latest
fi
if [ $# -lt 1 ]; then
bundles=(${DEFAULT_BUNDLES[@]})
else
bundles=($@)
fi
for bundle in ${bundles[@]}; do
export DEST="bundles/$VERSION/$(basename "$bundle")"
# Cygdrive paths don't play well with go build -o.
if [[ "$(uname -s)" == CYGWIN* ]]; then
export DEST="$(cygpath -mw "$DEST")"
fi
mkdir -p "$DEST"
ABS_DEST="$(cd "$DEST" && pwd -P)"
bundle "$bundle"
echo
done
}
main "$@"

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,30 @@
Source: docker-engine
Section: admin
Priority: optional
Maintainer: Docker <support@docker.com>
Standards-Version: 3.9.6
Homepage: https://dockerproject.org
Vcs-Browser: https://github.com/docker/docker
Vcs-Git: git://github.com/docker/docker.git
Package: docker-engine
Architecture: linux-any
Depends: iptables, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
Recommends: aufs-tools,
ca-certificates,
cgroupfs-mount | cgroup-lite,
git,
xz-utils,
${apparmor:Recommends},
${yubico:Recommends}
Conflicts: docker (<< 1.5~), docker.io, lxc-docker, lxc-docker-virtual-package, docker-engine-cs
Description: Docker: the open-source application container engine
Docker is an open source project to build, ship and run any application as a
lightweight container
.
Docker containers are both hardware-agnostic and platform-agnostic. This means
they can run anywhere, from your laptop to the largest EC2 compute instance and
everything in between - and they don't require you to use a particular
language, framework or packaging system. That makes them great building blocks
for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider.

View File

@@ -0,0 +1 @@
contrib/completion/bash/docker

View File

@@ -0,0 +1,20 @@
# Docker Upstart and SysVinit configuration file
#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/articles/systemd/
#
# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"

View File

@@ -0,0 +1,149 @@
#!/bin/sh
set -e
### BEGIN INIT INFO
# Provides: docker
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: cgroupfs-mount cgroup-lite
# Should-Stop: cgroupfs-mount cgroup-lite
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Create lightweight, portable, self-sufficient containers.
# Description:
# Docker is an open-source project to easily create lightweight, portable,
# self-sufficient containers from any application. The same container that a
# developer builds and tests on a laptop can run at scale, in production, on
# VMs, bare metal, OpenStack clusters, public clouds and more.
### END INIT INFO
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
BASE=docker
# modify these in /etc/default/$BASE (/etc/default/docker)
DOCKER=/usr/bin/$BASE
# This is the pid file managed by docker itself
DOCKER_PIDFILE=/var/run/$BASE.pid
# This is the pid file created/managed by start-stop-daemon
DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid
DOCKER_LOGFILE=/var/log/$BASE.log
DOCKER_OPTS=
DOCKER_DESC="Docker"
# Get lsb functions
. /lib/lsb/init-functions
if [ -f /etc/default/$BASE ]; then
. /etc/default/$BASE
fi
# Check docker is present
if [ ! -x $DOCKER ]; then
log_failure_msg "$DOCKER not present or not executable"
exit 1
fi
check_init() {
# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it directly)
if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
log_failure_msg "$DOCKER_DESC is managed via upstart, try using service $BASE $1"
exit 1
fi
}
fail_unless_root() {
if [ "$(id -u)" != '0' ]; then
log_failure_msg "$DOCKER_DESC must be run as root"
exit 1
fi
}
cgroupfs_mount() {
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
return
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
}
case "$1" in
start)
check_init
fail_unless_root
cgroupfs_mount
touch "$DOCKER_LOGFILE"
chgrp docker "$DOCKER_LOGFILE"
ulimit -n 1048576
if [ "$BASH" ]; then
ulimit -u 1048576
else
ulimit -p 1048576
fi
log_begin_msg "Starting $DOCKER_DESC: $BASE"
start-stop-daemon --start --background \
--no-close \
--exec "$DOCKER" \
--pidfile "$DOCKER_SSD_PIDFILE" \
--make-pidfile \
-- \
daemon -p "$DOCKER_PIDFILE" \
$DOCKER_OPTS \
>> "$DOCKER_LOGFILE" 2>&1
log_end_msg $?
;;
stop)
check_init
fail_unless_root
log_begin_msg "Stopping $DOCKER_DESC: $BASE"
start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10
log_end_msg $?
;;
restart)
check_init
fail_unless_root
docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
[ -n "$docker_pid" ] \
&& ps -p $docker_pid > /dev/null 2>&1 \
&& $0 stop
$0 start
;;
force-reload)
check_init
fail_unless_root
$0 restart
;;
status)
check_init
status_of_proc -p "$DOCKER_SSD_PIDFILE" "$DOCKER" "$DOCKER_DESC"
;;
*)
echo "Usage: service docker {start|stop|restart|status}"
exit 1
;;
esac

View File

@@ -0,0 +1,68 @@
description "Docker daemon"
start on (filesystem and net-device-up IFACE!=lo)
stop on runlevel [!2345]
limit nofile 524288 1048576
limit nproc 524288 1048576
respawn
kill timeout 20
pre-start script
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
exit 0
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
end script
script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
DOCKER=/usr/bin/$UPSTART_JOB
DOCKER_OPTS=
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
exec "$DOCKER" daemon $DOCKER_OPTS --raw-logs
end script
# Don't emit "started" event until docker.sock is ready.
# See https://github.com/docker/docker/issues/6647
post-start script
DOCKER_OPTS=
DOCKER_SOCKET=
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then
DOCKER_SOCKET=/var/run/docker.sock
else
DOCKER_SOCKET=$(printf "%s" "$DOCKER_OPTS" | grep -oP -e '(-H|--host)\W*unix://\K(\S+)')
fi
if [ -n "$DOCKER_SOCKET" ]; then
while ! [ -e "$DOCKER_SOCKET" ]; do
initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1
echo "Waiting for $DOCKER_SOCKET"
sleep 0.1
done
echo "$DOCKER_SOCKET is up"
fi
end script

View File

@@ -0,0 +1,12 @@
#contrib/syntax/vim/doc/* /usr/share/vim/vimfiles/doc/
#contrib/syntax/vim/ftdetect/* /usr/share/vim/vimfiles/ftdetect/
#contrib/syntax/vim/syntax/* /usr/share/vim/vimfiles/syntax/
contrib/*-integration usr/share/docker-engine/contrib/
contrib/check-config.sh usr/share/docker-engine/contrib/
contrib/completion/fish/docker.fish usr/share/fish/vendor_completions.d/
contrib/completion/zsh/_docker usr/share/zsh/vendor-completions/
contrib/init/systemd/docker.service lib/systemd/system/
contrib/init/systemd/docker.socket lib/systemd/system/
contrib/mk* usr/share/docker-engine/contrib/
contrib/nuke-graph-directory.sh usr/share/docker-engine/contrib/
contrib/syntax/nano/Dockerfile.nanorc usr/share/nano/

View File

@@ -0,0 +1 @@
man/man*/*

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
case "$1" in
configure)
if [ -z "$2" ]; then
if ! getent group docker > /dev/null; then
groupadd --system docker
fi
fi
;;
abort-*)
# How'd we get here??
exit 1
;;
*)
;;
esac
#DEBHELPER#

View File

@@ -0,0 +1,3 @@
# hide docker's loopback devices from udisks, and thus from user desktops
SUBSYSTEM=="block", ENV{DM_NAME}=="docker-*", ENV{UDISKS_PRESENTATION_HIDE}="1", ENV{UDISKS_IGNORE}="1"
SUBSYSTEM=="block", DEVPATH=="/devices/virtual/block/loop*", ATTR{loop/backing_file}=="/var/lib/docker/*", ENV{UDISKS_PRESENTATION_HIDE}="1", ENV{UDISKS_IGNORE}="1"

View File

@@ -0,0 +1 @@
README.md

View File

@@ -0,0 +1,40 @@
#!/usr/bin/make -f
VERSION = $(shell cat VERSION)
override_dh_gencontrol:
# if we're on Ubuntu, we need to Recommends: apparmor
echo 'apparmor:Recommends=$(shell dpkg-vendor --is Ubuntu && echo apparmor)' >> debian/docker-engine.substvars
# if we are building experimental we reccomend yubico-piv-tool
echo 'yubico:Recommends=$(shell [ "$DOCKER_EXPERIMENTAL" ] && echo "yubico-piv-tool (>= 1.1.0~)")' >> debian/docker-engine.substvars
dh_gencontrol
override_dh_auto_build:
./hack/make.sh dynbinary
# ./man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here
override_dh_auto_test:
./bundles/$(VERSION)/dynbinary/docker -v
override_dh_strip:
# Go has lots of problems with stripping, so just don't
override_dh_auto_install:
mkdir -p debian/docker-engine/usr/bin
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary/docker)" debian/docker-engine/usr/bin/docker
mkdir -p debian/docker-engine/usr/lib/docker
override_dh_installinit:
# use "docker" as our service name, not "docker-engine"
dh_installinit --name=docker
override_dh_installudev:
# match our existing priority
dh_installudev --priority=z80
override_dh_install:
dh_install
dh_apparmor --profile-name=docker-engine -pdocker-engine
%:
dh $@ --with=bash-completion $(shell command -v dh_systemd_enable > /dev/null 2>&1 && echo --with=systemd)

View File

@@ -0,0 +1,106 @@
# Some bits borrowed from the openstack-selinux package
Name: docker-engine-selinux
Version: %{_version}
Release: %{_release}%{?dist}
Summary: SELinux Policies for the open-source application container engine
BuildArch: noarch
Group: Tools/Docker
License: GPLv2
Source: %{name}.tar.gz
URL: https://dockerproject.org
Vendor: Docker
Packager: Docker <support@docker.com>
# Version of SELinux we were using
%if 0%{?fedora} == 20
%global selinux_policyver 3.12.1-197
%endif # fedora 20
%if 0%{?fedora} == 21
%global selinux_policyver 3.13.1-105
%endif # fedora 21
%if 0%{?fedora} >= 22
%global selinux_policyver 3.13.1-128
%endif # fedora 22
%if 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
%global selinux_policyver 3.13.1-23
%endif # centos,rhel,oraclelinux 7
%global selinuxtype targeted
%global moduletype services
%global modulenames docker
Requires(post): selinux-policy-base >= %{selinux_policyver}, selinux-policy-targeted >= %{selinux_policyver}, policycoreutils, policycoreutils-python libselinux-utils
BuildRequires: selinux-policy selinux-policy-devel
# conflicting packages
Conflicts: docker-selinux
# Usage: _format var format
# Expand 'modulenames' into various formats as needed
# Format must contain '$x' somewhere to do anything useful
%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done;
# Relabel files
%global relabel_files() \
/sbin/restorecon -R %{_bindir}/docker %{_localstatedir}/run/docker.sock %{_localstatedir}/run/docker.pid %{_sharedstatedir}/docker %{_sysconfdir}/docker %{_localstatedir}/log/docker %{_localstatedir}/log/lxc %{_localstatedir}/lock/lxc %{_usr}/lib/systemd/system/docker.service /root/.docker &> /dev/null || : \
%description
SELinux policy modules for use with Docker
%prep
%if 0%{?centos} <= 6
%setup -n %{name}
%else
%autosetup -n %{name}
%endif
%build
make SHARE="%{_datadir}" TARGETS="%{modulenames}"
%install
# Install SELinux interfaces
%_format INTERFACES $x.if
install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
install -p -m 644 $INTERFACES %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
# Install policy modules
%_format MODULES $x.pp.bz2
install -d %{buildroot}%{_datadir}/selinux/packages
install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages
%post
#
# Install all modules in a single transaction
#
if [ $1 -eq 1 ]; then
%{_sbindir}/setsebool -P -N virt_use_nfs=1 virt_sandbox_use_all_caps=1
fi
%_format MODULES %{_datadir}/selinux/packages/$x.pp.bz2
%{_sbindir}/semodule -n -s %{selinuxtype} -i $MODULES
if %{_sbindir}/selinuxenabled ; then
%{_sbindir}/load_policy
%relabel_files
fi
%postun
if [ $1 -eq 0 ]; then
%{_sbindir}/semodule -n -r %{modulenames} &> /dev/null || :
if %{_sbindir}/selinuxenabled ; then
%{_sbindir}/load_policy
%relabel_files
fi
fi
%files
%doc LICENSE
%defattr(-,root,root,0755)
%attr(0644,root,root) %{_datadir}/selinux/packages/*.pp.bz2
%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/*.if
%changelog
* Tue Dec 1 2015 Jessica Frazelle <acidburn@docker.com> 1.9.1-1
- add licence to rpm
- add selinux-policy and docker-engine-selinux rpm

View File

@@ -0,0 +1,225 @@
Name: docker-engine
Version: %{_version}
Release: %{_release}%{?dist}
Summary: The open-source application container engine
Group: Tools/Docker
License: ASL 2.0
Source: %{name}.tar.gz
URL: https://dockerproject.org
Vendor: Docker
Packager: Docker <support@docker.com>
# is_systemd conditional
%if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
%global is_systemd 1
%endif
# required packages for build
# most are already in the container (see contrib/builder/rpm/ARCH/generate.sh)
# only require systemd on those systems
%if 0%{?is_systemd}
%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires: pkgconfig(systemd)
Requires: systemd-units
BuildRequires: pkgconfig(libsystemd-journal)
%endif
%else
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%endif
# required packages on install
Requires: /bin/sh
Requires: iptables
%if !0%{?suse_version}
Requires: libcgroup
%else
Requires: libcgroup1
%endif
Requires: tar
Requires: xz
%if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
# Resolves: rhbz#1165615
Requires: device-mapper-libs >= 1.02.90-1
%endif
%if 0%{?oraclelinux} >= 6
# Require Oracle Unbreakable Enterprise Kernel R4 and newer device-mapper
Requires: kernel-uek >= 4.1
Requires: device-mapper >= 1.02.90-2
%endif
# docker-selinux conditional
%if 0%{?fedora} >= 20 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
%global with_selinux 1
%endif
%if 0%{?_experimental}
# yubico-piv-tool conditional
%if 0%{?fedora} >= 20 || 0%{?centos} >= 7 || 0%{?rhel} >= 7
Requires: yubico-piv-tool >= 1.1.0
%endif
%endif
# start if with_selinux
%if 0%{?with_selinux}
# Version of SELinux we were using
%if 0%{?fedora} == 20
%global selinux_policyver 3.12.1-197
%endif # fedora 20
%if 0%{?fedora} == 21
%global selinux_policyver 3.13.1-105
%endif # fedora 21
%if 0%{?fedora} >= 22
%global selinux_policyver 3.13.1-128
%endif # fedora 22
%if 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
%global selinux_policyver 3.13.1-23
%endif # centos,oraclelinux 7
%endif # with_selinux
# RE: rhbz#1195804 - ensure min NVR for selinux-policy
%if 0%{?with_selinux}
Requires: selinux-policy >= %{selinux_policyver}
Requires(pre): %{name}-selinux >= %{epoch}:%{version}-%{release}
%endif # with_selinux
# conflicting packages
Conflicts: docker
Conflicts: docker-io
Conflicts: docker-engine-cs
%description
Docker is an open source project to build, ship and run any application as a
lightweight container.
Docker containers are both hardware-agnostic and platform-agnostic. This means
they can run anywhere, from your laptop to the largest EC2 compute instance and
everything in between - and they don't require you to use a particular
language, framework or packaging system. That makes them great building blocks
for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider.
%prep
%if 0%{?centos} <= 6 || 0%{?oraclelinux} <=6
%setup -n %{name}
%else
%autosetup -n %{name}
%endif
%build
export DOCKER_GITCOMMIT=%{_gitcommit}
./hack/make.sh dynbinary
# ./man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here
%check
./bundles/%{_origversion}/dynbinary/docker -v
%install
# install binary
install -d $RPM_BUILD_ROOT/%{_bindir}
install -p -m 755 bundles/%{_origversion}/dynbinary/docker-%{_origversion} $RPM_BUILD_ROOT/%{_bindir}/docker
# install udev rules
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d
install -p -m 644 contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules
# add init scripts
install -d $RPM_BUILD_ROOT/etc/sysconfig
install -d $RPM_BUILD_ROOT/%{_initddir}
%if 0%{?is_systemd}
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 contrib/init/systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
install -p -m 644 contrib/init/systemd/docker.socket $RPM_BUILD_ROOT/%{_unitdir}/docker.socket
%else
install -p -m 644 contrib/init/sysvinit-redhat/docker.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/docker
install -p -m 755 contrib/init/sysvinit-redhat/docker $RPM_BUILD_ROOT/%{_initddir}/docker
%endif
# add bash, zsh, and fish completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions
install -d $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d
install -p -m 644 contrib/completion/bash/docker $RPM_BUILD_ROOT/usr/share/bash-completion/completions/docker
install -p -m 644 contrib/completion/zsh/_docker $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions/_docker
install -p -m 644 contrib/completion/fish/docker.fish $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d/docker.fish
# install manpages
install -d %{buildroot}%{_mandir}/man1
install -p -m 644 man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1
install -d %{buildroot}%{_mandir}/man5
install -p -m 644 man/man5/*.5 $RPM_BUILD_ROOT/%{_mandir}/man5
# add vimfiles
install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc
install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect
install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax
install -p -m 644 contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt
install -p -m 644 contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim
install -p -m 644 contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim
# add nano
install -d $RPM_BUILD_ROOT/usr/share/nano
install -p -m 644 contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc
# list files owned by the package here
%files
%doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md
/%{_bindir}/docker
/%{_sysconfdir}/udev/rules.d/80-docker.rules
%if 0%{?is_systemd}
/%{_unitdir}/docker.service
/%{_unitdir}/docker.socket
%else
%config(noreplace,missingok) /etc/sysconfig/docker
/%{_initddir}/docker
%endif
/usr/share/bash-completion/completions/docker
/usr/share/zsh/vendor-completions/_docker
/usr/share/fish/vendor_completions.d/docker.fish
%doc
/%{_mandir}/man1/*
/%{_mandir}/man5/*
/usr/share/vim/vimfiles/doc/dockerfile.txt
/usr/share/vim/vimfiles/ftdetect/dockerfile.vim
/usr/share/vim/vimfiles/syntax/dockerfile.vim
/usr/share/nano/Dockerfile.nanorc
%post
%if 0%{?is_systemd}
%systemd_post docker
%else
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add docker
%endif
if ! getent group docker > /dev/null; then
groupadd --system docker
fi
%preun
%if 0%{?is_systemd}
%systemd_preun docker
%else
if [ $1 -eq 0 ] ; then
/sbin/service docker stop >/dev/null 2>&1
/sbin/chkconfig --del docker
fi
%endif
%postun
%if 0%{?is_systemd}
%systemd_postun_with_restart docker
%else
if [ "$1" -ge "1" ] ; then
/sbin/service docker condrestart >/dev/null 2>&1 || :
fi
%endif
%changelog

View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
# Retrieve OS/ARCH of docker daemon, eg. linux/amd64
export DOCKER_ENGINE_OSARCH="$(docker version | awk '
$1 == "Client:" { server = 0; next }
$1 == "Server:" { server = 1; next }
server && $1 == "OS/Arch:" { print $2 }
')"
export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}"
export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}"
DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:=amd64}
# and the client, just in case
export DOCKER_CLIENT_OSARCH="$(docker version | awk '
$1 == "Client:" { client = 1; next }
$1 == "Server:" { client = 0; next }
client && $1 == "OS/Arch:" { print $2 }
')"
# Retrieve the architecture used in contrib/builder/(deb|rpm)/$PACKAGE_ARCH/
PACKAGE_ARCH="amd64"
case "$DOCKER_ENGINE_OSARCH" in
linux/arm)
PACKAGE_ARCH='armhf'
;;
linux/ppc64le)
PACKAGE_ARCH='ppc64le'
;;
linux/s390x)
PACKAGE_ARCH='s390x'
;;
esac
export PACKAGE_ARCH

View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -e
if ! docker inspect emptyfs &> /dev/null; then
# let's build a "docker save" tarball for "emptyfs"
# see https://github.com/docker/docker/pull/5262
# and also https://github.com/docker/docker/issues/4242
dir="$DEST/emptyfs"
mkdir -p "$dir"
(
cd "$dir"
echo '{"emptyfs":{"latest":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}}' > repositories
mkdir -p 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158
(
cd 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158
echo '{"id":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158","comment":"Imported from -","created":"2013-06-13T14:03:50.821769-07:00","container_config":{"Hostname":"","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"docker_version":"0.4.0","architecture":"x86_64","Size":0}' > json
echo '1.0' > VERSION
tar -cf layer.tar --files-from /dev/null
)
)
( set -x; tar -cC "$dir" . | docker load )
rm -rf "$dir"
fi

View File

@@ -0,0 +1,83 @@
#!/bin/bash
set -e
# image list should match what's in the Dockerfile (minus the explicit images IDs)
images=(
buildpack-deps:jessie
busybox:latest
debian:jessie
hello-world:latest
)
imagePrefix=
case "$DOCKER_ENGINE_OSARCH" in
linux/arm)
imagePrefix='armhf'
;;
linux/arm64)
imagePrefix='aarch64'
;;
linux/ppc64le)
imagePrefix='ppc64le'
;;
linux/s390x)
imagePrefix='s390x'
;;
esac
if [ "$imagePrefix" ]; then
for (( i = 0; i < ${#images[@]}; i++ )); do
images[$i]="$imagePrefix/${images[$i]}"
done
fi
if ! docker inspect "${images[@]}" &> /dev/null; then
hardCodedDir='/docker-frozen-images'
if [ -d "$hardCodedDir" ]; then
# Do not use a subshell for the following command. Windows to Linux CI
# runs bash 3.x so will not trap an error in a subshell.
# http://stackoverflow.com/questions/22630363/how-does-set-e-work-with-subshells
set -x; tar -cC "$hardCodedDir" . | docker load; set +x
else
dir="$DEST/frozen-images"
# extract the exact "RUN download-frozen-image-v2.sh" line from the Dockerfile itself for consistency
# NOTE: this will fail if either "curl" or "jq" is not installed or if the Dockerfile is not available/readable
awk '
$1 == "RUN" && $2 == "./contrib/download-frozen-image-v2.sh" {
for (i = 2; i < NF; i++)
printf ( $i == "'"$hardCodedDir"'" ? "'"$dir"'" : $i ) " ";
print $NF;
if (/\\$/) {
inCont = 1;
next;
}
}
inCont {
print;
if (!/\\$/) {
inCont = 0;
}
}
' "${DOCKERFILE:=Dockerfile}" | sh -x
# Do not use a subshell for the following command. Windows to Linux CI
# runs bash 3.x so will not trap an error in a subshell.
# http://stackoverflow.com/questions/22630363/how-does-set-e-work-with-subshells
set -x; tar -cC "$dir" . | docker load; set +x
fi
fi
if [ "$imagePrefix" ]; then
for image in "${images[@]}"; do
target="${image#$imagePrefix/}"
if [ "$target" != "$image" ]; then
# tag images to ensure that all integrations work with the defined image names
docker tag "$image" "$target"
# then remove original tags as these make problems with later tests (e.g., TestInspectApiImageResponse)
docker rmi "$image"
fi
done
fi
# explicitly rename "hello-world:latest" to ":frozen" for the test that uses it
docker tag hello-world:latest hello-world:frozen
docker rmi hello-world:latest

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
# This scripts sets up the required images for Windows to Windows CI
# Tag windowsservercore as latest
set +e
! BUILD=$(docker images | grep windowsservercore | grep -v latest | awk '{print $2}')
if [ -z $BUILD ]; then
echo "ERROR: Could not find windowsservercore images"
exit 1
fi
! LATESTCOUNT=$(docker images | grep windowsservercore | grep -v $BUILD | wc -l)
if [ $LATESTCOUNT -ne 1 ]; then
set -e
docker tag windowsservercore:$BUILD windowsservercore:latest
echo "INFO: Tagged windowsservercore:$BUILD with latest"
fi
# Busybox (requires windowsservercore)
if [ -z "$(docker images | grep busybox)" ]; then
echo "INFO: Building busybox"
docker build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/master/Dockerfile
fi

View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
# Build a Go static web server on top of busybox image
# and compile it for target daemon
dir="$DEST/httpserver"
mkdir -p "$dir"
(
cd "$dir"
GOOS=${DOCKER_ENGINE_GOOS:="linux"} GOARCH=${DOCKER_ENGINE_GOARCH:="amd64"} go build -o httpserver github.com/docker/docker/contrib/httpserver
cp ../../../../contrib/httpserver/Dockerfile .
docker build -qt httpserver . > /dev/null
)
rm -rf "$dir"

View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
# Build a C binary for cloning a userns for seccomp tests
# and compile it for target daemon
if [ "$DOCKER_ENGINE_GOOS" = "linux" ]; then
docker build ${DOCKER_BUILD_ARGS} -qt syscall-test contrib/syscall-test > /dev/null
fi

View File

@@ -0,0 +1,63 @@
#!/bin/bash
rm -rf autogen
cat > dockerversion/version_autogen.go <<DVEOF
// +build autogen
// Package dockerversion is auto-generated at build-time
package dockerversion
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
GitCommit string = "$GITCOMMIT"
Version string = "$VERSION"
BuildTime string = "$BUILDTIME"
IAmStatic string = "${IAMSTATIC:-true}"
)
// AUTOGENERATED FILE; see $BASH_SOURCE
DVEOF
# Compile the Windows resources into the sources
mkdir -p autogen/winresources
cat > autogen/winresources/resources.go <<WREOF
// Package winresources is auto-generated at build-time
// AUTOGENERATED FILE; see $BASH_SOURCE
package winresources
/*
This package is for embedding a manifest file and an icon into docker.exe.
The benefit of this is that a manifest file does not need to be alongside
the .exe, and there is an icon when docker runs, or viewed through Windows
explorer.
When make binary is run, the Dockerfile prepares the build environment by:
- Cloning github.com/akavel/rsrc
- Go-installing the rsrc executable
make.sh invokes hack/make/.go-autogen to:
- Run rsrc to create a binary file (autogen/winresources/rsrc.syso) that
contains the manifest and icon. This file is automatically picked up by
'go build', so no post-processing steps are required. The sources for
rsrc.syso are under hack/make/.resources-windows.
*/
WREOF
if [ "$(go env GOOS)" = 'windows' ]; then
rsrc \
-manifest hack/make/.resources-windows/docker.exe.manifest \
-ico hack/make/.resources-windows/docker.ico \
-arch "amd64" \
-o autogen/winresources/rsrc_amd64.syso > /dev/null
rsrc \
-manifest hack/make/.resources-windows/docker.exe.manifest \
-ico hack/make/.resources-windows/docker.ico \
-arch "386" \
-o autogen/winresources/rsrc_386.syso > /dev/null
fi

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
bundle .detect-daemon-osarch
if [ $DOCKER_ENGINE_GOOS != "windows" ]; then
bundle .ensure-emptyfs
bundle .ensure-frozen-images
bundle .ensure-httpserver
bundle .ensure-syscall-test
else
# Note this is Windows to Windows CI, not Windows to Linux CI
bundle .ensure-frozen-images-windows
fi

View File

@@ -0,0 +1,92 @@
#!/bin/bash
# see test-integration-cli for example usage of this script
export PATH="$ABS_DEST/../binary:$ABS_DEST/../dynbinary:$ABS_DEST/../gccgo:$ABS_DEST/../dyngccgo:$PATH"
if ! command -v docker &> /dev/null; then
echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start'
false
fi
# intentionally open a couple bogus file descriptors to help test that they get scrubbed in containers
exec 41>&1 42>&2
export DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER:-vfs}
export DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
storage_params=""
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
IFS=','
for i in ${DOCKER_STORAGE_OPTS}; do
storage_params="--storage-opt $i $storage_params"
done
unset IFS
fi
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
extra_params=""
if [ "$DOCKER_REMAP_ROOT" ]; then
extra_params="--userns-remap $DOCKER_REMAP_ROOT"
fi
if [ -z "$DOCKER_TEST_HOST" ]; then
# Start apparmor if it is enabled
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
# reset container variable so apparmor profile is applied to process
# see https://github.com/docker/libcontainer/blob/master/apparmor/apparmor.go#L16
export container=""
(
set -x
/etc/init.d/apparmor start
)
fi
export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock" # "pwd" tricks to make sure $DEST is an absolute path, not a relative one
( set -x; exec \
docker daemon --debug \
--host "$DOCKER_HOST" \
--storage-driver "$DOCKER_GRAPHDRIVER" \
--pidfile "$DEST/docker.pid" \
--userland-proxy="$DOCKER_USERLANDPROXY" \
$storage_params \
$extra_params \
&> "$DEST/docker.log"
) &
# make sure that if the script exits unexpectedly, we stop this daemon we just started
trap 'bundle .integration-daemon-stop' EXIT
else
export DOCKER_HOST="$DOCKER_TEST_HOST"
fi
# give it a little time to come up so it's "ready"
tries=60
echo "INFO: Waiting for daemon to start..."
while ! docker version &> /dev/null; do
(( tries-- ))
if [ $tries -le 0 ]; then
printf "\n"
if [ -z "$DOCKER_HOST" ]; then
echo >&2 "error: daemon failed to start"
echo >&2 " check $DEST/docker.log for details"
else
echo >&2 "error: daemon at $DOCKER_HOST fails to 'docker version':"
docker version >&2 || true
# Additional Windows CI debugging as this is a common error as of
# January 2016
if [ "$(go env GOOS)" = 'windows' ]; then
echo >&2 "Container log below:"
echo >&2 "---"
# Important - use the docker on the CI host, not the one built locally
# which is currently in our path.
! /c/bin/docker -H=$MAIN_DOCKER_HOST logs docker-$COMMITHASH
echo >&2 "---"
fi
fi
false
fi
printf "."
sleep 2
done
printf "\n"

View File

@@ -0,0 +1,27 @@
#!/bin/bash
if [ ! "$(go env GOOS)" = 'windows' ]; then
trap - EXIT # reset EXIT trap applied in .integration-daemon-start
for pidFile in $(find "$DEST" -name docker.pid); do
pid=$(set -x; cat "$pidFile")
( set -x; kill "$pid" )
if ! wait "$pid"; then
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
fi
done
if [ -z "$DOCKER_TEST_HOST" ]; then
# Stop apparmor if it is enabled
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
(
set -x
/etc/init.d/apparmor stop
)
fi
fi
else
# Note this script is not actionable on Windows to Linux CI. Instead the
# DIND daemon under test is torn down by the Jenkins tear-down script
echo "INFO: Not stopping daemon on Windows CI"
fi

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Docker</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 KiB

33
vendor/github.com/hyperhq/hypercli/hack/make/.validate generated vendored Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
if [ -z "$VALIDATE_UPSTREAM" ]; then
# this is kind of an expensive check, so let's not do this twice if we
# are running more than one validate bundlescript
VALIDATE_REPO='https://github.com/docker/docker.git'
VALIDATE_BRANCH='master'
if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
VALIDATE_BRANCH="${TRAVIS_BRANCH}"
fi
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
validate_diff() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git diff "$VALIDATE_COMMIT_DIFF" "$@"
fi
}
validate_log() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git log "$VALIDATE_COMMIT_LOG" "$@"
fi
}
fi

17
vendor/github.com/hyperhq/hypercli/hack/make/README.md generated vendored Normal file
View File

@@ -0,0 +1,17 @@
This directory holds scripts called by `make.sh` in the parent directory.
Each script is named after the bundle it creates.
They should not be called directly - instead, pass it as argument to make.sh, for example:
```
./hack/make.sh test
./hack/make.sh binary ubuntu
# Or to run all bundles:
./hack/make.sh
```
To add a bundle:
* Create a shell-compatible file here
* Add it to $DEFAULT_BUNDLES in make.sh

64
vendor/github.com/hyperhq/hypercli/hack/make/binary generated vendored Normal file
View File

@@ -0,0 +1,64 @@
#!/bin/bash
set -e
BINARY_NAME="docker-$VERSION"
BINARY_EXTENSION="$(binary_extension)"
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
source "${MAKEDIR}/.go-autogen"
(
export GOGC=${DOCKER_BUILD_GOGC:-1000}
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
# must be cross-compiling!
case "$(go env GOOS)/$(go env GOARCH)" in
windows/amd64)
export CC=x86_64-w64-mingw32-gcc
export CGO_ENABLED=1
;;
esac
fi
if [ "$(go env GOOS)" == "linux" ] ; then
case "$(go env GOARCH)" in
arm*|386)
# linking for Linux on arm or x86 needs external linking to avoid
# https://github.com/golang/go/issues/9510 until we move to Go 1.6
if [ "$IAMSTATIC" == "true" ] ; then
export EXTLDFLAGS_STATIC="$EXTLDFLAGS_STATIC -zmuldefs"
export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC -extldflags \"$EXTLDFLAGS_STATIC\""
else
export LDFLAGS="$LDFLAGS -extldflags -zmuldefs"
fi
;;
esac
fi
if [ "$IAMSTATIC" == "true" ] && [ "$(go env GOHOSTOS)" == "linux" ] && [ "$DOCKER_EXPERIMENTAL" ]; then
if [ "${GOOS}/${GOARCH}" == "darwin/amd64" ]; then
export CGO_ENABLED=1
export CC=o64-clang
export LDFLAGS='-linkmode external -s'
export LDFLAGS_STATIC_DOCKER='-extld='${CC}
else
export BUILDFLAGS=( "${BUILDFLAGS[@]/pkcs11 /}" ) # we cannot dlopen in pkcs11 in a static binary
fi
fi
echo "Building: $DEST/$BINARY_FULLNAME"
go build \
-o "$DEST/$BINARY_FULLNAME" \
"${BUILDFLAGS[@]}" \
-ldflags "
$LDFLAGS
$LDFLAGS_STATIC_DOCKER
" \
./docker
)
echo "Created binary: $DEST/$BINARY_FULLNAME"
ln -sf "$BINARY_FULLNAME" "$DEST/docker$BINARY_EXTENSION"
hash_files "$DEST/$BINARY_FULLNAME"

79
vendor/github.com/hyperhq/hypercli/hack/make/build-deb generated vendored Normal file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
set -e
# subshell so that we can export PATH and TZ without breaking other things
(
export TZ=UTC # make sure our "date" variables are UTC-based
bundle .integration-daemon-start
bundle .detect-daemon-osarch
# TODO consider using frozen images for the dockercore/builder-deb tags
tilde='~' # ouch Bash 4.2 vs 4.3, you keel me
debVersion="${VERSION//-/$tilde}" # using \~ or '~' here works in 4.3, but not 4.2; just ~ causes $HOME to be inserted, hence the $tilde
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
gitUnix="$(git log -1 --pretty='%at')"
gitDate="$(date --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
gitCommit="$(git log -1 --pretty='%h')"
gitVersion="git${gitDate}.0.${gitCommit}"
# gitVersion is now something like 'git20150128.112847.0.17e840a'
debVersion="$debVersion~$gitVersion"
# $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false
# true
# $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false
# true
# $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false
# true
# ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a
fi
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' hack/make/.build-deb/control)"
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' hack/make/.build-deb/control)"
debDate="$(date --rfc-2822)"
# if go-md2man is available, pre-generate the man pages
./man/md2man-all.sh -q || true
# TODO decide if it's worth getting go-md2man in _each_ builder environment to avoid this
builderDir="contrib/builder/deb/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
fi
for dir in "${pkgs[@]}"; do
[ -d "$dir" ] || { echo >&2 "skipping nonexistent $dir"; continue; }
version="$(basename "$dir")"
suite="${version##*-}"
image="dockercore/builder-deb:$version"
if ! docker inspect "$image" &> /dev/null; then
( set -x && docker build ${DOCKER_BUILD_ARGS} -t "$image" "$dir" )
fi
mkdir -p "$DEST/$version"
cat > "$DEST/$version/Dockerfile.build" <<-EOF
FROM $image
WORKDIR /usr/src/docker
COPY . /usr/src/docker
RUN mkdir -p /go/src/github.com/docker \
&& ln -snf /usr/src/docker /go/src/github.com/docker/docker
EOF
if [ "$DOCKER_EXPERIMENTAL" ]; then
echo 'ENV DOCKER_EXPERIMENTAL 1' >> "$DEST/$version/Dockerfile.build"
fi
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN ln -sfv hack/make/.build-deb debian
RUN { echo '$debSource (${debVersion}-0~${suite}) $suite; urgency=low'; echo; echo ' * Version: $VERSION'; echo; echo " -- $debMaintainer $debDate"; } > debian/changelog && cat >&2 debian/changelog
RUN dpkg-buildpackage -uc -us
EOF
tempImage="docker-temp/build-deb:$version"
( set -x && docker build -t "$tempImage" -f "$DEST/$version/Dockerfile.build" . )
docker run --rm "$tempImage" bash -c 'cd .. && tar -c *_*' | tar -xvC "$DEST/$version"
docker rmi "$tempImage"
done
bundle .integration-daemon-stop
) 2>&1 | tee -a "$DEST/test.log"

130
vendor/github.com/hyperhq/hypercli/hack/make/build-rpm generated vendored Normal file
View File

@@ -0,0 +1,130 @@
#!/bin/bash
set -e
# subshell so that we can export PATH and TZ without breaking other things
(
export TZ=UTC # make sure our "date" variables are UTC-based
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
# TODO consider using frozen images for the dockercore/builder-rpm tags
rpmName=docker-engine
rpmVersion="$VERSION"
rpmRelease=1
# rpmRelease versioning is as follows
# Docker 1.7.0: version=1.7.0, release=1
# Docker 1.7.0-rc1: version=1.7.0, release=0.1.rc1
# Docker 1.7.0-cs1: version=1.7.0.cs1, release=1
# Docker 1.7.0-cs1-rc1: version=1.7.0.cs1, release=0.1.rc1
# Docker 1.7.0-dev nightly: version=1.7.0, release=0.0.YYYYMMDD.HHMMSS.gitHASH
# if we have a "-rc*" suffix, set appropriate release
if [[ "$rpmVersion" =~ .*-rc[0-9]+$ ]] ; then
rcVersion=${rpmVersion#*-rc}
rpmVersion=${rpmVersion%-rc*}
rpmRelease="0.${rcVersion}.rc${rcVersion}"
fi
DOCKER_GITCOMMIT=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DOCKER_GITCOMMIT="$DOCKER_GITCOMMIT-unsupported"
fi
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
if [[ "$rpmVersion" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
gitUnix="$(git log -1 --pretty='%at')"
gitDate="$(date --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
gitCommit="$(git log -1 --pretty='%h')"
gitVersion="${gitDate}.git${gitCommit}"
# gitVersion is now something like '20150128.112847.17e840a'
rpmVersion="${rpmVersion%-dev}"
rpmRelease="0.0.$gitVersion"
fi
# Replace any other dashes with periods
rpmVersion="${rpmVersion/-/.}"
rpmPackager="$(awk -F ': ' '$1 == "Packager" { print $2; exit }' hack/make/.build-rpm/${rpmName}.spec)"
rpmDate="$(date +'%a %b %d %Y')"
# if go-md2man is available, pre-generate the man pages
./man/md2man-all.sh -q || true
# TODO decide if it's worth getting go-md2man in _each_ builder environment to avoid this
# Convert the CHANGELOG.md file into RPM changelog format
VERSION_REGEX="^\W\W (.*) \((.*)\)$"
ENTRY_REGEX="^[-+*] (.*)$"
while read -r line || [[ -n "$line" ]]; do
if [ -z "$line" ]; then continue; fi
if [[ "$line" =~ $VERSION_REGEX ]]; then
echo >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
echo "* `date -d ${BASH_REMATCH[2]} '+%a %b %d %Y'` ${rpmPackager} - ${BASH_REMATCH[1]}" >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
fi
if [[ "$line" =~ $ENTRY_REGEX ]]; then
echo "- ${BASH_REMATCH[1]//\`}" >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
fi
done < CHANGELOG.md
builderDir="contrib/builder/rpm/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
fi
for dir in "${pkgs[@]}"; do
[ -d "$dir" ] || { echo >&2 "skipping nonexistent $dir"; continue; }
version="$(basename "$dir")"
suite="${version##*-}"
image="dockercore/builder-rpm:$version"
if ! docker inspect "$image" &> /dev/null; then
( set -x && docker build ${DOCKER_BUILD_ARGS} -t "$image" "$dir" )
fi
mkdir -p "$DEST/$version"
cat > "$DEST/$version/Dockerfile.build" <<-EOF
FROM $image
COPY . /usr/src/${rpmName}
EOF
if [ "$DOCKER_EXPERIMENTAL" ]; then
echo 'ENV DOCKER_EXPERIMENTAL 1' >> "$DEST/$version/Dockerfile.build"
fi
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN mkdir -p /root/rpmbuild/SOURCES \
&& echo '%_topdir /root/rpmbuild' > /root/.rpmmacros
WORKDIR /root/rpmbuild
RUN ln -sfv /usr/src/${rpmName}/hack/make/.build-rpm SPECS
WORKDIR /root/rpmbuild/SPECS
RUN tar -cz -C /usr/src -f /root/rpmbuild/SOURCES/${rpmName}.tar.gz ${rpmName}
RUN { cat /usr/src/${rpmName}/contrib/builder/rpm/${PACKAGE_ARCH}/changelog; } >> ${rpmName}.spec && tail >&2 ${rpmName}.spec
RUN rpmbuild -ba \
--define '_gitcommit $DOCKER_GITCOMMIT' \
--define '_release $rpmRelease' \
--define '_version $rpmVersion' \
--define '_origversion $VERSION' \
--define '_experimental ${DOCKER_EXPERIMENTAL:-0}' \
${rpmName}.spec
EOF
# selinux policy referencing systemd things won't work on non-systemd versions
# of centos or rhel, which we don't support anyways
if [ "${suite%.*}" -gt 6 ] && [[ "$version" != opensuse* ]]; then
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN tar -cz -C /usr/src/${rpmName}/contrib -f /root/rpmbuild/SOURCES/${rpmName}-selinux.tar.gz ${rpmName}-selinux
RUN rpmbuild -ba \
--define '_gitcommit $DOCKER_GITCOMMIT' \
--define '_release $rpmRelease' \
--define '_version $rpmVersion' \
--define '_origversion $VERSION' \
${rpmName}-selinux.spec
EOF
fi
tempImage="docker-temp/build-rpm:$version"
( set -x && docker build -t "$tempImage" -f $DEST/$version/Dockerfile.build . )
docker run --rm "$tempImage" bash -c 'cd /root/rpmbuild && tar -c *RPMS' | tar -xvC "$DEST/$version"
docker rmi "$tempImage"
done
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"
) 2>&1 | tee -a $DEST/test.log

43
vendor/github.com/hyperhq/hypercli/hack/make/clean-apt-repo generated vendored Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -e
# This script cleans the experimental pool for the apt repo.
# This is useful when there are a lot of old experimental debs and you only want to keep the most recent.
#
: ${DOCKER_RELEASE_DIR:=$DEST}
APTDIR=$DOCKER_RELEASE_DIR/apt/repo/pool/experimental
: ${DOCKER_ARCHIVE_DIR:=$DEST/archive}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
latest_versions=$(dpkg-scanpackages "$APTDIR" /dev/null 2>/dev/null | awk -F ': ' '$1 == "Filename" { print $2 }')
# get the latest version
latest_docker_engine_file=$(echo "$latest_versions" | grep docker-engine)
latest_docker_engine_version=$(basename ${latest_docker_engine_file%~*})
echo "latest docker-engine version: $latest_docker_engine_version"
# remove all the files that are not that version in experimental
pool_dir=$(dirname "$latest_docker_engine_file")
old_pkgs=( $(ls "$pool_dir" | grep -v "^${latest_docker_engine_version}" | grep "${latest_docker_engine_version%%~git*}") )
echo "${old_pkgs[@]}"
mkdir -p "$DOCKER_ARCHIVE_DIR"
for old_pkg in "${old_pkgs[@]}"; do
echo "moving ${pool_dir}/${old_pkg} to $DOCKER_ARCHIVE_DIR"
mv "${pool_dir}/${old_pkg}" "$DOCKER_ARCHIVE_DIR"
done
echo
echo "$pool_dir now has contents:"
ls "$pool_dir"
# now regenerate release files for experimental
export COMPONENT=experimental
source "${DIR}/update-apt-repo"
echo "You will now want to: "
echo " - re-sign the repo with hack/make/sign-repo"
echo " - re-generate index files with hack/make/generate-index-listing"

20
vendor/github.com/hyperhq/hypercli/hack/make/clean-yum-repo generated vendored Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
# This script cleans the experimental pool for the yum repo.
# This is useful when there are a lot of old experimental rpms and you only want to keep the most recent.
#
: ${DOCKER_RELEASE_DIR:=$DEST}
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo/experimental
suites=( $(find "$YUMDIR" -mindepth 1 -maxdepth 1 -type d) )
for suite in "${suites[@]}"; do
echo "cleanup in: $suite"
( set -x; repomanage -k2 --old "$suite" | xargs rm -f )
done
echo "You will now want to: "
echo " - re-sign the repo with hack/make/sign-repo"
echo " - re-generate index files with hack/make/generate-index-listing"

20
vendor/github.com/hyperhq/hypercli/hack/make/cover generated vendored Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
bundle_cover() {
coverprofiles=( "$DEST/../"*"/coverprofiles/"* )
for p in "${coverprofiles[@]}"; do
echo
(
set -x
go tool cover -func="$p"
)
done
}
if [ "$HAVE_GO_TEST_COVER" ]; then
bundle_cover 2>&1 | tee "$DEST/report.log"
else
echo >&2 'warning: the current version of go does not support -cover'
echo >&2 ' skipping test coverage report'
fi

34
vendor/github.com/hyperhq/hypercli/hack/make/cross generated vendored Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
# explicit list of os/arch combos that support being a daemon
declare -A daemonSupporting
daemonSupporting=(
[linux/amd64]=1
[windows/amd64]=1
)
# if we have our linux/amd64 version compiled, let's symlink it in
if [ -x "$DEST/../binary/docker-$VERSION" ]; then
mkdir -p "$DEST/linux/amd64"
(
cd "$DEST/linux/amd64"
ln -s ../../../binary/* ./
)
echo "Created symlinks:" "$DEST/linux/amd64/"*
fi
for platform in $DOCKER_CROSSPLATFORMS; do
(
export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
mkdir -p "$DEST"
ABS_DEST="$(cd "$DEST" && pwd -P)"
export GOOS=${platform%/*}
export GOARCH=${platform##*/}
if [ -z "${daemonSupporting[$platform]}" ]; then
export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
fi
source "${MAKEDIR}/binary"
)
done

10
vendor/github.com/hyperhq/hypercli/hack/make/dynbinary generated vendored Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
(
export IAMSTATIC="false"
export LDFLAGS_STATIC_DOCKER=''
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
source "${MAKEDIR}/binary"
)

11
vendor/github.com/hyperhq/hypercli/hack/make/dyngccgo generated vendored Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
(
export IAMSTATIC="false"
export EXTLDFLAGS_STATIC=''
export LDFLAGS_STATIC_DOCKER=''
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
source "${MAKEDIR}/gccgo"
)

29
vendor/github.com/hyperhq/hypercli/hack/make/gccgo generated vendored Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
BINARY_NAME="docker-$VERSION"
BINARY_EXTENSION="$(binary_extension)"
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
source "${MAKEDIR}/.go-autogen"
if [[ "${BUILDFLAGS[@]}" =~ 'netgo ' ]]; then
EXTLDFLAGS_STATIC+=' -lnetgo'
fi
# gccgo require explicit flag -pthread to allow goroutines to work.
go build -compiler=gccgo \
-o "$DEST/$BINARY_FULLNAME" \
"${BUILDFLAGS[@]}" \
-gccgoflags "
-g
$EXTLDFLAGS_STATIC
-Wl,--no-export-dynamic
-ldl
-pthread
" \
./docker
echo "Created binary: $DEST/$BINARY_FULLNAME"
ln -sf "$BINARY_FULLNAME" "$DEST/docker$BINARY_EXTENSION"
hash_files "$DEST/$BINARY_FULLNAME"

View File

@@ -0,0 +1,74 @@
#!/bin/bash
set -e
# This script generates index files for the directory structure
# of the apt and yum repos
: ${DOCKER_RELEASE_DIR:=$DEST}
APTDIR=$DOCKER_RELEASE_DIR/apt
YUMDIR=$DOCKER_RELEASE_DIR/yum
if [ ! -d $APTDIR ] && [ ! -d $YUMDIR ]; then
echo >&2 'release-rpm or release-deb must be run before generate-index-listing'
exit 1
fi
create_index() {
local directory=$1
local original=$2
local cleaned=${directory#$original}
# the index file to create
local index_file="${directory}/index"
# cd into dir & touch the index file
cd $directory
touch $index_file
# print the html header
cat <<-EOF > "$index_file"
<!DOCTYPE html>
<html>
<head><title>Index of ${cleaned}/</title></head>
<body bgcolor="white">
<h1>Index of ${cleaned}/</h1><hr>
<pre><a href="../">../</a>
EOF
# start of content output
(
# change IFS locally within subshell so the for loop saves line correctly to L var
IFS=$'\n';
# pretty sweet, will mimick the normal apache output
for L in $(find -L . -mount -depth -maxdepth 1 -type f ! -name 'index' -printf "<a href=\"%f\">%-44f@_@%Td-%Tb-%TY %Tk:%TM @%f@\n"|sort|sed 's,\([\ ]\+\)@_@,</a>\1,g');
do
# file
F=$(sed -e 's,^.*@\([^@]\+\)@.*$,\1,g'<<<"$L");
# file with file size
F=$(du -bh $F | cut -f1);
# output with correct format
sed -e 's,\ @.*$, '"$F"',g'<<<"$L";
done;
) >> $index_file;
# now output a list of all directories in this dir (maxdepth 1) other than '.' outputting in a sorted manner exactly like apache
find -L . -mount -depth -maxdepth 1 -type d ! -name '.' -printf "<a href=\"%f\">%-43f@_@%Td-%Tb-%TY %Tk:%TM -\n"|sort -d|sed 's,\([\ ]\+\)@_@,/</a>\1,g' >> $index_file
# print the footer html
echo "</pre><hr></body></html>" >> $index_file
}
get_dirs() {
local directory=$1
for d in `find ${directory} -type d`; do
create_index $d $directory
done
}
get_dirs $APTDIR
get_dirs $YUMDIR

View File

@@ -0,0 +1,63 @@
#!/bin/bash
set -e
# This script modifies the install.sh script for domains and keys other than
# those used by the primary opensource releases.
#
# You can provide `url`, `yum_url`, `apt_url` and optionally `gpg_fingerprint`
# or `GPG_KEYID` as environment variables, or the defaults for open source are used.
#
# The lower-case variables are substituted into install.sh.
#
# gpg_fingerprint and GPG_KEYID are optional, defaulting to the opensource release
# key ("releasedocker"). Other GPG_KEYIDs will require you to mount a volume with
# the correct contents to /root/.gnupg.
#
# It outputs the modified `install.sh` file to $DOCKER_RELEASE_DIR (default: $DEST)
#
# Example usage:
#
# docker run \
# --rm \
# --privileged \
# -e "GPG_KEYID=deadbeef" \
# -e "GNUPGHOME=/root/.gnupg" \
# -v $HOME/.gnupg:/root/.gnupg \
# -v $(pwd):/go/src/github.com/docker/docker/bundles \
# "$IMAGE_DOCKER" \
# hack/make.sh install-script
: ${DOCKER_RELEASE_DIR:=$DEST}
: ${GPG_KEYID:=releasedocker}
DEFAULT_URL="https://get.docker.com/"
DEFAULT_APT_URL="https://apt.dockerproject.org"
DEFAULT_YUM_URL="https://yum.dockerproject.org"
DEFAULT_GPG_FINGERPRINT="58118E89F3A912897C070ADBF76221572C52609D"
: ${url:=$DEFAULT_URL}
: ${apt_url:=$DEFAULT_APT_URL}
: ${yum_url:=$DEFAULT_YUM_URL}
if [[ "$GPG_KEYID" == "releasedocker" ]] ; then
: ${gpg_fingerprint:=$DEFAULT_GPG_FINGERPRINT}
fi
DEST_FILE="$DOCKER_RELEASE_DIR/install.sh"
bundle_install_script() {
mkdir -p "$DOCKER_RELEASE_DIR"
if [[ -z "$gpg_fingerprint" ]] ; then
# NOTE: if no key matching key is in /root/.gnupg, this will fail
gpg_fingerprint=$(gpg --with-fingerprint -k "$GPG_KEYID" | grep "Key fingerprint" | awk -F "=" '{print $2};' | tr -d ' ')
fi
cp hack/install.sh "$DEST_FILE"
sed -i.bak 's#^url=".*"$#url="'"$url"'"#' "$DEST_FILE"
sed -i.bak 's#^apt_url=".*"$#apt_url="'"$apt_url"'"#' "$DEST_FILE"
sed -i.bak 's#^yum_url=".*"$#yum_url="'"$yum_url"'"#' "$DEST_FILE"
sed -i.bak 's#^gpg_fingerprint=".*"$#gpg_fingerprint="'"$gpg_fingerprint"'"#' "$DEST_FILE"
rm "${DEST_FILE}.bak"
}
bundle_install_script

147
vendor/github.com/hyperhq/hypercli/hack/make/release-deb generated vendored Executable file
View File

@@ -0,0 +1,147 @@
#!/bin/bash
set -e
# This script creates the apt repos for the .deb files generated by hack/make/build-deb
#
# The following can then be used as apt sources:
# deb http://apt.dockerproject.org/repo $distro-$release $version
#
# For example:
# deb http://apt.dockerproject.org/repo ubuntu-trusty main
# deb http://apt.dockerproject.org/repo ubuntu-trusty testing
# deb http://apt.dockerproject.org/repo debian-wheezy experimental
# deb http://apt.dockerproject.org/repo debian-jessie main
#
# ... and so on and so forth for the builds created by hack/make/build-deb
: ${DOCKER_RELEASE_DIR:=$DEST}
: ${GPG_KEYID:=releasedocker}
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
# setup the apt repo (if it does not exist)
mkdir -p "$APTDIR/conf" "$APTDIR/db"
# supported arches/sections
arches=( amd64 i386 )
# Preserve existing components but don't add any non-existing ones
for component in main testing experimental ; do
if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then
components+=( $component )
fi
done
# set the component for the version being released
component="main"
if [[ "$VERSION" == *-rc* ]]; then
component="testing"
fi
if [ "$DOCKER_EXPERIMENTAL" ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
component="experimental"
fi
# Make sure our component is in the list of components
if [[ ! "${components[*]}" =~ $component ]] ; then
components+=( $component )
fi
# create/update apt-ftparchive file
if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then
cat <<-EOF > "$APTDIR/conf/apt-ftparchive.conf"
Dir {
ArchiveDir "${APTDIR}";
CacheDir "${APTDIR}/db";
};
Default {
Packages::Compress ". gzip bzip2";
Sources::Compress ". gzip bzip2";
Contents::Compress ". gzip bzip2";
};
TreeDefault {
BinCacheDB "packages-\$(SECTION)-\$(ARCH).db";
Directory "pool/\$(SECTION)";
Packages "\$(DIST)/\$(SECTION)/binary-\$(ARCH)/Packages";
SrcDirectory "pool/\$(SECTION)";
Sources "\$(DIST)/\$(SECTION)/source/Sources";
Contents "\$(DIST)/\$(SECTION)/Contents-\$(ARCH)";
FileList "$APTDIR/\$(DIST)/\$(SECTION)/filelist";
};
EOF
for suite in $(exec contrib/reprepro/suites.sh); do
cat <<-EOF
Tree "dists/${suite}" {
Sections "${components[*]}";
Architectures "${arches[*]}";
}
EOF
done >> "$APTDIR/conf/apt-ftparchive.conf"
fi
if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then
cat <<-EOF > "$APTDIR/conf/docker-engine-release.conf"
APT::FTPArchive::Release::Origin "Docker";
APT::FTPArchive::Release::Components "${components[*]}";
APT::FTPArchive::Release::Label "Docker APT Repository";
APT::FTPArchive::Release::Architectures "${arches[*]}";
EOF
fi
# release the debs
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
version="$(basename "$dir")"
codename="${version//debootstrap-}"
DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb )
# if we have a $GPG_PASSPHRASE we may as well
# dpkg-sign before copying the deb into the pool
if [ ! -z "$GPG_PASSPHRASE" ]; then
dpkg-sig -g "--no-tty --passphrase '$GPG_PASSPHRASE'" \
-k "$GPG_KEYID" --sign builder "${DEBFILE[@]}"
fi
# add the deb for each component for the distro version into the pool
mkdir -p "$APTDIR/pool/$component/d/docker-engine/"
cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/"
# update the filelist for this codename/component
mkdir -p "$APTDIR/dists/$codename/$component"
find "$APTDIR/pool/$component" \
-name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
done
# clean the databases
apt-ftparchive clean "$APTDIR/conf/apt-ftparchive.conf"
# run the apt-ftparchive commands so we can have pinning
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
version="$(basename "$dir")"
codename="${version//debootstrap-}"
apt-ftparchive \
-o "APT::FTPArchive::Release::Codename=$codename" \
-o "APT::FTPArchive::Release::Suite=$codename" \
-c "$APTDIR/conf/docker-engine-release.conf" \
release \
"$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
for arch in "${arches[@]}"; do
mkdir -p "$APTDIR/dists/$codename/$component/binary-$arch"
apt-ftparchive \
-o "APT::FTPArchive::Release::Codename=$codename" \
-o "APT::FTPArchive::Release::Suite=$codename" \
-o "APT::FTPArchive::Release::Component=$component" \
-o "APT::FTPArchive::Release::Architecture=$arch" \
-c "$APTDIR/conf/docker-engine-release.conf" \
release \
"$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
done
done

75
vendor/github.com/hyperhq/hypercli/hack/make/release-rpm generated vendored Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
set -e
# This script creates the yum repos for the .rpm files generated by hack/make/build-rpm
#
# The following can then be used as a yum repo:
# http://yum.dockerproject.org/repo/$release/$distro/$distro-version
#
# For example:
# http://yum.dockerproject.org/repo/main/fedora/23
# http://yum.dockerproject.org/repo/testing/centos/7
# http://yum.dockerproject.org/repo/experimental/fedora/23
# http://yum.dockerproject.org/repo/main/centos/7
#
# ... and so on and so forth for the builds created by hack/make/build-rpm
: ${DOCKER_RELEASE_DIR:=$DEST}
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
: ${GPG_KEYID:=releasedocker}
# manage the repos for each distribution separately
distros=( fedora centos opensuse oraclelinux )
# get the release
release="main"
if [[ "$VERSION" == *-rc* ]]; then
release="testing"
fi
if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
release="experimental"
fi
for distro in "${distros[@]}"; do
# Setup the yum repo
REPO=$YUMDIR/$release/$distro
for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
version="$(basename "$dir")"
suite="${version##*-}"
# if the directory does not exist, initialize the yum repo
if [[ ! -d $REPO/$suite/Packages ]]; then
mkdir -p "$REPO/$suite/Packages"
createrepo --pretty "$REPO/$suite"
fi
# path to rpms
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
# if we have a $GPG_PASSPHRASE we may as well
# sign the rpms before adding to repo
if [ ! -z $GPG_PASSPHRASE ]; then
# export our key to rpm import
gpg --armor --export "$GPG_KEYID" > /tmp/gpg
rpm --import /tmp/gpg
# sign the rpms
echo "yes" | setsid rpm \
--define "_gpg_name $GPG_KEYID" \
--define "_signature gpg" \
--define "__gpg_check_password_cmd /bin/true" \
--define "__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}" \
--resign "${RPMFILE[@]}"
fi
# copy the rpms to the packages folder
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
# update the repo
createrepo --pretty --update "$REPO/$suite"
done
done

55
vendor/github.com/hyperhq/hypercli/hack/make/sign-repos generated vendored Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
# This script signs the deliverables from release-deb and release-rpm
# with a designated GPG key.
: ${DOCKER_RELEASE_DIR:=$DEST}
: ${GPG_KEYID:=releasedocker}
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
if [ -z "$GPG_PASSPHRASE" ]; then
echo >&2 'you need to set GPG_PASSPHRASE in order to sign artifacts'
exit 1
fi
if [ ! -d $APTDIR ] && [ ! -d $YUMDIR ]; then
echo >&2 'release-rpm or release-deb must be run before sign-repos'
exit 1
fi
sign_packages(){
# sign apt repo metadata
if [ -d $APTDIR ]; then
# create file with public key
gpg --armor --export "$GPG_KEYID" > "$DOCKER_RELEASE_DIR/apt/gpg"
# sign the repo metadata
for F in $(find $APTDIR -name Release); do
if test "$F" -nt "$F.gpg" ; then
gpg -u "$GPG_KEYID" --passphrase "$GPG_PASSPHRASE" \
--armor --sign --detach-sign \
--batch --yes \
--output "$F.gpg" "$F"
fi
done
fi
# sign yum repo metadata
if [ -d $YUMDIR ]; then
# create file with public key
gpg --armor --export "$GPG_KEYID" > "$DOCKER_RELEASE_DIR/yum/gpg"
# sign the repo metadata
for F in $(find $YUMDIR -name repomd.xml); do
if test "$F" -nt "$F.asc" ; then
gpg -u "$GPG_KEYID" --passphrase "$GPG_PASSPHRASE" \
--armor --sign --detach-sign \
--batch --yes \
--output "$F.asc" "$F"
fi
done
fi
}
sign_packages

View File

@@ -0,0 +1,68 @@
#!/bin/bash
# This script is used for testing install.sh and that it works for
# each of component of our apt and yum repos
set -e
: ${DEB_DIR:="$(pwd)/bundles/$(cat VERSION)/build-deb"}
if [[ ! -d "${DEB_DIR}" ]]; then
echo "you must first run `make deb` or hack/make/build-deb"
exit 1
fi
test_deb_install(){
# test for each Dockerfile in contrib/builder
builderDir="contrib/builder/deb/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
fi
for dir in "${pkgs[@]}"; do
[ -d "$dir" ] || { echo >&2 "skipping nonexistent $dir"; continue; }
local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
local dir=$(basename "$dir")
if [[ ! -d "${DEB_DIR}/${dir}" ]]; then
echo "No deb found for ${dir}"
exit 1
fi
local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
cat <<-EOF > "${script}"
#!/bin/bash
set -e
set -x
apt-get update && apt-get install -y apparmor
dpkg -i /root/debs/*.deb || true
apt-get install -yf
/etc/init.d/apparmor start
# this will do everything _except_ load the profile into the kernel
(
cd /etc/apparmor.d
/sbin/apparmor_parser --skip-kernel-load docker-engine
)
EOF
chmod +x "${script}"
echo "testing deb install for ${from}"
docker run --rm -i --privileged \
-v ${DEB_DIR}/${dir}:/root/debs \
-v ${script}:/install.sh \
${from} /install.sh
rm -f ${script}
done
}
(
bundle .integration-daemon-start
test_deb_install
bundle .integration-daemon-stop
) 2>&1 | tee -a "$DEST/test.log"

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
# subshell so that we can export PATH without breaking other things
(
bundle .integration-daemon-start
dockerPy='/docker-py'
[ -d "$dockerPy" ] || {
dockerPy="$DEST/docker-py"
git clone https://github.com/docker/docker-py.git "$dockerPy"
}
# exporting PYTHONPATH to import "docker" from our local docker-py
test_env PYTHONPATH="$dockerPy" py.test "$dockerPy/tests/integration"
bundle .integration-daemon-stop
) 2>&1 | tee -a "$DEST/test.log"

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# This script is used for testing install.sh and that it works for
# each of component of our apt and yum repos
set -e
test_install_script(){
# these are equivalent to main, testing, experimental components
# in the repos, but its the url that will do the conversion
components=( experimental test get )
for component in "${components[@]}"; do
# change url to specific component for testing
local test_url=https://${component}.docker.com
local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
sed "s,url='https://get.docker.com/',url='${test_url}/'," hack/install.sh > "${script}"
chmod +x "${script}"
# test for each Dockerfile in contrib/builder
for dir in contrib/builder/*/*/; do
local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
echo "running install.sh for ${component} with ${from}"
docker run --rm -i -v ${script}:/install.sh ${from} /install.sh
done
rm -f ${script}
done
}
test_install_script

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
bundle_test_integration_cli() {
TESTFLAGS="$TESTFLAGS -check.v"
go_test_dir ./integration-cli
}
# subshell so that we can export PATH without breaking other things
(
bundle .integration-daemon-start
bundle .integration-daemon-setup
bundle_test_integration_cli
bundle .integration-daemon-stop
) 2>&1 | tee -a "$DEST/test.log"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
versions=( 1.3.3 1.4.1 1.5.0 1.6.2 )
install() {
local version=$1
local tmpdir=$(mktemp -d /tmp/XXXXXXXXXX)
local dockerfile="${tmpdir}/Dockerfile"
cat <<-EOF > "$dockerfile"
FROM debian:jessie
ENV VERSION ${version}
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
--no-install-recommends
RUN echo "deb https://get.docker.com/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
RUN apt-get update && apt-get install -y \
lxc-docker-\${VERSION}
EOF
docker build --rm --force-rm --no-cache -t docker-old-repo:${version} -f $dockerfile $tmpdir
}
for v in "${versions[@]}"; do
install "$v"
done

34
vendor/github.com/hyperhq/hypercli/hack/make/test-unit generated vendored Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
# Run Docker's test suite, including sub-packages, and store their output as a bundle
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
# You can use this to select certain tests to run, eg.
#
# TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
#
bundle_test_unit() {
date
if [ -z "$TESTDIRS" ]; then
TEST_PATH=./...
else
TEST_PATH=./${TESTDIRS}
fi
pkg_list=$(go list -e \
-f '{{if ne .Name "github.com/docker/docker"}}
{{.ImportPath}}
{{end}}' \
"${BUILDFLAGS[@]}" $TEST_PATH \
| grep github.com/docker/docker \
| grep -v github.com/docker/docker/vendor \
| grep -v github.com/docker/docker/integration-cli)
go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
}
if [[ "$(go version)" == *"gccgo"* ]]; then
GCCGOFLAGS=-gccgoflags="-lpthread"
else
COVER=-cover
fi
bundle_test_unit 2>&1 | tee -a "$DEST/test.log"

33
vendor/github.com/hyperhq/hypercli/hack/make/tgz generated vendored Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
CROSS="$DEST/../cross"
set -e
if [ ! -d "$CROSS/linux/amd64" ]; then
echo >&2 'error: binary and cross must be run before tgz'
false
fi
for d in "$CROSS/"*/*; do
GOARCH="$(basename "$d")"
GOOS="$(basename "$(dirname "$d")")"
BINARY_NAME="docker-$VERSION"
BINARY_EXTENSION="$(export GOOS && binary_extension)"
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
mkdir -p "$DEST/$GOOS/$GOARCH"
TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME.tgz"
mkdir -p "$DEST/build"
mkdir -p "$DEST/build/usr/local/bin"
cp -L "$d/$BINARY_FULLNAME" "$DEST/build/usr/local/bin/docker$BINARY_EXTENSION"
tar --numeric-owner --owner 0 -C "$DEST/build" -czf "$TGZ" usr
hash_files "$TGZ"
rm -rf "$DEST/build"
echo "Created tgz: $TGZ"
done

190
vendor/github.com/hyperhq/hypercli/hack/make/ubuntu generated vendored Normal file
View File

@@ -0,0 +1,190 @@
#!/bin/bash
PKGVERSION="${VERSION//-/'~'}"
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
GIT_UNIX="$(git log -1 --pretty='%at')"
GIT_DATE="$(date --date "@$GIT_UNIX" +'%Y%m%d.%H%M%S')"
GIT_COMMIT="$(git log -1 --pretty='%h')"
GIT_VERSION="git${GIT_DATE}.0.${GIT_COMMIT}"
# GIT_VERSION is now something like 'git20150128.112847.0.17e840a'
PKGVERSION="$PKGVERSION~$GIT_VERSION"
fi
# $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false
# true
# $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false
# true
# $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false
# true
# ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a
PACKAGE_ARCHITECTURE="$(dpkg-architecture -qDEB_HOST_ARCH)"
PACKAGE_URL="https://www.docker.com/"
PACKAGE_MAINTAINER="support@docker.com"
PACKAGE_DESCRIPTION="Linux container runtime
Docker complements LXC with a high-level API which operates at the process
level. It runs unix processes with strong guarantees of isolation and
repeatability across servers.
Docker is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment systems,
private PaaS, service-oriented architectures, etc."
PACKAGE_LICENSE="Apache-2.0"
# Build docker as an ubuntu package using FPM and REPREPRO (sue me).
# bundle_binary must be called first.
bundle_ubuntu() {
DIR="$ABS_DEST/build"
# Include our udev rules
mkdir -p "$DIR/etc/udev/rules.d"
cp contrib/udev/80-docker.rules "$DIR/etc/udev/rules.d/"
# Include our init scripts
mkdir -p "$DIR/etc/init"
cp contrib/init/upstart/docker.conf "$DIR/etc/init/"
mkdir -p "$DIR/etc/init.d"
cp contrib/init/sysvinit-debian/docker "$DIR/etc/init.d/"
mkdir -p "$DIR/etc/default"
cp contrib/init/sysvinit-debian/docker.default "$DIR/etc/default/docker"
mkdir -p "$DIR/lib/systemd/system"
cp contrib/init/systemd/docker.{service,socket} "$DIR/lib/systemd/system/"
# Include contributed completions
mkdir -p "$DIR/etc/bash_completion.d"
cp contrib/completion/bash/docker "$DIR/etc/bash_completion.d/"
mkdir -p "$DIR/usr/share/zsh/vendor-completions"
cp contrib/completion/zsh/_docker "$DIR/usr/share/zsh/vendor-completions/"
mkdir -p "$DIR/etc/fish/completions"
cp contrib/completion/fish/docker.fish "$DIR/etc/fish/completions/"
# Include contributed man pages
man/md2man-all.sh -q
manRoot="$DIR/usr/share/man"
mkdir -p "$manRoot"
for manDir in man/man?; do
manBase="$(basename "$manDir")" # "man1"
for manFile in "$manDir"/*; do
manName="$(basename "$manFile")" # "docker-build.1"
mkdir -p "$manRoot/$manBase"
gzip -c "$manFile" > "$manRoot/$manBase/$manName.gz"
done
done
# Copy the binary
# This will fail if the binary bundle hasn't been built
mkdir -p "$DIR/usr/bin"
cp "$DEST/../binary/docker-$VERSION" "$DIR/usr/bin/docker"
# Generate postinst/prerm/postrm scripts
cat > "$DEST/postinst" <<'EOF'
#!/bin/sh
set -e
set -u
if [ "$1" = 'configure' ] && [ -z "$2" ]; then
if ! getent group docker > /dev/null; then
groupadd --system docker
fi
fi
if ! { [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; }; then
# we only need to do this if upstart isn't in charge
update-rc.d docker defaults > /dev/null || true
fi
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
service docker $_dh_action 2>/dev/null || true
#DEBHELPER#
EOF
cat > "$DEST/prerm" <<'EOF'
#!/bin/sh
set -e
set -u
service docker stop 2>/dev/null || true
#DEBHELPER#
EOF
cat > "$DEST/postrm" <<'EOF'
#!/bin/sh
set -e
set -u
if [ "$1" = "purge" ] ; then
update-rc.d docker remove > /dev/null || true
fi
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload > /dev/null || true
fi
#DEBHELPER#
EOF
# TODO swaths of these were borrowed from debhelper's auto-inserted stuff, because we're still using fpm - we need to use debhelper instead, and somehow reconcile Ubuntu that way
chmod +x "$DEST/postinst" "$DEST/prerm" "$DEST/postrm"
(
# switch directories so we create *.deb in the right folder
cd "$DEST"
# create lxc-docker-VERSION package
fpm -s dir -C "$DIR" \
--name "lxc-docker-$VERSION" --version "$PKGVERSION" \
--after-install "$ABS_DEST/postinst" \
--before-remove "$ABS_DEST/prerm" \
--after-remove "$ABS_DEST/postrm" \
--architecture "$PACKAGE_ARCHITECTURE" \
--prefix / \
--depends iptables \
--deb-recommends aufs-tools \
--deb-recommends ca-certificates \
--deb-recommends git \
--deb-recommends xz-utils \
--deb-recommends 'cgroupfs-mount | cgroup-lite' \
--deb-suggests apparmor \
--description "$PACKAGE_DESCRIPTION" \
--maintainer "$PACKAGE_MAINTAINER" \
--conflicts docker \
--conflicts docker.io \
--conflicts lxc-docker-virtual-package \
--provides lxc-docker \
--provides lxc-docker-virtual-package \
--replaces lxc-docker \
--replaces lxc-docker-virtual-package \
--url "$PACKAGE_URL" \
--license "$PACKAGE_LICENSE" \
--config-files /etc/udev/rules.d/80-docker.rules \
--config-files /etc/init/docker.conf \
--config-files /etc/init.d/docker \
--config-files /etc/default/docker \
--deb-compression gz \
-t deb .
# TODO replace "Suggests: cgroup-lite" with "Recommends: cgroupfs-mount | cgroup-lite" once cgroupfs-mount is available
# create empty lxc-docker wrapper package
fpm -s empty \
--name lxc-docker --version "$PKGVERSION" \
--architecture "$PACKAGE_ARCHITECTURE" \
--depends lxc-docker-$VERSION \
--description "$PACKAGE_DESCRIPTION" \
--maintainer "$PACKAGE_MAINTAINER" \
--url "$PACKAGE_URL" \
--license "$PACKAGE_LICENSE" \
--deb-compression gz \
-t deb
)
# clean up after ourselves so we have a clean output directory
rm "$DEST/postinst" "$DEST/prerm" "$DEST/postrm"
rm -r "$DIR"
}
bundle_ubuntu

70
vendor/github.com/hyperhq/hypercli/hack/make/update-apt-repo generated vendored Executable file
View File

@@ -0,0 +1,70 @@
#!/bin/bash
set -e
# This script updates the apt repo in $DOCKER_RELEASE_DIR/apt/repo.
# This script is a "fix all" for any sort of problems that might have occured with
# the Release or Package files in the repo.
# It should only be used in the rare case of extreme emergencies to regenerate
# Release and Package files for the apt repo.
#
# NOTE: Always be sure to re-sign the repo with hack/make/sign-repos after running
# this script.
: ${DOCKER_RELEASE_DIR:=$DEST}
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
# supported arches/sections
arches=( amd64 i386 )
# Preserve existing components but don't add any non-existing ones
for component in main testing experimental ; do
if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then
components+=( $component )
fi
done
dists=( $(find "${APTDIR}/dists" -maxdepth 1 -mindepth 1 -type d) )
# override component if it is set
if [ "$COMPONENT" ]; then
components=( $COMPONENT )
fi
# release the debs
for version in "${dists[@]}"; do
for component in "${components[@]}"; do
codename="${version//debootstrap-}"
# update the filelist for this codename/component
find "$APTDIR/pool/$component" \
-name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
done
done
# run the apt-ftparchive commands so we can have pinning
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
for dist in "${dists[@]}"; do
version=$(basename "$dist")
for component in "${components[@]}"; do
codename="${version//debootstrap-}"
apt-ftparchive \
-o "APT::FTPArchive::Release::Codename=$codename" \
-o "APT::FTPArchive::Release::Suite=$codename" \
-c "$APTDIR/conf/docker-engine-release.conf" \
release \
"$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
for arch in "${arches[@]}"; do
apt-ftparchive \
-o "APT::FTPArchive::Release::Codename=$codename" \
-o "APT::FTPArchive::Release::Suite=$codename" \
-o "APT::FTPArchive::Release::Component=$component" \
-o "APT::FTPArchive::Release::Architecture=$arch" \
-c "$APTDIR/conf/docker-engine-release.conf" \
release \
"$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
done
done
done

View File

@@ -0,0 +1,54 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
adds=$(validate_diff --numstat | awk '{ s += $1 } END { print s }')
dels=$(validate_diff --numstat | awk '{ s += $2 } END { print s }')
#notDocs="$(validate_diff --numstat | awk '$3 !~ /^docs\// { print $3 }')"
: ${adds:=0}
: ${dels:=0}
# "Username may only contain alphanumeric characters or dashes and cannot begin with a dash"
githubUsernameRegex='[a-zA-Z0-9][a-zA-Z0-9-]+'
# https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
dcoPrefix='Signed-off-by:'
dcoRegex="^(Docker-DCO-1.1-)?$dcoPrefix ([^<]+) <([^<>@]+@[^<>]+)>( \\(github: ($githubUsernameRegex)\\))?$"
check_dco() {
grep -qE "$dcoRegex"
}
if [ $adds -eq 0 -a $dels -eq 0 ]; then
echo '0 adds, 0 deletions; nothing to validate! :)'
else
commits=( $(validate_log --format='format:%H%n') )
badCommits=()
for commit in "${commits[@]}"; do
if [ -z "$(git log -1 --format='format:' --name-status "$commit")" ]; then
# no content (ie, Merge commit, etc)
continue
fi
if ! git log -1 --format='format:%B' "$commit" | check_dco; then
badCommits+=( "$commit" )
fi
done
if [ ${#badCommits[@]} -eq 0 ]; then
echo "Congratulations! All commits are properly signed with the DCO!"
else
{
echo "These commits do not have a proper '$dcoPrefix' marker:"
for commit in "${badCommits[@]}"; do
echo " - $commit"
done
echo
echo 'Please amend each commit to include a properly formatted DCO marker.'
echo
echo 'Visit the following URL for information about the Docker DCO:'
echo ' https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work'
echo
} >&2
false
fi
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed is formatted
if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files are properly formatted.'
else
{
echo "These files are not properly gofmt'd:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
echo 'Please reformat the above files using "gofmt -s -w" and commit the result.'
echo
} >&2
false
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
unset IFS
errors=()
for f in "${files[@]}"; do
failedLint=$(golint "$f")
if [ "$failedLint" ]; then
errors+=( "$failedLint" )
fi
done
if [ ${#errors[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files have been linted.'
else
{
echo "Errors from golint:"
for err in "${errors[@]}"; do
echo "$err"
done
echo
echo 'Please fix the above errors. You can test via "golint" and commit the result.'
echo
} >&2
false
fi

View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -e
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'pkg/*.go' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
IFS=$'\n'
badImports=( $(go list -e -f '{{ join .Deps "\n" }}' "$f" | sort -u | grep -vE '^github.com/docker/docker/pkg/' | grep -E '^github.com/docker/docker' || true) )
unset IFS
for import in "${badImports[@]}"; do
badFiles+=( "$f imports $import" )
done
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! "./pkg/..." is safely isolated from internal code.'
else
{
echo 'These files import internal code: (either directly or indirectly)'
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
} >&2
false
fi

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Make sure we're not using gos' Testing package any more in integration-cli
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
# skip check_test.go since it *does* use the testing package
if [ "$f" = "integration-cli/check_test.go" ]; then
continue
fi
# we use "git show" here to validate that what's committed doesn't contain golang built-in testing
if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! No testing.T found.'
else
{
echo "These files use the wrong testing infrastructure:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
} >&2
false
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed has valid toml syntax
if ! git show "$VALIDATE_HEAD:$f" | tomlv /proc/self/fd/0 ; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! All toml source files changed here have valid syntax.'
else
{
echo "These files are not valid toml:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
echo 'Please reformat the above files as valid toml'
echo
} >&2
false
fi

View File

@@ -0,0 +1,27 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'hack/vendor.sh' 'hack/.vendor-helpers.sh' 'vendor/' || true) )
unset IFS
if [ ${#files[@]} -gt 0 ]; then
# We run vendor.sh to and see if we have a diff afterwards
./hack/vendor.sh >/dev/null
# Let see if the working directory is clean
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
if [ "$diffs" ]; then
{
echo 'The result of ./hack/vendor.sh differs'
echo
echo "$diffs"
echo
echo 'Please vendor your package with ./hack/vendor.sh.'
echo
} >&2
false
else
echo 'Congratulations! All vendoring changes are done the right way.'
fi
fi

View File

@@ -0,0 +1,31 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
unset IFS
errors=()
for f in "${files[@]}"; do
failedVet=$(go vet "$f")
if [ "$failedVet" ]; then
errors+=( "$failedVet" )
fi
done
if [ ${#errors[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files have been vetted.'
else
{
echo "Errors from go vet:"
for err in "${errors[@]}"; do
echo " - $err"
done
echo
echo 'Please fix the above errors. You can test via "go vet" and commit the result.'
echo
} >&2
false
fi

325
vendor/github.com/hyperhq/hypercli/hack/release.sh generated vendored Executable file
View File

@@ -0,0 +1,325 @@
#!/usr/bin/env bash
set -e
# This script looks for bundles built by make.sh, and releases them on a
# public S3 bucket.
#
# Bundles should be available for the VERSION string passed as argument.
#
# The correct way to call this script is inside a container built by the
# official Dockerfile at the root of the Docker source code. The Dockerfile,
# make.sh and release.sh should all be from the same source code revision.
set -o pipefail
# Print a usage message and exit.
usage() {
cat >&2 <<'EOF'
To run, I need:
- to be in a container generated by the Dockerfile at the top of the Docker
repository;
- to be provided with the location of an S3 bucket and path, in
environment variables AWS_S3_BUCKET and AWS_S3_BUCKET_PATH (default: '');
- to be provided with AWS credentials for this S3 bucket, in environment
variables AWS_ACCESS_KEY and AWS_SECRET_KEY;
- a generous amount of good will and nice manners.
The canonical way to run me is to run the image produced by the Dockerfile: e.g.:"
docker run -e AWS_S3_BUCKET=test.docker.com \
-e AWS_ACCESS_KEY=... \
-e AWS_SECRET_KEY=... \
-i -t --privileged \
docker ./hack/release.sh
EOF
exit 1
}
[ "$AWS_S3_BUCKET" ] || usage
[ "$AWS_ACCESS_KEY" ] || usage
[ "$AWS_SECRET_KEY" ] || usage
[ -d /go/src/github.com/docker/docker ] || usage
cd /go/src/github.com/docker/docker
[ -x hack/make.sh ] || usage
RELEASE_BUNDLES=(
binary
cross
tgz
)
if [ "$1" != '--release-regardless-of-test-failure' ]; then
RELEASE_BUNDLES=(
test-unit
"${RELEASE_BUNDLES[@]}"
test-integration-cli
)
fi
VERSION=$(< VERSION)
BUCKET=$AWS_S3_BUCKET
BUCKET_PATH=$BUCKET
[[ -n "$AWS_S3_BUCKET_PATH" ]] && BUCKET_PATH+=/$AWS_S3_BUCKET_PATH
if command -v git &> /dev/null && git rev-parse &> /dev/null; then
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo "You cannot run the release script on a repo with uncommitted changes"
usage
fi
fi
# These are the 2 keys we've used to sign the deb's
# release (get.docker.com)
# GPG_KEY="36A1D7869245C8950F966E92D8576A8BA88D21E9"
# test (test.docker.com)
# GPG_KEY="740B314AE3941731B942C66ADF4FD13717AAD7D6"
setup_s3() {
echo "Setting up S3"
# Try creating the bucket. Ignore errors (it might already exist).
s3cmd mb "s3://$BUCKET" 2>/dev/null || true
# Check access to the bucket.
# s3cmd has no useful exit status, so we cannot check that.
# Instead, we check if it outputs anything on standard output.
# (When there are problems, it uses standard error instead.)
s3cmd info "s3://$BUCKET" | grep -q .
# Make the bucket accessible through website endpoints.
s3cmd ws-create --ws-index index --ws-error error "s3://$BUCKET"
}
# write_to_s3 uploads the contents of standard input to the specified S3 url.
write_to_s3() {
DEST=$1
F=`mktemp`
cat > "$F"
s3cmd --acl-public --mime-type='text/plain' put "$F" "$DEST"
rm -f "$F"
}
s3_url() {
case "$BUCKET" in
get.docker.com|test.docker.com|experimental.docker.com)
echo "https://$BUCKET_PATH"
;;
*)
BASE_URL=$( s3cmd ws-info s3://$BUCKET | awk -v 'FS=: +' '/http:\/\/'$BUCKET'/ { gsub(/\/+$/, "", $2); print $2 }' )
if [[ -n "$AWS_S3_BUCKET_PATH" ]] ; then
echo "$BASE_URL/$AWS_S3_BUCKET_PATH"
else
echo "$BASE_URL"
fi
;;
esac
}
build_all() {
echo "Building release"
if ! ./hack/make.sh "${RELEASE_BUNDLES[@]}"; then
echo >&2
echo >&2 'The build or tests appear to have failed.'
echo >&2
echo >&2 'You, as the release maintainer, now have a couple options:'
echo >&2 '- delay release and fix issues'
echo >&2 '- delay release and fix issues'
echo >&2 '- did we mention how important this is? issues need fixing :)'
echo >&2
echo >&2 'As a final LAST RESORT, you (because only you, the release maintainer,'
echo >&2 ' really knows all the hairy problems at hand with the current release'
echo >&2 ' issues) may bypass this checking by running this script again with the'
echo >&2 ' single argument of "--release-regardless-of-test-failure", which will skip'
echo >&2 ' running the test suite, and will only build the binaries and packages. Please'
echo >&2 ' avoid using this if at all possible.'
echo >&2
echo >&2 'Regardless, we cannot stress enough the scarcity with which this bypass'
echo >&2 ' should be used. If there are release issues, we should always err on the'
echo >&2 ' side of caution.'
echo >&2
exit 1
fi
}
upload_release_build() {
src="$1"
dst="$2"
latest="$3"
echo
echo "Uploading $src"
echo " to $dst"
echo
s3cmd --follow-symlinks --preserve --acl-public put "$src" "$dst"
if [ "$latest" ]; then
echo
echo "Copying to $latest"
echo
s3cmd --acl-public cp "$dst" "$latest"
fi
# get hash files too (see hash_files() in hack/make.sh)
for hashAlgo in md5 sha256; do
if [ -e "$src.$hashAlgo" ]; then
echo
echo "Uploading $src.$hashAlgo"
echo " to $dst.$hashAlgo"
echo
s3cmd --follow-symlinks --preserve --acl-public --mime-type='text/plain' put "$src.$hashAlgo" "$dst.$hashAlgo"
if [ "$latest" ]; then
echo
echo "Copying to $latest.$hashAlgo"
echo
s3cmd --acl-public cp "$dst.$hashAlgo" "$latest.$hashAlgo"
fi
fi
done
}
release_build() {
echo "Releasing binaries"
GOOS=$1
GOARCH=$2
binDir=bundles/$VERSION/cross/$GOOS/$GOARCH
tgzDir=bundles/$VERSION/tgz/$GOOS/$GOARCH
binary=docker-$VERSION
tgz=docker-$VERSION.tgz
latestBase=
if [ -z "$NOLATEST" ]; then
latestBase=docker-latest
fi
# we need to map our GOOS and GOARCH to uname values
# see https://en.wikipedia.org/wiki/Uname
# ie, GOOS=linux -> "uname -s"=Linux
s3Os=$GOOS
case "$s3Os" in
darwin)
s3Os=Darwin
;;
freebsd)
s3Os=FreeBSD
;;
linux)
s3Os=Linux
;;
windows)
s3Os=Windows
binary+='.exe'
if [ "$latestBase" ]; then
latestBase+='.exe'
fi
;;
*)
echo >&2 "error: can't convert $s3Os to an appropriate value for 'uname -s'"
exit 1
;;
esac
s3Arch=$GOARCH
case "$s3Arch" in
amd64)
s3Arch=x86_64
;;
386)
s3Arch=i386
;;
arm)
s3Arch=armel
# someday, we might potentially support multiple GOARM values, in which case we might get armhf here too
;;
*)
echo >&2 "error: can't convert $s3Arch to an appropriate value for 'uname -m'"
exit 1
;;
esac
s3Dir="s3://$BUCKET_PATH/builds/$s3Os/$s3Arch"
latest=
latestTgz=
if [ "$latestBase" ]; then
latest="$s3Dir/$latestBase"
latestTgz="$s3Dir/$latestBase.tgz"
fi
if [ ! -x "$binDir/$binary" ]; then
echo >&2 "error: can't find $binDir/$binary - was it compiled properly?"
exit 1
fi
if [ ! -f "$tgzDir/$tgz" ]; then
echo >&2 "error: can't find $tgzDir/$tgz - was it packaged properly?"
exit 1
fi
upload_release_build "$binDir/$binary" "$s3Dir/$binary" "$latest"
upload_release_build "$tgzDir/$tgz" "$s3Dir/$tgz" "$latestTgz"
}
# Upload binaries and tgz files to S3
release_binaries() {
[ -e "bundles/$VERSION/cross/linux/amd64/docker-$VERSION" ] || {
echo >&2 './hack/make.sh must be run before release_binaries'
exit 1
}
for d in bundles/$VERSION/cross/*/*; do
GOARCH="$(basename "$d")"
GOOS="$(basename "$(dirname "$d")")"
release_build "$GOOS" "$GOARCH"
done
# TODO create redirect from builds/*/i686 to builds/*/i386
cat <<EOF | write_to_s3 s3://$BUCKET_PATH/builds/index
# To install, run the following command as root:
curl -sSL -O $(s3_url)/builds/Linux/x86_64/docker-$VERSION && chmod +x docker-$VERSION && sudo mv docker-$VERSION /usr/local/bin/docker
# Then start docker in daemon mode:
sudo /usr/local/bin/docker daemon
EOF
# Add redirect at /builds/info for URL-backwards-compatibility
rm -rf /tmp/emptyfile && touch /tmp/emptyfile
s3cmd --acl-public --add-header='x-amz-website-redirect-location:/builds/' --mime-type='text/plain' put /tmp/emptyfile "s3://$BUCKET_PATH/builds/info"
if [ -z "$NOLATEST" ]; then
echo "Advertising $VERSION on $BUCKET_PATH as most recent version"
echo "$VERSION" | write_to_s3 "s3://$BUCKET_PATH/latest"
fi
}
# Upload the index script
release_index() {
echo "Releasing index"
url="$(s3_url)/" hack/make.sh install-script
write_to_s3 "s3://$BUCKET_PATH/index" < "bundles/$VERSION/install-script/install.sh"
}
release_test() {
echo "Releasing tests"
if [ -e "bundles/$VERSION/test" ]; then
s3cmd --acl-public sync "bundles/$VERSION/test/" "s3://$BUCKET_PATH/test/"
fi
}
main() {
build_all
setup_s3
release_binaries
release_index
release_test
}
main
echo
echo
echo "Release complete; see $(s3_url)"
echo "Use the following text to announce the release:"
echo
echo "We have just pushed $VERSION to $(s3_url). You can download it with the following:"
echo
echo "Linux 64bit binary: $(s3_url)/builds/Linux/x86_64/docker-$VERSION"
echo "Darwin/OSX 64bit client binary: $(s3_url)/builds/Darwin/x86_64/docker-$VERSION"
echo "Linux 64bit tgz: $(s3_url)/builds/Linux/x86_64/docker-$VERSION.tgz"
echo "Windows 64bit client binary: $(s3_url)/builds/Windows/x86_64/docker-$VERSION.exe"
echo "Windows 32bit client binary: $(s3_url)/builds/Windows/i386/docker-$VERSION.exe"
echo

85
vendor/github.com/hyperhq/hypercli/hack/vendor.sh generated vendored Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$BASH_SOURCE")/.."
rm -rf vendor/
source 'hack/.vendor-helpers.sh'
# the following lines are in sorted order, FYI
clone git github.com/Azure/go-ansiterm 70b2c90b260171e829f1ebd7c17f600c11858dbe
clone git github.com/Microsoft/go-winio 2b085935f02c272e7a1855df6f8fe03029ffcadd
clone git github.com/Sirupsen/logrus v0.9.0 # logrus is a common dependency among multiple deps
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
clone git github.com/go-check/check 11d3bc7aa68e238947792f30573146a3231fc0f1
clone git github.com/gorilla/context 14f550f51a
clone git github.com/gorilla/mux e444e69cbd
clone git github.com/kr/pty 5cf931ef8f
clone git github.com/mattn/go-shellwords v1.0.0
clone git github.com/mattn/go-sqlite3 v1.1.0
clone git github.com/Microsoft/hcsshim 35ad4d808a97203cb1748d7c43167e91f51e7f86
clone git github.com/mistifyio/go-zfs v2.1.1
clone git github.com/tchap/go-patricia v2.1.0
clone git github.com/vdemeester/shakers 3c10293ce22b900c27acad7b28656196fcc2f73b
clone git golang.org/x/net 47990a1ba55743e6ef1affd3a14e5bac8553615d https://github.com/golang/net.git
clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git
clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
clone git github.com/docker/go-connections v0.1.2
clone git github.com/docker/engine-api bdbab71ec21209ef56dffdbe42c9d21843c30862
clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
clone git github.com/imdario/mergo 0.2.1
#get libnetwork packages
clone git github.com/docker/libnetwork v0.6.0-rc7
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
clone git github.com/hashicorp/serf 7151adcef72687bf95f451a2e0ba15cb19412bf2
clone git github.com/docker/libkv c2aac5dbbaa5c872211edea7c0f32b3bd67e7410
clone git github.com/vishvananda/netns 604eaf189ee867d8c147fafc28def2394e878d25
clone git github.com/vishvananda/netlink bfd70f556483c008636b920dda142fdaa0d59ef9
clone git github.com/BurntSushi/toml f706d00e3de6abe700c994cdd545a1a4915af060
clone git github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374
clone git github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d
clone git github.com/coreos/etcd v2.2.0
fix_rewritten_imports github.com/coreos/etcd
clone git github.com/ugorji/go 5abd4e96a45c386928ed2ca2a7ef63e2533e18ec
clone git github.com/hashicorp/consul v0.5.2
clone git github.com/boltdb/bolt v1.1.0
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
# get graph and distribution packages
clone git github.com/docker/distribution c301f8ab27f4913c968b8d73a38e5dda79b9d3d7
clone git github.com/vbatts/tar-split v0.9.11
# get desired notary commit, might also need to be updated in Dockerfile
clone git github.com/docker/notary docker-v1.10-5
clone git google.golang.org/grpc 174192fc93efcb188fc8f46ca447f0da606b6885 https://github.com/grpc/grpc-go.git
clone git github.com/miekg/pkcs11 80f102b5cac759de406949c47f0928b99bd64cdf
clone git github.com/docker/go v1.5.1-1-1-gbaf439e
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c
clone git github.com/opencontainers/runc 3d8a20bb772defc28c355534d83486416d1719b4 # libcontainer
clone git github.com/seccomp/libseccomp-golang 1b506fc7c24eec5a3693cdcbed40d9c226cfc6a1
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json)
clone git github.com/coreos/go-systemd v4
clone git github.com/godbus/dbus v3
clone git github.com/syndtr/gocapability 2c00daeb6c3b45114c80ac44119e7b8801fdd852
clone git github.com/golang/protobuf f7137ae6b19afbfd61a94b746fda3b3fe0491874
# gelf logging driver deps
clone git github.com/Graylog2/go-gelf 6c62a85f1d47a67f2a5144c0e745b325889a8120
clone git github.com/fluent/fluent-logger-golang v1.0.0
# fluent-logger-golang deps
clone git github.com/philhofer/fwd 899e4efba8eaa1fea74175308f3fae18ff3319fa
clone git github.com/tinylib/msgp 75ee40d2601edf122ef667e2a07d600d4c44490c
# fsnotify
clone git gopkg.in/fsnotify.v1 v1.2.0
# awslogs deps
clone git github.com/aws/aws-sdk-go v0.9.9
clone git github.com/vaughan0/go-ini a98ad7ee00ec53921f08832bc06ecf7fd600e6a1
clean