mirror of
https://github.com/HariSekhon/DevOps-Bash-tools.git
synced 2025-02-06 09:28:21 +00:00
updated docker_package_check.sh
This commit is contained in:
parent
e9b439e7b8
commit
de66527647
@ -23,8 +23,8 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# shellcheck disable=SC2034,SC2154
|
||||
usage_description="
|
||||
Runs package installs on all the major versions of a given docker image to check given packages
|
||||
are available before adding them and breaking builds across distro versions
|
||||
Runs package installs on the last 8 major versions of a given docker image to check given packages are available
|
||||
before adding them and breaking builds across distro versions
|
||||
|
||||
Uses adjacent scripts:
|
||||
|
||||
@ -34,6 +34,8 @@ Uses adjacent scripts:
|
||||
|
||||
to install the packages using whatever local package manager is detected
|
||||
|
||||
Set environment variable MAX_VERSIONS to change the number of distro versions to run against (default: 8)
|
||||
|
||||
Currently only supports DockerHub images
|
||||
"
|
||||
|
||||
@ -48,6 +50,12 @@ min_args 2 "$@"
|
||||
image="$1"
|
||||
shift || :
|
||||
|
||||
max_versions="${MAX_VERSIONS:-8}"
|
||||
|
||||
if ! is_int "$max_versions"; then
|
||||
die "MAX_VERSIONS may only be set to an integer, not: $max_versions"
|
||||
fi
|
||||
|
||||
check_bin docker
|
||||
|
||||
if [[ "$image" =~ alpine ]]; then
|
||||
@ -74,6 +82,8 @@ if grep -Eq '^[[:digit:]]+$' <<< "$major_versions"; then
|
||||
major_versions="$(grep -EO -e '^[[:digit:]]+$' -e 'latest' <<< "$major_versions" | sort -Vr)"
|
||||
fi
|
||||
|
||||
major_versions="$(head -n "$max_versions" <<< "$major_versions")"
|
||||
|
||||
echo
|
||||
timestamp "Running for major versions:"
|
||||
echo
|
||||
|
Loading…
x
Reference in New Issue
Block a user