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

Add support for GCI QA jobs #29631

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 33 additions & 17 deletions hack/jenkins/e2e-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ function unpack_binaries() {
tar -xzf kubernetes-test.tar.gz
}

# Get the latest GCI image in a family.
function get_latest_gci_image() {
local -r image_project="$1"
local -r image_family="$2"
echo "$(gcloud compute images describe-from-family ${image_family} --project=${image_project} --format='value(name)')"
}

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-]+)\",.*'
Expand Down Expand Up @@ -186,6 +179,37 @@ function dump_cluster_logs() {
fi
}

# GCI specific settings.
# Assumes: JENKINS_GCI_IMAGE_FAMILY
function setup_gci_vars() {
local -r gci_staging_project=container-vm-image-staging
local -r image_info="$(gcloud compute images describe-from-family ${JENKINS_GCI_IMAGE_FAMILY} --project=${gci_staging_project} --format=json)"
local -r image_description="$(echo ${image_info} | jq '.description')"
local -r image_name="$(echo ${image_info} | jq '.name')"

if [[ "${JENKINS_USE_GCI_VERSION:-}" =~ ^[yY]$ ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not check for exact match instead of regex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this way it allows both cases? For some reason this has been a convention in k8s' code

# GCI QA jobs use the builtin k8s version.
# Staged GCI images all include versions in their image descriptions so we
# extract builtin Kubernetes version from them.
local -r k8s_version_re='.*Kubernetes: ([0-9a-z.-]+),.*'
if [[ ${image_description} =~ ${k8s_version_re} ]]; then
export JENKINS_PUBLISHED_VERSION="release/${BASH_REMATCH[1]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this environment variable used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's used to determine which version of k8s to download, and to use in test.

https://github.com/kubernetes/kubernetes/blob/master/hack/jenkins/e2e-runner.sh#L285

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the image description is not the most reliable source to determine K8s version installed on the image. Did you have any other options in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I actually had a more reliable way implemented before I sent this PR
out. I think that one is going to take sometime to go through review, so
this can go in first to get us going. WDYT?

On Jul 27, 2016 5:10 PM, "Amey Deshpande" notifications@github.com wrote:

In hack/jenkins/e2e-runner.sh
#29631 (comment)
:

@@ -186,6 +179,37 @@ function dump_cluster_logs() {
fi
}

+# GCI specific settings.
+# Assumes: JENKINS_GCI_IMAGE_FAMILY
+function setup_gci_vars() {

  • local -r gci_staging_project=container-vm-image-staging
  • local -r image_info="$(gcloud compute images describe-from-family ${JENKINS_GCI_IMAGE_FAMILY} --project=${gci_staging_project} --format=json)"
  • local -r image_description="$(echo ${image_info} | jq '.description')"
  • local -r image_name="$(echo ${image_info} | jq '.name')"
  • if [[ "${JENKINS_USE_GCI_VERSION:-}" =~ ^[yY]$ ]]; then
  • GCI QA jobs use the builtin k8s version.

  • Staged GCI images all include versions in their image descriptions so we

  • extract builtin Kubernetes version from them.

  • local -r k8s_version_re='.Kubernetes: ([0-9a-z.-]+),.'
  • if [[ ${image_description} =~ ${k8s_version_re} ]]; then
  •  export JENKINS_PUBLISHED_VERSION="release/${BASH_REMATCH[1]}"
    

IMO the image description is not the most reliable source to determine K8s
version installed on the image. Did you have any other options in mind?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/29631/files/081dfbbb7385a7bd20f629fbb3ed142ce3ed3ca8#r72546726,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGVaIX_EhswVMD6sJJsefNeQFF1i5gLZks5qZ_N3gaJpZM4JVkAr
.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you have an alternative in the works, I'm fine with the current version as an interim solution.

else
echo "Failed to determine builtin k8s version for image ${image_name}: ${image_description}"
exit 1
fi
fi

export KUBE_GCE_MASTER_PROJECT="${gci_staging_project}"
export KUBE_GCE_MASTER_IMAGE="${image_name}"
export KUBE_MASTER_OS_DISTRIBUTION="gci"
if [[ "${JENKINS_GCI_IMAGE_FAMILY}" == "gci-canary-test" ]]; then
# The family "gci-canary-test" is reserved for a special type of GCI images
# that are used to continuously validate Docker releases.
export KUBE_GCI_DOCKER_VERSION="$(get_latest_docker_release)"
fi
}

### Pre Set Up ###
if running_in_docker; then
record_command "${STAGE_PRE}" "download_gcloud" curl -fsSL --retry 3 --keepalive-time 2 -o "${WORKSPACE}/google-cloud-sdk.tar.gz" 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
Expand Down Expand Up @@ -215,17 +239,9 @@ if [[ -n "${CLOUDSDK_BUCKET:-}" ]]; then
export CLOUDSDK_CONFIG=/var/lib/jenkins/.config/gcloud
fi

# We get the image project and name for GCI dynamically.
# GCI specific settings.
if [[ -n "${JENKINS_GCI_IMAGE_FAMILY:-}" ]]; then
GCI_STAGING_PROJECT=container-vm-image-staging
export KUBE_GCE_MASTER_PROJECT="${GCI_STAGING_PROJECT}"
export KUBE_GCE_MASTER_IMAGE="$(get_latest_gci_image "${GCI_STAGING_PROJECT}" "${JENKINS_GCI_IMAGE_FAMILY}")"
export KUBE_MASTER_OS_DISTRIBUTION="gci"
if [[ "${JENKINS_GCI_IMAGE_FAMILY}" == "gci-canary-test" ]]; then
# The family "gci-canary-test" is reserved for a special type of GCI images
# that are used to continuously validate Docker releases.
export KUBE_GCI_DOCKER_VERSION="$(get_latest_docker_release)"
fi
setup_gci_vars
fi

if [[ -f "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
Expand Down