Skip to content

Commit

Permalink
TMP, do not merge this commit
Browse files Browse the repository at this point in the history
Signed-off-by: Andras Mitzki <andras.mitzki@axoflow.com>
  • Loading branch information
Andras Mitzki committed Dec 9, 2024
1 parent 5aa0644 commit ab1ede8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 129 deletions.
129 changes: 1 addition & 128 deletions .github/workflows/axosyslog-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,98 +46,9 @@ jobs:
IMAGE_NAME="$(echo "$IMAGE_NAME" | tr '[:upper:]' '[:lower:]')"
echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT
image-build:
if: github.repository_owner == 'axoflow' || github.event_name != 'schedule'
runs-on: ${{ matrix.platform == 'linux/arm64' && 'linux-arm64' || 'ubuntu-latest' }}
needs: prepare

strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.platform-matrix) }}

steps:
- name: Prepare
env:
PLATFORM: ${{ matrix.platform }}
TYPE: ${{ inputs.type }}
run: |
[ "$TYPE" = "stable" ] || [ "$TYPE" = "snapshot" ]
echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> $GITHUB_ENV
# TODO: remove this block once the arm64 runner is available for open-source and has docker pre-installed
if [ "${{ matrix.platform }}" = "linux/arm64" ]; then
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update && sudo apt-get install -y acl docker-ce docker-ce-cli containerd.io docker-buildx-plugin
USERID=$(id -u)
sudo setfacl --modify user:${USERID}:rw /var/run/docker.sock
fi
- name: Checkout source
uses: actions/checkout@v4

- name: Download source tarball artifact
if: inputs.snapshot-tarball-artifact != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.snapshot-tarball-artifact }}
path: docker/apkbuild/axoflow/axosyslog

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (AxoSyslog version) for Docker
id: docker-metadata
uses: docker/metadata-action@v5
with:
images: ${{ needs.prepare.outputs.image-name }}

- name: Build and push production Docker image
id: build
uses: docker/build-push-action@v5
with:
context: docker
file: docker/alpine.dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.docker-metadata.outputs.labels }}
outputs: type=image,name=${{ needs.prepare.outputs.image-name }},push-by-digest=true,name-canonical=true,push=true,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.docker-metadata.outputs.json).labels['org.opencontainers.image.description'] }}
build-args: |
PKG_TYPE=${{ inputs.type }}
SNAPSHOT_VERSION=${{ inputs.snapshot-version }}
- name: Export digest
env:
DIGEST: ${{ steps.build.outputs.digest }}
run: |
mkdir -p /tmp/digests
touch "/tmp/digests/${DIGEST#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge-and-push:
runs-on: ubuntu-latest
needs: [prepare, image-build]
needs: [prepare]
outputs:
tags: ${{ steps.docker-metadata-tags.outputs.tags }}
steps:
Expand Down Expand Up @@ -186,41 +97,3 @@ jobs:
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
echo "DEBUG_TAGS=${TAGS//,/-dbg,}-dbg" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
env:
TAGS: ${{ steps.tags.outputs.TAGS }}
IMAGE_NAME: ${{ needs.prepare.outputs.image-name }}
run: |
TAG_FLAGS="$(echo "$TAGS" | sed "s|[^,]*|-t &|g" | tr ',' ' ')"
docker buildx imagetools create $TAG_FLAGS $(printf "$IMAGE_NAME@sha256:%s " *)
- name: Checkout source
uses: actions/checkout@v4

- name: Download source tarball artifact
if: inputs.snapshot-tarball-artifact != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.snapshot-tarball-artifact }}
path: docker/apkbuild/axoflow/axosyslog

- name: Build and push debug Docker image
uses: docker/build-push-action@v5
with:
context: docker
file: docker/alpine.dockerfile
platforms: ${{ env.DEBUG_PLATFORM }}
push: true
tags: ${{ steps.tags.outputs.DEBUG_TAGS }}
build-args: |
PKG_TYPE=${{ inputs.type }}
SNAPSHOT_VERSION=${{ inputs.snapshot-version }}
DEBUG=true
1 change: 0 additions & 1 deletion .github/workflows/axosyslog-image-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
jobs:
pre-check:
runs-on: ubuntu-latest
if: github.repository_owner == 'axoflow'
steps:
- name: Validate tag
run: |
Expand Down

0 comments on commit ab1ede8

Please sign in to comment.