Skip to content

[Feat] Support logon session affinity #21

[Feat] Support logon session affinity

[Feat] Support logon session affinity #21

name: PR Docker Build
on:
pull_request:
types: [labeled]
env:
REGISTRY: ghcr.io
jobs:
build-on-label:
if: (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-images')
strategy:
matrix:
workload: ["controller", "server", "web-hooks"]
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
outputs:
pr-number: ${{ github.event.pull_request.number }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: cap-operator-sap
password: ${{ secrets.CAP_OPERATOR_SAP_PKG_PUSH }}
- name: Prepare repository name
id: prepare-repository-name
run: |
repository=$REGISTRY/cap-operator-sap/pr-image/${{ matrix.workload }}
echo "repository=${repository,,}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: extract-metadata
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=pr-${{ github.event.pull_request.number }}
images: ${{ steps.prepare-repository-name.outputs.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: build/${{ matrix.workload }}/Dockerfile
platforms: linux/amd64,linux/arm64
context: .
cache-from: |
type=gha,scope=${{ matrix.workload }}-sha-${{ github.sha }}
type=gha,scope=${{ github.ref_name }}-${{ matrix.workload }}
type=gha,scope=${{ github.base_ref || 'main' }}
type=gha,scope=main
cache-to: |
type=gha,scope=${{ matrix.workload }}-sha-${{ github.sha }},mode=max
type=gha,scope=${{ github.ref_name }}-${{ matrix.workload }},mode=max
push: true
tags: ${{ steps.extract-metadata.outputs.tags }}
labels: ${{ steps.extract-metadata.outputs.labels }}
summary:
name: PR Docker Image Summary
needs: build-on-label
if: success()
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Add PR image info to workflow summary
run: |
PR=${{ needs.build-on-label.outputs.pr-number }}
IMAGE_BASE="ghcr.io/cap-operator-sap/pr-image"
echo "### 🚀 Docker Images Built for PR #$PR" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- \`$IMAGE_BASE/controller:pr-$PR\`" >> $GITHUB_STEP_SUMMARY
echo "- \`$IMAGE_BASE/server:pr-$PR\`" >> $GITHUB_STEP_SUMMARY
echo "- \`$IMAGE_BASE/web-hooks:pr-$PR\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY