Feature: Add alpine
3.19
images and bump ansible
versions for `…
#137
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
name: build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
alpine: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
OS: [alpine] | |
OS_VARIANT: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17', '3.18', '3.19', edge] | |
include: | |
- OS: alpine | |
OS_VARIANT: 3.8 | |
BASE_IMAGE_TAG: 3.8 | |
ANSIBLE_VERSION: 2.6.20 | |
- OS: alpine | |
OS_VARIANT: 3.9 | |
BASE_IMAGE_TAG: 3.9 | |
ANSIBLE_VERSION: 2.7.17 | |
- OS: alpine | |
OS_VARIANT: 3.10 | |
BASE_IMAGE_TAG: '3.10' | |
ANSIBLE_VERSION: 2.8.19 | |
- OS: alpine | |
OS_VARIANT: 3.11 | |
BASE_IMAGE_TAG: '3.11' | |
ANSIBLE_VERSION: 2.9.18 | |
- OS: alpine | |
OS_VARIANT: 3.12 | |
BASE_IMAGE_TAG: '3.12' | |
ANSIBLE_VERSION: 2.9.18 | |
- OS: alpine | |
OS_VARIANT: 3.13 | |
BASE_IMAGE_TAG: '3.13' | |
ANSIBLE_VERSION: 2.10.7 | |
- OS: alpine | |
OS_VARIANT: 3.14 | |
BASE_IMAGE_TAG: '3.14' | |
ANSIBLE_VERSION: 2.10.7 | |
- OS: alpine | |
OS_VARIANT: 3.15 | |
BASE_IMAGE_TAG: '3.15' | |
ANSIBLE_VERSION: 4.8.0 | |
- OS: alpine | |
OS_VARIANT: 3.16 | |
BASE_IMAGE_TAG: '3.16' | |
ANSIBLE_VERSION: 5.8.0 | |
TAG_OS: true | |
TAG_LATEST: true | |
- OS: alpine | |
OS_VARIANT: 3.17 | |
BASE_IMAGE_TAG: '3.17' | |
ANSIBLE_VERSION: 6.6.0 | |
- OS: alpine | |
OS_VARIANT: 3.18 | |
BASE_IMAGE_TAG: '3.18' | |
ANSIBLE_VERSION: 7.5.0 | |
- OS: alpine | |
OS_VARIANT: 3.19 | |
BASE_IMAGE_TAG: '3.19' | |
ANSIBLE_VERSION: 8.6.1 | |
- OS: alpine | |
OS_VARIANT: edge | |
BASE_IMAGE_TAG: edge | |
ANSIBLE_VERSION: 9.1.0 | |
env: | |
OS: ${{ matrix.OS }} | |
OS_VARIANT: ${{ matrix.OS_VARIANT }} | |
ANSIBLE_VERSION: ${{ matrix.ANSIBLE_VERSION }} | |
TAG_OS: ${{ matrix.TAG_OS }} | |
TAG_LATEST: ${{ matrix.TAG_LATEST }} | |
BASE_REGISTRY_NAMESPACE: library | |
BASE_IMAGE_NAME: ${{ matrix.OS }} | |
BASE_TAG_FULL: ${{ matrix.BASE_IMAGE_TAG }} | |
BUILD_REGISTRY_NAMESPACE: ${{ vars.DOCKERHUB_REGISTRY_USER }} | |
BUILD_IMAGE_NAME: ansible | |
BUILD_TAG_FULL: ${{ matrix.ANSIBLE_VERSION }}-${{ matrix.OS }}-${{ matrix.OS_VARIANT }} | |
BUILD_CONTEXT: variants/${{ matrix.OS }}/${{ matrix.OS_VARIANT }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Display system info (linux) | |
run: | | |
set -e | |
hostname | |
whoami | |
cat /etc/*release | |
lscpu | |
free | |
df -h | |
pwd | |
docker info | |
docker version | |
- name: Login to docker registry | |
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin | |
env: | |
DOCKERHUB_REGISTRY_USER: ${{ vars.DOCKERHUB_REGISTRY_USER }} | |
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} | |
- name: Build image | |
run: | | |
set -e | |
echo "OS: $OS" | |
echo "OS_VARIANT: $OS_VARIANT" | |
echo "ANSIBLE_VERSION: $ANSIBLE_VERSION" | |
echo "TAG_OS: $TAG_OS" | |
echo "TAG_LATEST: $TAG_LATEST" | |
echo "BASE_REGISTRY_NAMESPACE: $BASE_REGISTRY_NAMESPACE" | |
echo "BASE_IMAGE_NAME: $BASE_IMAGE_NAME" | |
echo "BASE_TAG_FULL: $BASE_TAG_FULL" | |
echo "BUILD_REGISTRY_NAMESPACE: $BUILD_REGISTRY_NAMESPACE" | |
echo "BUILD_IMAGE_NAME: $BUILD_IMAGE_NAME" | |
echo "BUILD_TAG_FULL: $BUILD_TAG_FULL" | |
echo "BUILD_CONTEXT: $BUILD_CONTEXT" | |
echo "BASE_IMAGE: ${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL}" | |
echo "BUILD_IMAGE: ${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" | |
time docker pull "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" || true | |
time docker build \ | |
--cache-from "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" \ | |
-t "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" \ | |
--build-arg BASE_IMAGE="${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL}" \ | |
"$BUILD_CONTEXT" | |
if [ "${TAG_OS}" = 'true' ]; then | |
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${OS}" | |
fi | |
if [ "${TAG_LATEST}" = 'true' ]; then | |
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:latest" | |
fi | |
docker images | |
docker inspect "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" | |
- name: Test image | |
run: docker run -t --rm "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" ansible --version | |
- name: Push image | |
if: startsWith(github.ref, 'refs/tags/') | |
run: docker push -a "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}" | |
- name: Clean-up | |
run: docker logout | |
if: always() | |
ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
OS: [ubuntu] | |
OS_VARIANT: [16.04, 18.04, 20.04, 22.04] | |
PACKAGE_TYPE: [default, ppa] | |
include: | |
- OS: ubuntu | |
OS_VARIANT: 16.04 | |
BASE_IMAGE_TAG: xenial-20210804 | |
- OS: ubuntu | |
OS_VARIANT: 18.04 | |
BASE_IMAGE_TAG: bionic-20221130 | |
- OS: ubuntu | |
OS_VARIANT: 20.04 | |
BASE_IMAGE_TAG: focal-20221130 | |
- OS: ubuntu | |
OS_VARIANT: 22.04 | |
BASE_IMAGE_TAG: jammy-20221130 | |
- OS: ubuntu | |
OS_VARIANT: 16.04 | |
PACKAGE_TYPE: default | |
ANSIBLE_VERSION: 2.1.1.0 | |
- OS: ubuntu | |
OS_VARIANT: 18.04 | |
PACKAGE_TYPE: default | |
ANSIBLE_VERSION: 2.5.1 | |
- OS: ubuntu | |
OS_VARIANT: 20.04 | |
PACKAGE_TYPE: default | |
ANSIBLE_VERSION: 2.9.6 | |
- OS: ubuntu | |
OS_VARIANT: 22.04 | |
PACKAGE_TYPE: default | |
ANSIBLE_VERSION: 2.10.7 | |
- OS: ubuntu | |
OS_VARIANT: 16.04 | |
PACKAGE_TYPE: ppa | |
SUFFIX_PPA: -ppa | |
ANSIBLE_VERSION: 2.9.27 | |
- OS: ubuntu | |
OS_VARIANT: 18.04 | |
PACKAGE_TYPE: ppa | |
SUFFIX_PPA: -ppa | |
ANSIBLE_VERSION: 2.9.27 | |
- OS: ubuntu | |
OS_VARIANT: 20.04 | |
PACKAGE_TYPE: ppa | |
SUFFIX_PPA: -ppa | |
ANSIBLE_VERSION: 5.10.0 | |
TAG_OS: true | |
- OS: ubuntu | |
OS_VARIANT: 22.04 | |
PACKAGE_TYPE: ppa | |
SUFFIX_PPA: -ppa | |
ANSIBLE_VERSION: 8.7.0 | |
env: | |
OS: ${{ matrix.OS }} | |
OS_VARIANT: ${{ matrix.OS_VARIANT }} | |
ANSIBLE_VERSION: ${{ matrix.ANSIBLE_VERSION }} | |
TAG_OS: ${{ matrix.TAG_OS }} | |
TAG_LATEST: ${{ matrix.TAG_LATEST }} | |
BASE_REGISTRY_NAMESPACE: library | |
BASE_IMAGE_NAME: ${{ matrix.OS }} | |
BASE_TAG_FULL: ${{ matrix.BASE_IMAGE_TAG }} | |
BUILD_REGISTRY_NAMESPACE: ${{ vars.DOCKERHUB_REGISTRY_USER }} | |
BUILD_IMAGE_NAME: ansible | |
BUILD_TAG_FULL: ${{ matrix.ANSIBLE_VERSION }}-${{ matrix.OS }}-${{ matrix.OS_VARIANT }}${{ matrix.SUFFIX_PPA }} | |
BUILD_CONTEXT: variants/${{ matrix.OS }}/${{ matrix.OS_VARIANT }}${{ matrix.SUFFIX_PPA }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Display system info (linux) | |
run: | | |
set -e | |
hostname | |
whoami | |
cat /etc/*release | |
lscpu | |
free | |
df -h | |
pwd | |
docker info | |
docker version | |
- name: Login to docker registry | |
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin | |
env: | |
DOCKERHUB_REGISTRY_USER: ${{ vars.DOCKERHUB_REGISTRY_USER }} | |
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} | |
- name: Build image | |
run: | | |
set -e | |
echo "OS: $OS" | |
echo "OS_VARIANT: $OS_VARIANT" | |
echo "ANSIBLE_VERSION: $ANSIBLE_VERSION" | |
echo "TAG_OS: $TAG_OS" | |
echo "TAG_LATEST: $TAG_LATEST" | |
echo "BASE_REGISTRY_NAMESPACE: $BASE_REGISTRY_NAMESPACE" | |
echo "BASE_IMAGE_NAME: $BASE_IMAGE_NAME" | |
echo "BASE_TAG_FULL: $BASE_TAG_FULL" | |
echo "BUILD_REGISTRY_NAMESPACE: $BUILD_REGISTRY_NAMESPACE" | |
echo "BUILD_IMAGE_NAME: $BUILD_IMAGE_NAME" | |
echo "BUILD_TAG_FULL: $BUILD_TAG_FULL" | |
echo "BUILD_CONTEXT: $BUILD_CONTEXT" | |
echo "BASE_IMAGE: ${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL}" | |
echo "BUILD_IMAGE: ${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" | |
time docker pull "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" || true | |
time docker build \ | |
--cache-from "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" \ | |
-t "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" \ | |
--build-arg BASE_IMAGE="${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL}" \ | |
"$BUILD_CONTEXT" | |
if [ "${TAG_OS}" = 'true' ]; then | |
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${OS}" | |
fi | |
if [ "${TAG_LATEST}" = 'true' ]; then | |
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:latest" | |
fi | |
docker images | |
docker inspect "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" | |
- name: Test image | |
run: docker run -t --rm "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BUILD_TAG_FULL}" ansible --version | |
- name: Push image | |
if: startsWith(github.ref, 'refs/tags/') | |
run: docker push -a "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}" | |
- name: Clean-up | |
run: docker logout | |
if: always() | |
update-draft-release: | |
needs: [alpine, ubuntu] | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yml | |
publish: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-draft-release: | |
needs: [alpine, ubuntu] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yml | |
publish: true | |
name: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3' | |
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dockerhub-description: | |
needs: [alpine, ubuntu] | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_REGISTRY_USER }} | |
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} | |
repository: ${{ vars.DOCKERHUB_REGISTRY_USER }}/ansible | |
short-description: ${{ github.event.repository.description }} | |
readme-filepath: README.md |