Add images for Release Candidates

This commit is contained in:
Tilo Spannagel 2018-03-13 10:58:19 +01:00
parent cf450e5d14
commit d104e1cba0
No known key found for this signature in database
GPG Key ID: B89F1626A58E1429
5 changed files with 112 additions and 59 deletions

View File

@ -95,9 +95,9 @@ RUN set -ex; \
; \
\
curl -fsSL -o nextcloud.tar.bz2 \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
"%%BASE_DOWNLOAD_URL%%/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
"%%BASE_DOWNLOAD_URL%%/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View File

@ -99,9 +99,9 @@ ENV NEXTCLOUD_VERSION %%VERSION%%
RUN set -ex; \
curl -fsSL -o nextcloud.tar.bz2 \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
"%%BASE_DOWNLOAD_URL%%/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
"%%BASE_DOWNLOAD_URL%%/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View File

@ -21,9 +21,9 @@ function run_as() {
installed_version="0.0.0~unknown"
if [ -f /var/www/html/version.php ]; then
installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";')
installed_version=$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')
fi
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";')
image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"

View File

@ -16,12 +16,12 @@ dockerfileCommit() {
(
cd "$dir";
fileCommit Dockerfile \
$(git show HEAD:./Dockerfile | awk '
$(awk '
toupper($1) == "COPY" {
for (i = 2; i < NF; i++)
print $i;
}
')
' Dockerfile)
)
}
@ -57,8 +57,14 @@ join() {
}
latest=$( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \
grep -oE '[[:digit:]]+(.[[:digit:]]+)+' | \
grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}' | \
grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' | \
sort -uV | \
tail -1 )
latest_rc=$( curl -fsSL 'https://download.nextcloud.com/server/prereleases/' |tac|tac| \
grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
sort -uV | \
tail -1 )
@ -72,12 +78,23 @@ for version in "${versions[@]}"; do
done) )
for variant in "${variants[@]}"; do
commit="$(dockerfileCommit "$version/$variant")"
fullversion="$(git show "$commit":"$version/$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "NEXTCLOUD_VERSION" { print $3; exit }')"
fullversion_with_extension="$( awk '$1 == "ENV" && $2 == "NEXTCLOUD_VERSION" { print $3; exit }' "$version/$variant/Dockerfile" )"
fullversion="$( echo "$fullversion_with_extension" | grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}')"
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )
if [ "$fullversion" = "$latest" ]; then
versionAliases=( )
versionPostfix=""
if [ "$fullversion_with_extension" != "$fullversion" ]; then
versionAliases=( "$fullversion_with_extension" )
versionPostfix="-rc"
fi
versionAliases+=( "$fullversion$versionPostfix" "${fullversion%.*}$versionPostfix" "${fullversion%.*.*}$versionPostfix" )
if [ "$fullversion_with_extension" = "$latest" ]; then
versionAliases+=( "latest" )
fi
if [ "$fullversion_with_extension" = "$latest_rc" ]; then
versionAliases+=( "rc" )
fi
variantAliases=( "${versionAliases[@]/%/-$variant}" )
variantAliases=( "${variantAliases[@]//latest-}" )

View File

@ -29,70 +29,106 @@ declare -A pecl_versions=(
[redis]='3.1.6'
)
variants=(
apache
fpm
fpm-alpine
)
min_version='11.0'
# version_greater_or_equal A B returns whether A >= B
function version_greater_or_equal() {
[[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" || "$1" == "$2" ]];
}
latests=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \
grep -oE '[[:digit:]]+(.[[:digit:]]+)+' | \
sort -urV ) )
find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+' -exec rm -r '{}' \;
# checks if the the rc is already released
function check_released() {
printf '%s\n' "${fullversions[@]}" | grep -qE "^$( echo "$1" | grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' )"
}
travisEnv=
for latest in "${latests[@]}"; do
version=$(echo "$latest" | cut -d. -f1-2)
if [ -d "$version" ]; then
continue
fi
function create_variant() {
dir="$1/$variant"
# Only add versions >= 11
if version_greater_or_equal "$version" "11.0"; then
for variant in apache fpm fpm-alpine; do
# Create the version+variant directory with a Dockerfile.
mkdir -p "$version/$variant"
mkdir -p "$dir"
template="Dockerfile-${base[$variant]}.template"
cp "$template" "$version/$variant/Dockerfile"
cp "Dockerfile-${base[$variant]}.template" "$dir/Dockerfile"
echo "updating $latest [$version] $variant"
echo "updating $fullversion [$1] $variant"
# Replace the variables.
sed -ri -e '
s/%%PHP_VERSION%%/'"${php_version[$version]-${php_version[default]}}"'/g;
s/%%VARIANT%%/'"$variant"'/g;
s/%%VERSION%%/'"$latest"'/g;
s/%%VERSION%%/'"$fullversion"'/g;
s/%%BASE_DOWNLOAD_URL%%/'"$2"'/g;
s/%%CMD%%/'"${cmd[$variant]}"'/g;
s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g;
s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
' "$version/$variant/Dockerfile"
' "$dir/Dockerfile"
# Copy the shell scripts
for name in entrypoint cron; do
cp "docker-$name.sh" "$version/$variant/$name.sh"
cp "docker-$name.sh" "$dir/$name.sh"
done
# Copy the config directory
cp -rT .config "$version/$variant/config"
cp -rT .config "$dir/config"
# Remove Apache config if we're not an Apache variant.
if [ "$variant" != "apache" ]; then
rm "$version/$variant/config/apache-pretty-urls.config.php"
rm "$dir/config/apache-pretty-urls.config.php"
fi
for arch in i386 amd64; do
travisEnv='\n - env: VERSION='"$version"' VARIANT='"$variant"' ARCH='"$arch$travisEnv"
travisEnv='\n - env: VERSION='"$1"' VARIANT='"$variant"' ARCH='"$arch$travisEnv"
done
}
find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+\(-rc\)\?' -exec rm -r '{}' \;
fullversions=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}' | \
grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' | \
sort -urV ) )
versions=( $( printf '%s\n' "${fullversions[@]}" | cut -d. -f1-2 | sort -urV ) )
for version in "${versions[@]}"; do
fullversion="$( printf '%s\n' "${fullversions[@]}" | grep -E "^$version" | head -1 )"
if version_greater_or_equal "$version" "$min_version"; then
for variant in "${variants[@]}"; do
create_variant "$version" "https:\/\/download.nextcloud.com\/server\/releases"
done
fi
done
fullversions_rc=( $( curl -fsSL 'https://download.nextcloud.com/server/prereleases/' |tac|tac| \
grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
sort -urV ) )
versions_rc=( $( printf '%s\n' "${fullversions_rc[@]}" | cut -d. -f1-2 | sort -urV ) )
for version in "${versions_rc[@]}"; do
fullversion="$( printf '%s\n' "${fullversions_rc[@]}" | grep -E "^$version" | head -1 )"
if version_greater_or_equal "$version" "$min_version"; then
if ! check_released "$fullversion"; then
for variant in "${variants[@]}"; do
create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases"
done
fi
fi
done
# replace the fist '-' with ' '
travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"