-
Notifications
You must be signed in to change notification settings - Fork 13
Add build and containerize pipeline for configurable streamer #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ******************************************************************************** | ||
# Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# *******************************************************************************/ | ||
|
||
name: "Setup Rust and Cross" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to use rustc --print target-list already shows It's also listed on the targets page here as supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm cross is just a low-setup way to cross compile. If we dont use cross then we have to provide the build toolchain manually for each target like its done here: https://github.com/eclipse-sdv-blueprints/fleet-management/blob/main/components/Dockerfile.fms-consumer |
||
description: "Installs Rust and the Cross crate" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- name: Install Cross | ||
shell: bash | ||
run: cargo install cross --git https://github.com/cross-rs/cross |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
# ******************************************************************************** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of this I'm taking on faith it's being done correctly, since I'm not familiar enough with Docker and containerizing. 😅 A basic question though -- you've tested the resulting Docker image on your end to make sure it works? Anyone else that is more familiar with Docker I'd be super appreciative if you could take a look! cc @AnotherDaniel @sophokles73 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I tried around with the image and container by itself and found no issues yet. Im also using it in our work around the s2s blueprint and so far it behaves exactly like a streamer in a container should. |
||
# Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# *******************************************************************************/ | ||
|
||
name: Containerize uStreamer and Push to Container Registry | ||
|
||
on: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be done on each PR? Or only when we have a release? Would like your feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally I guess only for proper releases? Until we have a real release strategy though maybe I can just set it to "workflow_dispatch" provided that actually works. Then we can manually release whenever we feel like it. |
||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/configurable-streamer | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
steps: | ||
- name: Extract metadata and create tag | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
|
||
build-arm64: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
outputs: | ||
digest: ${{ steps.build_and_push.outputs.digest }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Rust and Cross | ||
uses: ./.github/actions/setup-rust-cross | ||
|
||
- name: Cross Build for arm64 | ||
working-directory: configurable-streamer | ||
run: | | ||
cross build --target aarch64-unknown-linux-musl --release | ||
|
||
- name: Fix Registry and Repository names | ||
shell: bash | ||
run: | | ||
echo "REGISTRY=$(echo $REGISTRY | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Build and push Docker image for arm64 | ||
id: build_and_push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: "configurable-streamer/Dockerfile.arm" | ||
push: true | ||
platforms: linux/arm64 | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:arm64-${{ github.sha }} | ||
labels: ${{ needs.setup.outputs.labels }} | ||
|
||
build-amd64: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
outputs: | ||
digest: ${{ steps.build_and_push.outputs.digest }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Rust and Cross | ||
uses: ./.github/actions/setup-rust-cross | ||
|
||
- name: Cross Build for amd64 | ||
working-directory: configurable-streamer | ||
run: | | ||
cross build --target x86_64-unknown-linux-musl --release | ||
|
||
- name: Fix Registry and Repository names | ||
shell: bash | ||
run: | | ||
echo "REGISTRY=$(echo $REGISTRY | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Build and push Docker image for amd64 | ||
id: build_and_push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: "configurable-streamer/Dockerfile.amd" | ||
push: true | ||
platforms: linux/amd64 | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:amd64-${{ github.sha }} | ||
labels: ${{ needs.setup.outputs.labels }} | ||
|
||
create-manifest: | ||
needs: [setup, build-arm64, build-amd64] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Login to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Fix Registry and Repository names | ||
shell: bash | ||
run: | | ||
echo "REGISTRY=$(echo $REGISTRY | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Create and push manifest | ||
shell: bash | ||
run: | | ||
for tag in ${{ needs.setup.outputs.tags }}; do | ||
docker buildx imagetools create -t $tag \ | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:amd64-${{ github.sha }} \ | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:arm64-${{ github.sha }} | ||
done |
Uh oh!
There was an error while loading. Please reload this page.