Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for continuous Docker validation test #26813

Merged
merged 1 commit into from
Jun 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down
14 changes: 10 additions & 4 deletions cluster/gce/gci/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -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}"
}
29 changes: 24 additions & 5 deletions hack/jenkins/e2e-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,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}"
Expand All @@ -125,6 +129,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: quotes "${version_re}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been following the bash 3.2 guide on using regular expression by not quoting them:

In fact, quoting in this context is not advisable as it may cause regex evaluation to fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Good :)

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
Expand Down Expand Up @@ -193,6 +209,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() {
Expand Down