Refactoring a bit of code out of the one big build-plugins script

Basically trying to get to a place where we can run scripts semi-independently
for testing or overriding of behavior
This commit is contained in:
R. Tyler Croy 2017-12-19 17:03:55 -08:00
parent 9f8f26c722
commit 54476bab9f
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
7 changed files with 75 additions and 21 deletions

View File

@ -1,8 +1,11 @@
IMAGE_PREFIX="rtyler/codevalet"
IMAGE_PREFIX=rtyler/codevalet
all: check plugins master
check: agent-templates
check: agent-templates validate-plugins
validate-plugins: plugins.yml
./scripts/ruby ./scripts/plugins-from-yaml plugins.yml > /dev/null
clean:
rm -rf build/
@ -18,7 +21,7 @@ master: Dockerfile build/git-refs.txt agent-templates
plugins: ./scripts/build-plugins plugins.txt builder
./scripts/build-plugins
build/git-refs.txt:
build/git-refs.txt: plugins
./scripts/record-sha1sums
###############################################################

View File

@ -1,7 +0,0 @@
workflow-aggregator-plugin
blueocean-plugin
github-oauth-plugin
azure-vm-agents-plugin
matrix-auth-plugin
embeddable-build-status-plugin
sentry-plugin

16
plugins.yml Normal file
View File

@ -0,0 +1,16 @@
---
plugins:
- repo: 'workflow-aggregator-plugin'
ref: 'master'
- repo: 'blueocean-plugin'
ref: 'master'
- repo: 'github-oauth-plugin'
ref: 'master'
- repo: 'azure-vm-agents-plugin'
ref: 'master'
- repo: 'matrix-auth-plugin'
ref: 'master'
- repo: 'embeddable-build-status-plugin'
ref: 'master'
- repo: 'sentry-plugin'
ref: 'master'

29
scripts/build-plugin Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
BUILDER_CONTAINER="rtyler/codevalet-builder"
if [ "${1}" = "" ]; then
echo "The path to a plugin must be passed as the first argument";
exit 1;
fi;
if [ ! -d $1 ]; then
echo "The path \`${1}\` is not a directory";
exit 1;
fi;
tty --quiet
if [ $? -eq 0 ]; then
TTY="-ti"
fi;
pushd $1
if [ -f pom.xml ]; then
echo ">> Building ${1}"
exec docker run --rm ${TTY} \
-v $HOME/.m2:/root/.m2 \
-v $PWD:/data \
-w /data \
${BUILDER_CONTAINER} mvn install -e -B -DskipTests
fi;
popd

View File

@ -53,7 +53,7 @@ pushd $REPOS_DIR
(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
for plugin in $(${SCRIPTS_DIR}/plugins-from-yaml $SCRIPTS_DIR/../plugins.yml); do
cloneWithDependencies $plugin
done;
@ -61,17 +61,11 @@ pushd $REPOS_DIR
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
for d in *-plugin; do
./scripts/build-plugin $d
done;
set +e
# Handle an old tombstoned dependency which will not build from source

13
scripts/plugins-from-yaml Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env ruby
require 'yaml'
raise 'A file must be given as the first argument' if ARGV.size != 1
data = YAML.load(File.read(ARGV.first))
# By default we'll just output the names so we can easily loop over this in the
# shell
data['plugins'].each do |plugin|
puts plugin['repo']
end

View File

@ -1,6 +1,12 @@
#!/bin/sh
exec docker run --rm \
tty --quiet
if [ $? -eq 0 ]; then
TTY="-ti"
fi;
exec docker run --rm ${TTY} \
-v ${PWD}:${PWD} \
-w ${PWD} \
ruby:2-alpine $@