blob: 8fe2e97444495d6d0d54698d1abd21c70bed0447 [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
11REF=/usr/share/jenkins/ref/plugins
12mkdir -p $REF
13
14while read spec; do
Nikolay Yurin390dc612015-04-20 14:46:29 +030015 plugin=(${spec//:/ });
Manuel Prinzdddb9652015-02-21 13:03:29 +010016 [[ ${plugin[0]} =~ ^# ]] && continue
17 [[ ${plugin[0]} =~ ^\s*$ ]] && continue
Nikolay Yurin390dc612015-04-20 14:46:29 +030018 [[ -z ${plugin[1]} ]] && plugin[1]="latest"
19 echo "Downloading ${plugin[0]}:${plugin[1]}"
20 curl -s -L -f ${JENKINS_UC}/download/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.hpi || echo "Failed to download ${plugin[0]}:${plugin[1]}"
Nicolas De Loofacb86492014-10-24 13:43:13 +020021done < $1