Skip to content

ssh-agent-docker

ssh-agent-docker #4

---
# Workdlow to build the SSH Agent Docker base image used on tests
name: ssh-agent-docker
on:
workflow_dispatch:
permissions:
contents: read
jobs:
docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,prefix=base,value=latest,enable={{is_default_branch}}
type=ref,prefix=base,event=branch
type=ref,prefix=base,event=pr
type=sha,prefix=base
- name: Build and push
uses: docker/build-push-action@v6
id: build
with:
context: src/test/resources/hudson/plugins/sshslaves/agents/ssh-agent-base
platforms: linux/amd64,linux/arm64
push: true
sbom: true
provenance: mode=max
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
- name: Write Summary
run: |
DOCKER_IMAGE="$(printenv DOCKER_METADATA_OUTPUT_JSON|jq -r '.tags[0]')"
echo "docker pull ${DOCKER_IMAGE}" >> "${GITHUB_STEP_SUMMARY}"