chore(deps): update docker/setup-buildx-action action to v2.10.0 #400
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Docker | |
on: | |
workflow_dispatch: | |
workflow_call: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/[email protected] | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to the GH Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: | | |
${{ github.repository }} | |
ghcr.io/${{ github.repository }} | |
- name: Get opi-api Version Info | |
run: echo "OPI_API_VERSION=$(go list -m -f '{{.Version}}' github.com/opiproject/opi-api || echo 'undefined')" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: | | |
${{ steps.meta.outputs.labels }}, | |
opi-api-version=${{ env.OPI_API_VERSION }} | |
- name: Update Docker Hub Description | |
if: github.event_name != 'pull_request' | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN_DELETE }} | |
repository: ${{ github.repository }} | |
short-description: ${{ github.event.repository.description }} | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/[email protected] | |
- name: Install additional kernel modules needed for OPI like VRF | |
run: sudo apt-get install linux-modules-extra-$(uname -r) | |
- name: Load additional kernel modules needed for OPI like VRF | |
run: sudo modprobe -v vrf | |
- name: Start containers | |
run: docker-compose up --build --force-recreate --detach opi-test | |
- name: Run Tests | |
run: | | |
set -x | |
name=$(docker-compose ps | grep opi-test | awk '{print $1}') | |
rc=$(docker wait "${name}") | |
if [ "${rc}" != "0" ]; then | |
echo "opi-test failed:" | |
docker logs "${name}" | |
exit 1 | |
fi | |
- name: Logs | |
if: always() | |
run: docker-compose logs | |
- name: Stop containers | |
if: always() | |
run: docker-compose down --volumes --remove-orphans |