Skip to content

Update controller and agent to kube-rs client 0.91.0 #69

Update controller and agent to kube-rs client 0.91.0

Update controller and agent to kube-rs client 0.91.0 #69

name: Build Production Rust Containers
on:
push:
branches: [ main ]
paths:
- .github/workflows/build-rust-containers.yml
- build/containers/Dockerfile.rust
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- version.txt
pull_request:
branches: [ main ]
paths:
- .github/workflows/build-rust-containers.yml
- build/containers/Dockerfile.rust
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- version.txt
release:
types:
- published
jobs:
build-agents:
# Run separately to heat the cache for every architecture
runs-on: ubuntu-latest
timeout-minutes: 80
strategy:
matrix:
component:
- label: agent
cargo-build-args: --release
- label: agent-full
cargo-build-args: --release -F agent-full,onvif-feat,opcua-feat,udev-feat
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Get version.txt
id: version-string
run: |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref_name }}-${{ matrix.component.label }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name == 'push' || github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.crUsername }}
password: ${{ secrets.crPassword }}
- name: Docker meta
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/project-akri/akri/${{ matrix.component.label }}
labels: |
org.opencontainers.image.title=akri-${{matrix.component.label}}
tags: |
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=raw,value=v${{steps.version-string.outputs.version}}-dev,enable=${{github.event_name != 'release'}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
build-args: |
AKRI_COMPONENT=agent
EXTRA_CARGO_ARGS=${{matrix.component.cargo-build-args}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: build/containers/Dockerfile.rust
platforms: linux/amd64,linux/arm64,linux/arm/v7
# This ensures we don't end-up with an ever-growing cache
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-others:
runs-on: ubuntu-latest
needs: build-agents
timeout-minutes: 50
strategy:
matrix:
component:
- label: controller
- label: webhook-configuration
- label: debug-echo-discovery-handler
- label: udev-discovery-handler
- label: opcua-discovery-handler
- label: onvif-discovery-handler
- label: udev-video-broker
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Get version.txt
id: version-string
run: |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT
echo "component_tag=$(echo "${{ matrix.component.label }}" | sed 's/-handler$//')" >> $GITHUB_OUTPUT
- name: Cache Docker layers
uses: actions/cache/restore@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref_name }}-agent
fail-on-cache-miss: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name == 'push' || github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.crUsername }}
password: ${{ secrets.crPassword }}
- name: Docker meta
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/project-akri/akri/${{steps.version-string.outputs.component_tag}}
labels: |
org.opencontainers.image.title=akri-${{matrix.component.label}}
tags: |
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=raw,value=v${{steps.version-string.outputs.version}}-dev,enable=${{github.event_name != 'release'}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
build-args: |
AKRI_COMPONENT=${{matrix.component.label}}
EXTRA_CARGO_ARGS=--release
cache-from: type=local,src=/tmp/.buildx-cache
# No cache-to here as we want to use the one from agent
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: build/containers/Dockerfile.rust
platforms: linux/amd64,linux/arm64,linux/arm/v7