Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Align SOMEIP Feeder docker config #142

Align SOMEIP Feeder docker config

Align SOMEIP Feeder docker config #142

name: kuksa_gps_feeder
on:
push:
branches: [ main ]
tags:
- "v*.*.*"
pull_request:
branches: [ main ]
paths:
- ".github/actions/post-container-location/action.yml"
- ".github/workflows/check_push_rights.yml"
- ".github/workflows/kuksa_gps_feeder.yml"
- "gps2val/**"
workflow_dispatch:
env:
EPHEMERAL_IMAGE: "ttl.sh/kuksa.val.feeders/gps-${{ github.sha }}"
jobs:
checkrights:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit
build-self-hosted:
if: ${{ github.repository_owner == 'eclipse' }}
runs-on: [ self-hosted ]
needs: checkrights
# With default permissions, release action fails on forks
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: ghcr.io/${{ github.repository }}/gps
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Check Rights
run: |
echo "### [self-hosted] event:[${{ github.event_name }}], have_secrets: ${{ needs.checkrights.outputs.have_secrets }}"
shell: bash
- name: Log in to the Container registry
if: needs.checkrights.outputs.have_secrets == 'true'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push KUKSA gps feeder container image and push to ghcr.io
if: ${{ needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4
with:
platforms: |
linux/amd64
linux/arm64
context: gps2val
push: true
tags: |
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Posting ghcr.io Summary
if: ${{ needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request' }}
uses: ./.github/actions/post-container-location
with:
image: ${{ steps.meta.outputs.tags }}
docker-run-args: "-it --rm"
# NOTE: linux/arm64 platform removed as we are getting Error 413 from ttl.sh due to image size.
# Only merging to main / release should build multiarch image and push to ghcr.io
- name: Build ephemeral KUKSA gps feeder and push to ttl.sh
if: ${{ needs.checkrights.outputs.have_secrets == 'false' || github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
platforms: |
linux/amd64
context: gps2val
push: true
tags: ${{ env.EPHEMERAL_IMAGE }}
labels: ${{ steps.meta.outputs.labels }}
- name: Posting ttl.sh Summary
if: ${{ needs.checkrights.outputs.have_secrets == 'false' || github.event_name == 'pull_request' }}
uses: ./.github/actions/post-container-location
with:
image: ${{ env.EPHEMERAL_IMAGE }}
docker-run-args: "-it --rm"
message: "**NOTE:** Only **linux/amd64** image is included (ttl.sh push fails on big images)"
build:
# we don't have self hosted runners on forked repos, to optimize builds just amd64 image will be built
if: ${{ github.repository_owner != 'eclipse' }}
runs-on: ubuntu-latest
needs: checkrights
# With default permissions, release action fails on forks
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
## NOTE: Uncomment following step if you want to build arm64 image without self-hosted runner on eclipse. It needs ~3h to finish!
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: ghcr.io/${{ github.repository }}/gps
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Check Rights
run: |
echo "### event:[${{ github.event_name }}], have_secrets: ${{ needs.checkrights.outputs.have_secrets }}"
shell: bash
- name: Log in to the Container registry
if: needs.checkrights.outputs.have_secrets == 'true'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push KUKSA gps feeder container image and push to ghcr.io
if: ${{ needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4
with:
platforms: |
linux/amd64
context: gps2val
push: true
tags: |
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Posting ghcr.io Summary
if: ${{ needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request' }}
uses: ./.github/actions/post-container-location
with:
image: ${{ steps.meta.outputs.tags }}
docker-run-args: "-it --rm"
message: "**NOTE:** Only **linux/amd64** image is included (self-hosted runner not available on forks)"
- name: Build ephemeral KUKSA gps feeder and push to ttl.sh
if: ${{ needs.checkrights.outputs.have_secrets == 'false' || github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
platforms: |
linux/amd64
context: gps2val
push: true
tags: ${{ env.EPHEMERAL_IMAGE }}
labels: ${{ steps.meta.outputs.labels }}
- name: Posting ttl.sh Summary
if: ${{ needs.checkrights.outputs.have_secrets == 'false' || github.event_name == 'pull_request' }}
uses: ./.github/actions/post-container-location
with:
image: ${{ env.EPHEMERAL_IMAGE }}
docker-run-args: "-it --rm"
message: "**NOTE:** Only **linux/amd64** image is included (self-hosted runner not available on forks)"