blob: 3413ce40570685201bcc738c5a68aa1009dd6264 [file] [log] [blame]
Nicolas De Loofacb86492014-10-24 13:43:13 +02001#! /bin/bash
2
3# Parse a support-core plugin -style txt file as specification for jenkins plugins to be installed
4# in the reference directory, so user can define a derived Docker image with just :
Nikolay Yurin390dc612015-04-20 14:46:29 +03005#
Nicolas De Loofacb86492014-10-24 13:43:13 +02006# FROM jenkins
7# COPY plugins.txt /plugins.txt
Justin Clayton8aec15c2015-01-23 12:19:02 -08008# RUN /usr/local/bin/plugins.sh /plugins.txt
Nikolay Yurin390dc612015-04-20 14:46:29 +03009#
Nicolas De Loofacb86492014-10-24 13:43:13 +020010
Jesse Glick9c8ddc42015-06-01 11:47:18 -040011set -e
12
Nicolas De Loofacb86492014-10-24 13:43:13 +020013REF=/usr/share/jenkins/ref/plugins
14mkdir -p $REF
15
Carlos Sanchezc0475fd2015-04-29 11:55:48 +020016while read spec || [ -n "$spec" ]; do
Nikolay Yurin390dc612015-04-20 14:46:29 +030017 plugin=(${spec//:/ });
Manuel Prinzdddb9652015-02-21 13:03:29 +010018 [[ ${plugin[0]} =~ ^# ]] && continue
19 [[ ${plugin[0]} =~ ^\s*$ ]] && continue
Nikolay Yurin390dc612015-04-20 14:46:29 +030020 [[ -z ${plugin[1]} ]] && plugin[1]="latest"
21 echo "Downloading ${plugin[0]}:${plugin[1]}"
Carlos Sanchezd359b042015-07-02 13:06:14 +020022
23 if [ -z "$JENKINS_UC_DOWNLOAD" ]; then
24 JENKINS_UC_DOWNLOAD=$JENKINS_UC/download
25 fi
Carlos Sanchez004bc592015-07-02 12:51:25 +020026 curl -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
Nicolas De Loofacb86492014-10-24 13:43:13 +020027done < $1