Use jenkins build number to trigger a new download for re-release or nightly build

This is required as --no-cache-filter is not supported by the version of docker used on the build server
pull/24/head
Jody Garnett 2023-06-07 20:49:29 -07:00
parent 2d0483bee5
commit a1cec7cc07
3 changed files with 20 additions and 15 deletions

View File

@ -60,7 +60,7 @@ EOF
FROM tomcat as download FROM tomcat as download
ARG GS_VERSION=2.23.1 ARG GS_VERSION=2.23.1
ARG GS_BUILD='' ARG GS_BUILD=release
ARG WAR_ZIP_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip ARG WAR_ZIP_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip
ENV GEOSERVER_VERSION=$GS_VERSION ENV GEOSERVER_VERSION=$GS_VERSION
ENV GEOSERVER_BUILD=$GS_BUILD ENV GEOSERVER_BUILD=$GS_BUILD
@ -69,7 +69,7 @@ WORKDIR /tmp
RUN <<EOF RUN <<EOF
set -e set -e
echo "Downloading GeoServer ${GEOSERVER_VERSION} ${GEOSERVER_BUILD}" echo "Downloading GeoServer ${GS_VERSION} ${GS_BUILD}"
wget -q -O /tmp/geoserver.zip $WAR_ZIP_URL wget -q -O /tmp/geoserver.zip $WAR_ZIP_URL
unzip geoserver.zip geoserver.war -d /tmp/ unzip geoserver.zip geoserver.war -d /tmp/
unzip -q /tmp/geoserver.war -d /tmp/geoserver unzip -q /tmp/geoserver.war -d /tmp/geoserver
@ -79,7 +79,7 @@ EOF
FROM tomcat as install FROM tomcat as install
ARG GS_VERSION=2.23.1 ARG GS_VERSION=2.23.1
ARG GS_BUILD='' ARG GS_BUILD=release
ARG STABLE_PLUGIN_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions ARG STABLE_PLUGIN_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions
ARG COMMUNITY_PLUGIN_URL='' ARG COMMUNITY_PLUGIN_URL=''
@ -105,6 +105,7 @@ ENV ROOT_WEBAPP_REDIRECT=false
WORKDIR /tmp WORKDIR /tmp
RUN echo "Installing GeoServer $GS_VERSION $GS_BUILD"
# install geoserver # install geoserver
COPY --from=download /tmp/geoserver $CATALINA_HOME/webapps/geoserver COPY --from=download /tmp/geoserver $CATALINA_HOME/webapps/geoserver

View File

@ -28,14 +28,16 @@ For CI purposes, the script in the `build` folder is used to simplify those step
The variables `DOCKERUSER` and `DOCKERPASSWORD` have to be set with valid credentials before this script can push the image to the osgeo repo. The variables `DOCKERUSER` and `DOCKERPASSWORD` have to be set with valid credentials before this script can push the image to the osgeo repo.
You need to pass the version as first and the type as second argument, where type has to be one of `build`, `publish` or `buildandpublish`. You need to pass the action as the first argument (one of `build`, `publish` or `buildandpublish`), and the version as a second argument.
The third, optional, is used to supply the jenkins build number - triggering a new war download. This is used when a release is re-published (such as with a nightly build).
Examples: Examples:
`./release.sh 2.22.1 build` `./release.sh build 2.22.1`
`./release.sh 2.23.1 publish` `./release.sh publish 2.23.1`
`./release.sh 2.22.1 buildandpublish` `./release.sh buildandpublish 2.22.1`
`./release.sh 2.24-SNAPSHOT buildandpublish` `./release.sh buildandpublish 2.24-SNAPSHOT 1234`

View File

@ -19,10 +19,11 @@ if [ -z $1 ] || [ -z $2 ] || [[ $1 != "build" && $1 != "publish" && $1 != "build
fi fi
VERSION=$2 VERSION=$2
echo "build: $3"
if [ -z $3 ]; then if [ -z $3 ]; then
BUILD=$3 BUILD='local'
else else
BUILD='' BUILD=$3
fi fi
if [[ "${VERSION:0:4}" == "$MAIN" ]]; then if [[ "${VERSION:0:4}" == "$MAIN" ]]; then
@ -51,8 +52,9 @@ if [[ $1 == *build* ]]; then
echo " nightly build from https://build.geoserver.org/geoserver/$BRANCH" echo " nightly build from https://build.geoserver.org/geoserver/$BRANCH"
echo echo
if [[ "$BRANCH" == "main" ]]; then if [[ "$BRANCH" == "main" ]]; then
echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." echo "docker build --build-arg GS_VERSION=$VERSION --build-arg GS_BUILD=$BUILD -t $TAG ."
docker build --no-cache-filter download,install \ # todo: --no-cache-filter download,install
docker build \
--build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip \
--build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/ \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/ \
--build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/ \
@ -60,8 +62,8 @@ if [[ $1 == *build* ]]; then
--build-arg GS_BUILD=$BUILD \ --build-arg GS_BUILD=$BUILD \
-t $TAG . -t $TAG .
else else
echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." echo "docker build --build-arg GS_VERSION=$VERSION --build-arg GS_BUILD=$BUILD -t $TAG ."
docker build --no-cache-filter download,install \ docker build \
--build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/$BRANCH/geoserver-$BRANCH-latest-war.zip \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/$BRANCH/geoserver-$BRANCH-latest-war.zip \
--build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/ext-latest/ \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/ext-latest/ \
--build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/community-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/community-latest/ \
@ -70,7 +72,7 @@ if [[ $1 == *build* ]]; then
-t $TAG . -t $TAG .
fi fi
else else
echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." echo "docker build --build-arg GS_VERSION=$VERSION --build-arg GS_BUILD=$BUILD -t $TAG ."
docker build \ docker build \
--build-arg GS_VERSION=$VERSION \ --build-arg GS_VERSION=$VERSION \
--build-arg GS_BUILD=$BUILD \ --build-arg GS_BUILD=$BUILD \