github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/jenkins/update-jobs.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2015 The Kubernetes Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Update all Jenkins jobs in a folder specified in $1. It can be the union of 18 # multiple folders separated with a colon, like with the PATH variable. 19 20 if [[ $# -eq 1 ]]; then 21 config_dir=$1 22 else 23 echo "Usage: $0 <dir>" >&2 24 exit 1 25 fi 26 27 IMAGE="gcr.io/google_containers/kubekins-job-builder:5" 28 29 # jenkins_jobs.ini contains administrative credentials for Jenkins. 30 # Store it in /jenkins-master-data. 31 readonly config_path="/jenkins-master-data/jenkins_jobs.ini" 32 if [[ -e "${config_path}" ]]; then 33 docker run \ 34 --entrypoint jenkins-jobs \ 35 --rm \ 36 --net host \ 37 --name job-builder \ 38 -v "${WORKSPACE}/test-infra:/test-infra" \ 39 -v "${config_path}:/etc/jenkins_jobs/jenkins_jobs.ini:ro" \ 40 "${IMAGE}" \ 41 update --delete-old "${config_dir}" 42 else 43 echo "${config_path} not found" >&2 44 exit 1 45 fi