DBZ-3934 Docker image for artifact server serving artifacts for Strimzi's build mechanism

This commit is contained in:
jcechace 2021-09-13 13:51:22 +02:00 committed by Jakub Cechacek
parent 97cb997be3
commit 0e040d8090
3 changed files with 43 additions and 1 deletions

5
.gitignore vendored
View File

@ -30,4 +30,7 @@ generated-sources/
/state/
bin/
gen/
*.tokens
*.tokens
jenkins-jobs/docker/rhel_kafka/plugins
jenkins-jobs/docker/artifact-server/plugins

View File

@ -0,0 +1,11 @@
FROM svenstaro/miniserve:alpine
RUN apk add --no-cache bash
ADD ./plugins /opt/plugins
ADD listing.sh /opt/
RUN chmod +x /opt/listing.sh
RUN /opt/listing.sh -d /opt/plugins -o /opt/plugins/artifacts.txt
CMD ["/opt/plugins"]

View File

@ -0,0 +1,28 @@
#! /usr/bin/env bash
OPTS=$(getopt -o d:o: --long dir:,output: -n 'parse-options' -- "$@")
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
OUTPUT="$(pwd)/artifacts.txt"
while true; do
case "$1" in
-d | --dir ) DIR=$2; shift; shift ;;
-o | --output ) OUTPUT=$2; shift; shift ;;
-h | --help ) PRINT_HELP=true; shift ;;
-- ) shift; break ;;
* ) break ;;
esac
done
shopt -s globstar nullglob
pushd "$DIR" || exit
rm -f "$OUTPUT"
for file in **/*.{zip,jar}; do
prefix=$(echo "$file" | sed -rn 's@^(.*)-([[:digit:]].*([[:digit:]]|Final|SNAPSHOT))(.*)(\..*)$@\1@p')
suffix=$(echo "$file" | sed -rn 's@^(.*)-([[:digit:]].*([[:digit:]]|Final|SNAPSHOT))(.*)(\..*)$@\4@p')
artifact="$prefix$suffix"
echo "$artifact"
echo "$artifact:$file" >> "$OUTPUT"
done
popd