2021-08-24 18:30:58 +02:00
|
|
|
name: Azure
|
2021-08-24 18:02:13 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '5.0'
|
|
|
|
- '5.4'
|
2021-08-25 13:50:10 +02:00
|
|
|
- 'trunk'
|
2021-08-24 18:02:13 +02:00
|
|
|
paths-ignore:
|
|
|
|
- '.env*'
|
|
|
|
- 'docker-compose*.yaml'
|
|
|
|
- '*/rhel/*'
|
|
|
|
- "**.md"
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
timeout-minutes: 70
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
build:
|
|
|
|
- agent
|
2021-08-25 02:24:53 +02:00
|
|
|
- agent2
|
|
|
|
- java-gateway
|
|
|
|
- proxy-mysql
|
|
|
|
- proxy-sqlite3
|
|
|
|
- server-mysql
|
|
|
|
- server-pgsql
|
|
|
|
- snmptraps
|
|
|
|
- web-apache-mysql
|
|
|
|
- web-apache-pgsql
|
|
|
|
- web-nginx-mysql
|
|
|
|
- web-nginx-pgsql
|
2021-08-24 18:02:13 +02:00
|
|
|
os:
|
|
|
|
- alpine
|
2021-08-25 02:24:53 +02:00
|
|
|
- ubuntu
|
|
|
|
- ol
|
2021-08-24 18:02:13 +02:00
|
|
|
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2021-08-25 13:50:10 +02:00
|
|
|
-
|
|
|
|
uses: actions/checkout@v2
|
2021-08-24 18:02:13 +02:00
|
|
|
|
2021-08-25 13:50:10 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
-
|
|
|
|
name: Login to Azure Container Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ secrets.azure_registry }}.azurecr.io
|
|
|
|
username: ${{ secrets.AZURE_USERNAME }}
|
|
|
|
password: ${{ secrets.AZURE_PASSWORD }}
|
2021-08-25 01:23:53 +02:00
|
|
|
|
2021-08-25 13:50:10 +02:00
|
|
|
- name: Prepare platform list
|
|
|
|
id: platform
|
|
|
|
run: |
|
|
|
|
DOCKER_PLATFORM="linux/amd64,linux/arm64"
|
|
|
|
echo ::set-output name=list::${DOCKER_PLATFORM}
|
2021-08-24 18:06:34 +02:00
|
|
|
|
2021-08-25 13:50:10 +02:00
|
|
|
- name: Prepare environment (push)
|
2021-08-25 01:34:09 +02:00
|
|
|
if: github.event_name == 'push'
|
2021-08-25 13:50:10 +02:00
|
|
|
id: prepare_push
|
|
|
|
run: |
|
|
|
|
TAGS_ARRAY=()
|
|
|
|
|
|
|
|
IMAGE_NAME="${{ secrets.azure_registry }}.azurecr.io/${{ matrix.os }}/zabbix-${{ matrix.build }}"
|
|
|
|
GIT_BRANCH="${GITHUB_REF##*/}"
|
|
|
|
GIT_BRANCH=`expr "${GIT_BRANCH}" : '\([0-9]*\.[0-9]*\).*'`
|
|
|
|
|
|
|
|
echo "::debug::Branch - ${GIT_BRANCH}"
|
|
|
|
|
|
|
|
TAGS_ARRAY+=("$IMAGE_NAME:${GIT_BRANCH}")
|
|
|
|
|
|
|
|
TAGS=$(printf -- "%s, " "${TAGS_ARRAY[@]}")
|
|
|
|
|
|
|
|
echo "::debug::Tags - ${TAGS}"
|
|
|
|
|
|
|
|
echo ::set-output name=image_name::${IMAGE_NAME}
|
|
|
|
echo ::set-output name=image_tag_versions::$(printf -- "%s," "${TAGS_ARRAY[@]}")
|
|
|
|
|
|
|
|
- name: Prepare environment (release)
|
2021-08-25 01:18:38 +02:00
|
|
|
if: github.event_name == 'release' && github.event.action == 'published'
|
2021-08-25 13:50:10 +02:00
|
|
|
id: prepare_release
|
|
|
|
run: |
|
|
|
|
TAGS_ARRAY=()
|
|
|
|
|
|
|
|
IMAGE_NAME="${{ secrets.azure_registry }}.azurecr.io/${{ matrix.os }}/zabbix-${{ matrix.build }}"
|
|
|
|
RELEASE_VERSION=${GITHUB_REF##*/}
|
|
|
|
GIT_BRANCH="${GITHUB_REF##*/}"
|
|
|
|
GIT_BRANCH=`expr "${GIT_BRANCH}" : '\([0-9]*\.[0-9]*\).*'`
|
|
|
|
|
|
|
|
echo "::debug::Release version ${RELEASE_VERSION}. Branch ${GIT_BRANCH}"
|
|
|
|
|
|
|
|
TAGS_ARRAY+=("$IMAGE_NAME:${RELEASE_VERSION}")
|
|
|
|
|
|
|
|
TAGS=$(printf -- "--tag %s " "${TAGS_ARRAY[@]}")
|
|
|
|
|
|
|
|
echo ::set-output name=image_name::${IMAGE_NAME}
|
|
|
|
echo ::set-output name=image_tag_versions::$(printf -- ",%s" "${TAGS_ARRAY[@]}")
|
|
|
|
|
|
|
|
- name: Prepare tags
|
|
|
|
id: prepare_tags
|
|
|
|
run: |
|
|
|
|
if [ ! -z "${{ steps.prepare_push.outputs.image_tag_versions }}" ]; then
|
|
|
|
TAGS="${{ steps.prepare_push.outputs.image_tag_versions }}"
|
|
|
|
IMAGE_NAME="${{ steps.prepare_push.outputs.image_name }}"
|
|
|
|
elif [ ! -z "${{ steps.prepare_release.outputs.image_tag_versions }}" ]; then
|
|
|
|
TAGS="${{ steps.prepare_release.outputs.image_tag_versions }}"
|
|
|
|
IMAGE_NAME="${{ steps.prepare_release.outputs.image_name }}"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ::set-output name=image_tag_versions::${TAGS}
|
|
|
|
echo ::set-output name=image_name::${IMAGE_NAME}
|
|
|
|
|
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: docker/build-push-action@v2
|
2021-08-25 01:18:38 +02:00
|
|
|
with:
|
2021-08-25 13:50:10 +02:00
|
|
|
context: ./${{ matrix.build }}/${{ matrix.os }}
|
|
|
|
file: ./${{ matrix.build }}/${{ matrix.os }}/Dockerfile
|
|
|
|
platforms: ${{ steps.platform.outputs.list }}
|
|
|
|
push: ${{ secrets.AUTO_PUSH_IMAGES }}
|
2021-08-25 13:53:07 +02:00
|
|
|
tags: ${{ steps.prepare_tags.outputs.image_tag_versions }}
|
2021-08-25 13:50:10 +02:00
|
|
|
|
|
|
|
-
|
|
|
|
name: Image digest
|
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|