Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support changing SchemaSpy version #173

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ ENV LC_ALL=C
ARG GIT_BRANCH=local
ARG GIT_REVISION=local

ENV SCHEMASPY_GROUP_ID=org.schemaspy
ENV SCHEMASPY_ARTIFACT_ID=schemaspy
ENV SCHEMASPY_VERSION=6.2.4
ENV SCHEMASPY_CLASSIFIER=app

ENV MYSQL_VERSION=8.0.28
ENV MARIADB_VERSION=1.1.10
ENV POSTGRESQL_VERSION=42.3.5
ENV POSTGRESQL_VERSION=42.3.8
ENV JTDS_VERSION=1.3.1

LABEL MYSQL_VERSION=$MYSQL_VERSION
Expand All @@ -26,17 +31,19 @@ RUN set -x && \
apk update && apk upgrade && \
apk add --no-cache curl unzip bash graphviz fontconfig && \
fc-cache -fv && \
mkdir -p /usr/local/lib/schemaspy && \
mkdir /drivers_inc && \
cd /drivers_inc && \
curl -JL https://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/$MYSQL_VERSION/mysql-connector-java-$MYSQL_VERSION.jar --output mysql-connector-java-$MYSQL_VERSION.jar && \
curl -JL https://search.maven.org/remotecontent?filepath=org/mariadb/jdbc/mariadb-java-client/$MARIADB_VERSION/mariadb-java-client-$MARIADB_VERSION.jar --output mariadb-java-client-$MARIADB_VERSION.jar && \
curl -JL https://search.maven.org/remotecontent?filepath=org/postgresql/postgresql/$POSTGRESQL_VERSION/postgresql-$POSTGRESQL_VERSION.jar --output postgresql-$POSTGRESQL_VERSION.jar && \
curl -JL https://search.maven.org/remotecontent?filepath=net/sourceforge/jtds/jtds/$JTDS_VERSION/jtds-$JTDS_VERSION.jar --output jtds-$JTDS_VERSION.jar && \
apk del curl
curl -JL https://search.maven.org/remotecontent?filepath=$( echo -n $SCHEMASPY_GROUP_ID | sed s/"\."/"\/"/g )/$SCHEMASPY_ARTIFACT_ID/$SCHEMASPY_VERSION/$SCHEMASPY_ARTIFACT_ID-$SCHEMASPY_VERSION$( echo -n "-$SCHEMASPY_CLASSIFIER" | sed s/"^-$"//).jar --output /usr/local/lib/schemaspy/schemaspy.jar && \
echo -n "${SCHEMASPY_GROUP_ID}:${SCHEMASPY_ARTIFACT_ID}:${SCHEMASPY_VERSION}" > /usr/local/lib/schemaspy/version.txt

ADD target/schema*.jar /usr/local/lib/schemaspy/
COPY docker/schemaspy.sh /usr/local/bin/schemaspy
COPY entrypoint.sh /entrypoint.sh
COPY prepare.sh /prepare.sh

ENV SCHEMASPY_DRIVERS=/drivers

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ inputs:
default: 'false'
runs:
using: 'docker'
image: 'docker://ghcr.io/tj-actions/schemaspy:latest'
image: 'Dockerfile'
branding:
icon: check-square
color: white
4 changes: 3 additions & 1 deletion docker/schemaspy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

. /prepare.sh

if [ -d "$SCHEMASPY_DRIVERS" ]; then
export DRIVER_PATH="$SCHEMASPY_DRIVERS"
else
Expand All @@ -9,4 +11,4 @@ fi
echo "Using drivers:"
find $DRIVER_PATH -maxdepth 1 -type f -name "*.jar" | sed -e 's/ */, /g'

exec java -jar /usr/local/lib/schemaspy/schemaspy*.jar -dp $DRIVER_PATH "$@"
exec java -jar /usr/local/lib/schemaspy/schemaspy.jar -dp $DRIVER_PATH "$@"
10 changes: 10 additions & 0 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

CURRENT_VERSION="$(cat /usr/local/lib/schemaspy/version.txt)"
EXPECTED_VERSION="${SCHEMASPY_GROUP_ID}:${SCHEMASPY_ARTIFACT_ID}:${SCHEMASPY_VERSION}"

if [ "X${AVAILABLE_VERSION}" != "X${EXPECTED_VERSION}" ];
then
echo "Downloading SchemaSpy artifact from Maven central (expected: ${EXPECTED_VERSION}, current: ${CURRENT_VERSION})..."
curl -JL https://search.maven.org/remotecontent?filepath=$( echo -n $SCHEMASPY_GROUP_ID | sed s/"\."/"\/"/g )/$SCHEMASPY_ARTIFACT_ID/$SCHEMASPY_VERSION/$SCHEMASPY_ARTIFACT_ID-$SCHEMASPY_VERSION$( echo -n "-$SCHEMASPY_CLASSIFIER" | sed s/"^-$"//).jar --output /usr/local/lib/schemaspy/schemaspy.jar
fi
Binary file removed target/schemaspy-6.1.1.jar
Binary file not shown.