blob: f73a23aaed19a6dc058fcc925fbbe6466968ebb1 [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]}"
Jesse Glick9c8ddc42015-06-01 11:47:18 -040022 curl -s -L -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 +020023done < $1