diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 04c0372e479..d19efbc6462 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -48,6 +48,7 @@ NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"${MASTER_IMAGE}"} NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-"${MASTER_IMAGE_PROJECT}"} CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker} RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5} +GCI_DOCKER_VERSION=${KUBE_GCI_DOCKER_VERSION:-} NETWORK=${KUBE_GCE_NETWORK:-e2e} INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}" diff --git a/cluster/gce/gci/helper.sh b/cluster/gce/gci/helper.sh index d7d0199461b..d4f900c715d 100755 --- a/cluster/gce/gci/helper.sh +++ b/cluster/gce/gci/helper.sh @@ -25,9 +25,14 @@ function ensure-gci-metadata-files { update_disabled EOF fi - if [[ ! -f "${KUBE_TEMP}/gci-docker.txt" ]]; then - cat >"${KUBE_TEMP}/gci-docker.txt" << EOF + if [[ ! -f "${KUBE_TEMP}/gci-ensure-gke-docker.txt" ]]; then + cat >"${KUBE_TEMP}/gci-ensure-gke-docker.txt" << EOF true +EOF + fi + if [[ ! -f "${KUBE_TEMP}/gci-docker-version.txt" ]]; then + cat >"${KUBE_TEMP}/gci-docker-version.txt" << EOF +${GCI_DOCKER_VERSION} EOF fi } @@ -42,7 +47,8 @@ function create-node-instance-template { "configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh" \ "cluster-name=${KUBE_TEMP}/cluster-name.txt" \ "gci-update-strategy=${KUBE_TEMP}/gci-update.txt" \ - "gci-ensure-gke-docker=${KUBE_TEMP}/gci-docker.txt" + "gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt" \ + "gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt" } # create-master-instance creates the master instance. If called with @@ -76,7 +82,7 @@ function create-master-instance { --scopes "storage-ro,compute-rw,monitoring,logging-write" \ --can-ip-forward \ --metadata-from-file \ - "kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt,gci-update-strategy=${KUBE_TEMP}/gci-update.txt,gci-ensure-gke-docker=${KUBE_TEMP}/gci-docker.txt" \ + "kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt,gci-update-strategy=${KUBE_TEMP}/gci-update.txt,gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt,gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt" \ --disk "name=${MASTER_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" \ --boot-disk-size "${MASTER_ROOT_DISK_SIZE:-10}" } diff --git a/hack/jenkins/e2e-runner.sh b/hack/jenkins/e2e-runner.sh index 88edb32610d..3b51032e3f2 100755 --- a/hack/jenkins/e2e-runner.sh +++ b/hack/jenkins/e2e-runner.sh @@ -103,20 +103,24 @@ function get_latest_gci_image() { local image_type="$2" local image_index="" if [[ "${image_type}" == head ]]; then - image_index="gci-head" + image_index="latest-base-image-gci-head" elif [[ "${image_type}" == dev ]]; then - image_index="gci-dev" + image_index="latest-base-image-gci-dev" elif [[ "${image_type}" == beta ]]; then - image_index="gci-beta" + image_index="latest-base-image-gci-beta" elif [[ "${image_type}" == stable ]]; then - image_index="gci-stable" + image_index="latest-base-image-gci-stable" + elif [[ "${image_type}" == preview-test ]]; then + # A GCI preview image that is able to override its Docker installation on + # boot. + image_index="latest-test-image-gci-preview" fi local image="" # Retry the gsutil command a couple times to mitigate the effect of # transient server errors. for n in $(seq 3); do - image="$(gsutil cat "gs://${image_project}/image-indices/latest-base-image-${image_index}")" && break || sleep 1 + image="$(gsutil cat "gs://${image_project}/image-indices/${image_index}")" && break || sleep 1 done if [[ -z "${image}" ]]; then echo "Failed to find GCI image for ${image_type}" @@ -128,6 +132,18 @@ function get_latest_gci_image() { rm -rf .gsutil &> /dev/null } +function get_latest_docker_release() { + # Typical Docker release versions are like v1.11.2-rc1, v1.11.2, and etc. + local -r version_re='.*\"tag_name\":[[:space:]]+\"v([0-9\.r|c-]+)\",.*' + local -r latest_release="$(curl -fsSL --retry 3 https://api.github.com/repos/docker/docker/releases/latest)" + if [[ "${latest_release}" =~ ${version_re} ]]; then + echo "${BASH_REMATCH[1]}" + else + echo "Malformed Docker API response for latest release: ${latest_release}" + exit 1 + fi +} + function install_google_cloud_sdk_tarball() { local -r tarball=$1 local -r install_dir=$2 @@ -196,6 +212,9 @@ if [[ -n "${JENKINS_GCI_IMAGE_TYPE:-}" ]]; then export KUBE_GCE_MASTER_PROJECT="${gci_image_project}" export KUBE_GCE_MASTER_IMAGE="${gci_image}" export KUBE_OS_DISTRIBUTION="gci" + if [[ "${JENKINS_GCI_IMAGE_TYPE}" == preview-test ]]; then + export KUBE_GCI_DOCKER_VERSION="$(get_latest_docker_release)" + fi fi function e2e_test() {