forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#17996 from spxtr/jenkins-jobs
Check Jenkins job configs into git
- Loading branch information
Showing
5 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This docker image runs Jenkins Job Builder (JJB) for automatic job reconciliation. | ||
|
||
FROM ubuntu:14.04 | ||
MAINTAINER Joe Finney <spxtr@google.com> | ||
|
||
RUN mkdir /build | ||
WORKDIR /build | ||
|
||
# Dependencies for JJB | ||
RUN apt-get update && apt-get install -y \ | ||
wget \ | ||
git \ | ||
python-dev \ | ||
python-pip \ | ||
libyaml-dev \ | ||
python-yaml | ||
RUN pip install PyYAML python-jenkins | ||
# Required since JJB supports python 2.6, which doesn't have ordereddict built-in. We have 2.7. | ||
RUN wget https://pypi.python.org/packages/source/o/ordereddict/ordereddict-1.1.tar.gz \ | ||
&& tar -xvf ordereddict-1.1.tar.gz \ | ||
&& cd ordereddict-1.1 \ | ||
&& python setup.py install | ||
|
||
RUN git clone https://git.openstack.org/openstack-infra/jenkins-job-builder \ | ||
&& cd jenkins-job-builder \ | ||
&& python setup.py install | ||
|
||
# JJB configuration lives in /etc/jenkins_jobs/jenkins_jobs.ini | ||
RUN mkdir -p /etc/jenkins_jobs | ||
|
||
WORKDIR / | ||
RUN git clone https://github.com/kubernetes/kubernetes.git | ||
WORKDIR kubernetes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TAG = 1 | ||
|
||
all: | ||
docker build -t gcr.io/google_containers/kubekins-job-builder:$(TAG) . | ||
gcloud docker push gcr.io/google_containers/kubekins-job-builder:$(TAG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- job: | ||
name: kubernetes-update-jenkins-jobs | ||
description: "Update Jenkins jobs" | ||
|
||
triggers: | ||
- timed: "H/15 * * * *" | ||
|
||
builders: | ||
- shell: "curl -fsS https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/update-jobs.sh | /bin/bash -" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2015 The Kubernetes Authors 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. | ||
|
||
# Update all Jenkins jobs in a folder. If no folder is provided in $1, | ||
# defaults to hack/jenkins/job-configs. | ||
|
||
if [[ $# -eq 1 ]]; then | ||
config_dir=$1 | ||
else | ||
config_dir="hack/jenkins/job-configs" | ||
fi | ||
|
||
# Run the container if it isn't present. | ||
if ! docker inspect job-builder &> /dev/null; then | ||
# jenkins_jobs.ini contains administrative credentials for Jenkins. | ||
# Store it in the workspace of the Jenkins job that calls this script. | ||
if [[ -e jenkins_jobs.ini ]]; then | ||
docker run -idt \ | ||
--net host \ | ||
--name job-builder \ | ||
--restart always \ | ||
gcr.io/google_containers/kubekins-job-builder:1 | ||
docker cp jenkins_jobs.ini job-builder:/etc/jenkins_jobs | ||
else | ||
echo "jenkins_jobs.ini not found in workspace" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
docker exec job-builder git checkout master | ||
docker exec job-builder git pull | ||
docker exec job-builder jenkins-jobs test ${config_dir} |