Skip to content

OPSEXP-2240 testing #190

OPSEXP-2240 testing

OPSEXP-2240 testing #190

Workflow file for this run

---
name: build
on:
push:
branches:
- master
- bump-tomcat**
- OPSEXP-[0-9]+**
paths-ignore:
- .github/workflows/bumpVersions.yml
- updatecli.d/**
- get-checksum.sh
env:
IMAGE_REGISTRY_NAMESPACE: alfresco
IMAGE_REPOSITORY: alfresco-base-tomcat
jobs:
docker_images:
name: >-
Tomcat ${{ matrix.tomcat_major }}
jre${{ matrix.java_major }}
on ${{ matrix.base_image.flavor }}${{ matrix.base_image.major }}
strategy:
fail-fast: false
matrix:
# tomcat_major:
# - 9
# - 10
# base_image:
# - flavor: centos
# major: 7
# - flavor: rockylinux
# major: 8
# - flavor: rockylinux
# major: 9
# java_major:
# - 11
# - 17
include:
- tomcat_major: 9
base_image:
flavor: centos
major: 7
java_major: 11
- tomcat_major: 9
base_image:
flavor: rockylinux
major: 8
java_major: 11
- tomcat_major: 9
base_image:
flavor: rockylinux
major: 8
java_major: 17
- tomcat_major: 10
base_image:
flavor: rockylinux
major: 8
java_major: 11
- tomcat_major: 10
base_image:
flavor: rockylinux
major: 8
java_major: 17
- tomcat_major: 10
base_image:
flavor: rockylinux
major: 9
java_major: 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- id: vars
name: Compute Image Tag
env:
IMAGE_BASE_NAME: tomcat${{ matrix.tomcat_major }}-jre${{ matrix.java_major }}-${{ matrix.base_image.flavor }}${{ matrix.base_image.major }}
run: |
if [[ "${{ github.ref_name }}" != "master" ]]
then
echo "image_tag=${IMAGE_BASE_NAME}-${GITHUB_REF_NAME//\//-}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.head_commit.message }}" =~ .*\[release\].* ]]
then
echo "image_tag=$IMAGE_BASE_NAME" >> $GITHUB_OUTPUT
else
echo "image_tag=${IMAGE_BASE_NAME}-release-candidate" >> $GITHUB_OUTPUT
fi
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "image_anchor=$(date -u +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
echo "tomcat_version=$(jq -r .tomcat_version tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT
echo "tomcat_sha512=$(jq -r .tomcat_sha512 tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT
echo "tcnative_version=$(jq -r .tcnative_version tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT
echo "tcnative_sha512=$(jq -r .tcnative_sha512 tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Login to Docker Hub
if: contains(github.event.head_commit.message, '[release]') && github.ref_name == 'master'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build image for tests
uses: docker/[email protected]
with:
load: true
build-args: |
no-cache=true
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
TOMCAT_MAJOR=${{ matrix.tomcat_major }}
TOMCAT_VERSION=${{ steps.vars.outputs.tomcat_version }}
TOMCAT_SHA512=${{ steps.vars.outputs.tomcat_sha512 }}
TCNATIVE_VERSION=${{ steps.vars.outputs.tcnative_version }}
TCNATIVE_SHA512=${{ steps.vars.outputs.tcnative_sha512 }}
tags: local/${{ env.IMAGE_REPOSITORY }}:ci
target: TOMCAT_BASE_IMAGE
- name: Test Built Image
env:
CATALINA_OUT: /tmp/catalina.out
run: |
echo -n "Checking for Tomcat config: "
docker run local/${{ env.IMAGE_REPOSITORY }}:ci ./bin/catalina.sh configtest \
> ${{ env.CATALINA_OUT }} 2>&1
tail -1 ${{ env.CATALINA_OUT }} | grep '^INFO: Server initialization in '
echo -n "Checking for tcNative libs: "
grep 'Loaded Apache Tomcat Native library .* using APR version' ${{ env.CATALINA_OUT }}
echo -n "Checking shell environment: "
BASH_LOGIN_STDERR="$(docker run local/${{ env.IMAGE_REPOSITORY }}:ci /bin/bash 2>&1 > /dev/null || true)"
if [ -z "$BASH_LOGIN_STDERR" ]; then
echo ok
else echo 'bash reported an error'
echo $BASH_LOGIN_STDERR
exit 7
fi
- name: Build and Push Image to quay.io
uses: docker/[email protected]
with:
push: true
build-args: |
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
TOMCAT_MAJOR=${{ matrix.tomcat_major }}
TOMCAT_VERSION=${{ steps.vars.outputs.tomcat_version }}
TOMCAT_SHA512=${{ steps.vars.outputs.tomcat_sha512 }}
TCNATIVE_VERSION=${{ steps.vars.outputs.tcnative_version }}
TCNATIVE_SHA512=${{ steps.vars.outputs.tcnative_sha512 }}
REVISION=${{ github.run_number }}
CREATED=${{ steps.vars.outputs.image_created }}
tags: |
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}
target: TOMCAT_BASE_IMAGE
platforms: linux/amd64,linux/arm64/v8
- name: Push Image to docker.io
if: contains(github.event.head_commit.message, '[release]') && github.ref_name == 'master'
uses: akhilerm/tag-push-action@85bf542f43f5f2060ef76262a67ee3607cb6db37
with:
src: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
dst: |
${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}