diff --git a/hack/jenkins/README.md b/hack/jenkins/README.md new file mode 100644 index 00000000000..0d0b14c80fd --- /dev/null +++ b/hack/jenkins/README.md @@ -0,0 +1,33 @@ +# Jenkins + +[Jenkins](http://jenkins-ci.org/) is a pluggable continuous +integration system. The Google team is running a Jenkins server on a +private GCE instance for the Kubernetes project in order to run longer +integration tests, continuously, on different providers. Currently, we +(Google) are only running Jenkins on our own providers (GCE and GKE) +in different flavors. + +## General flow +The flow of the Google Jenkins server: +* Under the `kubernetes-build` job: Every 5 minutes, Jenkins polls for a batch of new commits, after which it runs the `build.sh` script (in this directory) on the latest tip. This results in build assets getting pushed to GCS and the `latest.txt` file in the `ci` bucket being updated. That job then triggers `kubernetes-e2e-*`. +* On trigger, and every half hour (which effectively means all the time, unless we're failing cluster creation), e2e variants run, on the latest build assets in GCS: + * `kubernetes-e2e-gce`: Standard GCE e2e + * `kubernetes-e2e-gke`: GKE provider e2e, with head k8s client and GKE creating clusters at its default version + * `kubernetes-e2e-gke-ci`: GKE provider e2e, with head k8s client and GKE creating clusters at the head k8s version +* Each job will not run concurrently with itself, so, for instance, + Jenkins executor will only ever run one `kubernetes-build` + job. However, it may run the jobs in parallel, + i.e. `kubernetes-build` may be run at the same time as + `kubernetes-e2e-gce`. For this reason, you may see your changes + pushed to our GCS bucket rapidly, but they may take some time to + fully work through Jenkins. Or you may get lucky and catch the + train in 5 minutes. + +## Scripts + +The scripts in this directory are directly used by Jenkins, either by +curl from githubusercontent (if we don't have a git checkout handy) or +by executing it from the git checkout. Since Jenkins is an entity +outside this repository, it's tricky to keep documentation for it up +to date quickly. However, the scripts themselves attempt to provide +color for the configuration(s) that each script runs in. diff --git a/hack/jenkins/build.sh b/hack/jenkins/build.sh new file mode 100644 index 00000000000..715bfa6eaf2 --- /dev/null +++ b/hack/jenkins/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright 2015 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# kubernetes-build job: Triggered by github checkins on a 5 minute +# poll. We abort this job if it takes longer than 10m. (Typically this +# job takes about ~5m as of 0.8.0, but it's actually not completely +# hermetic right now due to things like the golang image. It can take +# ~8m if you force it to be totally hermetic.) + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +# !!! ALERT !!! Jenkins default $HOME is /var/lib/jenkins, which is +# global across jobs. We change $HOME instead to ${WORKSPACE}, which +# is an incoming variable Jenkins provides us for this job's scratch +# space. +export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME +export PATH=$PATH:/usr/local/go/bin +export KUBE_RELEASE_RUN_TESTS=n +export KUBE_SKIP_CONFIRMATIONS=y + +# Clean stuff out. +# +# TODO: Look at git clean plugin again for hermeticism, but may not +# play nicely with dockerized stuff and permissions. (We may just need +# to force the build/make-clean.sh at the end of the build regardless +# of status and be delicate with the exit status.) (Low priority +# unless there's a hermetic issue.) +rm -rf ~/.kube* +./build/make-clean.sh +git clean -fdx + +# Build +go run ./hack/e2e.go -v -build + +# Push to GCS +yes | ./build/push-ci-build.sh + +sha256sum _output/release-tars/kubernetes*.tar.gz