#!/bin/bash BUILD_DIR=$PWD/build REPOS_DIR=$BUILD_DIR/repos SCRIPTS_DIR=$(realpath $(dirname $0)) PLUGINS_OUTPUT_DIR=$BUILD_DIR/plugins BUILDER_CONTAINER="rtyler/codevalet-builder" mkdir -p $REPOS_DIR mkdir -p $PLUGINS_OUTPUT_DIR declare -A PROCESSED function cloneWithDependencies() { if [ ! ${PROCESSED[$1]} ]; then PROCESSED[$1]="$1" if [ ! -d $1 ]; then git clone --depth 1 git://github.com/jenkinsci/$1.git fi; for pom in $(find $1 -iname 'pom.xml' -maxdepth 2 -type f); do (cd $(dirname $pom) && ${SCRIPTS_DIR}/plugins-from-pom 'pom.xml') done; for dep in $(find $1 -iname '.plugins.txt' -type f -exec cat {} \; | sort -u); do cloneWithDependencies "${dep}-plugin" done; fi; } tty --quiet if [ $? -eq 0 ]; then echo "We're interactive, adjusting the Docker arguments accordingly"; TTY_ARGS="-ti"; fi; pushd $REPOS_DIR # See https://github.com/jenkinsci/azure-commons-plugin/pull/15 git clone --depth 1 -b jenkins-48636 git://github.com/abayer/azure-commons-plugin.git # Grab the latest datadog plugin from their org (it's not in jenkinsci) git clone --depth 1 git://github.com/datadog/jenkins-datadog-plugin.git datadog-plugin # pubsub-light-module is a plugin but not called a plugin git clone --depth 1 git://github.com/jenkinsci/pubsub-light-module.git pubsub-light-plugin # the artifact is called cloudbees-bitbucket-branch-source but the repo isn't git clone --depth 1 git://github.com/jenkinsci/bitbucket-branch-source-plugin.git cloudbees-bitbucket-branch-source-plugin git clone --depth 1 git://github.com/jenkinsci/js-libs.git js-libs-plugin # https://issues.jenkins-ci.org/browse/JENKINS-45668 (cd js-libs-plugin && find . -maxdepth 1 -type d -exec mkdir -p {}/src/main/webapp/jsmodules \;) for plugin in $(cat $SCRIPTS_DIR/../plugins.txt); do cloneWithDependencies $plugin done; # This was merged into the blueocean-plugin repository but still exists as a tombstone rm -rf blueocean-pipeline-editor-plugin set -e for d in *-plugin; do pushd $d if [ -f pom.xml ]; then echo ">> Building $d" git pull --rebase docker run --rm ${TTY_ARGS} -v $HOME/.m2:/root/.m2 \ -v $PWD:/data -w /data ${BUILDER_CONTAINER} mvn install -e -B -DskipTests fi; popd done; set +e # Handle an old tombstoned dependency which will not build from source # anymore :( # https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/master/pipeline-model-definition/pom.xml#L117-L123 curl https://repo.jenkins-ci.org/releases/org/jenkinsci/plugins/pipeline-model-declarative-agent/1.1.1/pipeline-model-declarative-agent-1.1.1.hpi > $PLUGINS_OUTPUT_DIR/pipeline-model-declarative-agent.hpi for hpi in $(find . -iname "*.hpi" | grep -v "test-classes" | grep -v "target/plugins/"); do cp $hpi $PLUGINS_OUTPUT_DIR done; popd