-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a different alpine linux version per ansible version (#3)
* WIP * Update build.sh to be a bit more dumb, just try building all the variations * Only bother removing externally-managed files if we got some resutls * Allow building on PR for now * Fix alpine versions * Quote versions so they don’t get truncated weirdly * Refactor build script * Remove current PR from actions
- Loading branch information
Showing
3 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
#!/bin/bash | ||
# You can get an idea for which alpine version you need by looking here: | ||
# https://pkgs.alpinelinux.org/packages?name=python3&branch=v3.15&repo=&arch=&maintainer= | ||
# | ||
# You can check what Python3 version is available for which Alpine Linux version and adjust accordingly. | ||
# | ||
# You should check https://endoflife.date/ansible to consider which Python version is suitable. | ||
|
||
ANSIBLE_VERSION=4.8.0 | ||
# Using two parallel arrays to match up an ansible version to its base alpine image | ||
# MacOS doesn't come with a high enough bash version to use bash associative arrays. | ||
ANSIBLE_VERSIONS=("2.10.0" "3.4.0" "4.8.0" "4.10.0" "5.5.0" "5.8.0" "5.10.0" "6.7.0" "7.7.0" "8.7.0" "9.7.0" "10.1.0") | ||
BASE_IMAGES=("alpine:3.13" "alpine:3.15" "alpine:3.15" "alpine:3.15" "alpine:3.16" "alpine:3.16" "alpine:3.16" "alpine:3.16" "alpine:3.18" "alpine:3.18" "alpine:3.20" "alpine:3.20") | ||
|
||
if [ -n "$1" ]; then | ||
ANSIBLE_VERSION=$1; | ||
shift 1 | ||
fi | ||
LENGTH=${#ANSIBLE_VERSIONS[@]} | ||
|
||
# Ansible 4.8.0 | ||
(docker build --build-arg ANSIBLE_VERSION=${ANSIBLE_VERSION} . -t rareloop/ansible:${ANSIBLE_VERSION} && docker push rareloop/ansible:${ANSIBLE_VERSION}) | ||
for (( i=0; i<${LENGTH}; i++ )); do | ||
ANSIBLE_VERSION=${ANSIBLE_VERSIONS[$i]} | ||
BASE_IMAGE=${BASE_IMAGES[$i]} | ||
|
||
echo "====================="; | ||
echo "Ansible Version: ${ANSIBLE_VERSION}"; | ||
echo "Base Image: ${BASE_IMAGE}"; | ||
echo "====================="; | ||
|
||
docker build --build-arg ANSIBLE_VERSION="${ANSIBLE_VERSION}" --build-arg BASE_IMAGE="${BASE_IMAGE}" . -t rareloop-local/ansible:"${ANSIBLE_VERSION}" | ||
docker run -it --rm rareloop-local/ansible:"${ANSIBLE_VERSION}" ansible --version | ||
|
||
echo ""; | ||
echo ""; | ||
echo ""; | ||
done |