Skip to content

Instantly share code, notes, and snippets.

@ethernetdan
Created September 21, 2017 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ethernetdan/bfab7c7c0dc31f61e9f0484e32e52e24 to your computer and use it in GitHub Desktop.
Save ethernetdan/bfab7c7c0dc31f61e9f0484e32e52e24 to your computer and use it in GitHub Desktop.
Build Docker image of Kubernetes E2E tests
#!/bin/bash -x
set -euo pipefail
echo "Building conformance image..."
echo
APT_PACKAGES="rsync"
# build docker image of repository
docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" - <<EOF
FROM golang:1.8
# install conformance dependencies
RUN apt-get update && apt-get install -y ${APT_PACKAGES} && rm -rf /var/lib/apt/lists/*
# clone conformance repository
RUN mkdir -p \${GOPATH}/src/k8s.io && git clone --branch ${CONFORMANCE_TAG} --depth 1 https://${CONFORMANCE_REPO} \${GOPATH}/src/k8s.io/kubernetes
WORKDIR \${GOPATH}/src/k8s.io/kubernetes
# install build dependencies
RUN go get -u github.com/jteeuwen/go-bindata/go-bindata
# build all test dependencies
RUN GOLDFLAGS="--s -w" make all WHAT="cmd/kubectl vendor/github.com/onsi/ginkgo/ginkgo test/e2e/e2e.test"
ENV TEST_FLAGS="-v --test --check-version-skew=false --test_args=--ginkgo.focus=\[Conformance\]"
CMD HOME=/go/src/k8s.io/kubernetes KUBECONFIG=/kubeconfig KUBE_OS_DISTRIBUTION=coreos KUBERNETES_CONFORMANCE_TEST=Y go run hack/e2e.go -- \${TEST_FLAGS}
EOF
set +x # ensure no passwords are logged
echo
echo "Logging in..."
echo
docker login -e="." --username ${DOCKER_USER} --password ${DOCKER_PASS} quay.io
echo
echo "Pushing image..."
echo
docker push ${IMAGE_NAME}:${IMAGE_TAG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment