-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ubuntu-robotics/feat/first_draft
feat(rock): add the rock
- Loading branch information
Showing
6 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build rock on PR | ||
|
||
on: | ||
workflow_dispatch: {} | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine any rockcraft.yaml changed in the PR | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: "./rockcraft.yaml" | ||
|
||
- name: Setup LXD | ||
if: steps.changed-files.outputs.any_changed | ||
uses: canonical/[email protected] | ||
with: | ||
channel: latest/stable | ||
|
||
- name: Install dependencies | ||
if: steps.changed-files.outputs.any_changed | ||
run: | | ||
sudo snap install --classic rockcraft | ||
- name: Build ROCK | ||
if: steps.changed-files.outputs.any_changed | ||
run: | | ||
rockcraft pack --verbose |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# The workflow canonical/observability/.github/workflows/rock-release-dev.yaml@main | ||
# https://github.com/canonical/observability/blob/34b7edb56094e8e3f01200ce49e01bf9dd6688ac/.github/workflows/rock-release-dev.yaml | ||
# does not allow setting a GHCR repo where to publish at the moment. | ||
# We thus copy it below and adapt it. | ||
|
||
name: Build ROCK and release dev or branch tag to GHCR | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Find the *latest* rockcraft.yaml | ||
id: find-latest | ||
run: | | ||
latest_rockcraft_file=$(find $GITHUB_WORKSPACE -name "rockcraft.yaml" | sort -V | tail -n1) | ||
rockcraft_dir=$(dirname ${latest_rockcraft_file#\./}) | ||
echo "latest-dir=$rockcraft_dir" >> $GITHUB_OUTPUT | ||
- name: Build ROCK | ||
uses: canonical/craft-actions/rockcraft-pack@main | ||
with: | ||
path: "${{ steps.find-latest.outputs.latest-dir }}" | ||
verbosity: verbose | ||
id: rockcraft | ||
|
||
- name: Upload locally built ROCK artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ros2bag-fileserver | ||
path: ${{ steps.rockcraft.outputs.rock }} | ||
retention-days: 7 | ||
|
||
- name: Upload ROCK to ghcr.io | ||
run: | | ||
if [[ ${{ github.ref }} == 'refs/heads/main' ]] | ||
then | ||
TAG=dev | ||
else | ||
TAG=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | ||
TAG=$(echo $TAG | sed "s|\/|\_|") | ||
fi | ||
sudo skopeo --insecure-policy copy oci-archive:$(realpath ${{ steps.rockcraft.outputs.rock }}) docker://ghcr.io/ubuntu-robotics/ros2bag-fileserver:$TAG --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" | ||
- name: Generate digest | ||
run: | | ||
digest=$(skopeo inspect oci-archive:$(realpath ${{ steps.rockcraft.outputs.rock }}) --format '{{.Digest}}') | ||
echo "digest=${digest#*:}" >> "$GITHUB_OUTPUT" | ||
- name: Install Syft | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | ||
- name: Create SBOM | ||
run: syft $(realpath ${{ steps.rockcraft.outputs.rock }}) -o spdx-json=ros2bag-fileserver.sbom.json | ||
|
||
- name: Upload SBOM | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ros2bag-fileserver-sbom | ||
path: "ros2bag-fileserver.sbom.json" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.rock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
#ROS 2 bag file server | ||
|
||
This repository is hosting the rock to build the ROS 2 bag file server. | ||
This rock is meant to be working with the [ros2bag-fileserver-k8s-operator](https://github.com/ubuntu-robotics/ros2bag-fileserver-k8s-operator). | ||
|
||
## How to build | ||
|
||
Build the rock: | ||
``` | ||
rockcraft pack | ||
``` | ||
Add the rock to the local docker images: | ||
``` | ||
sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy oci-archive:ros2bag-fileserver_0.1_amd64.rock docker-daemon:ros2bag-fileserver:dev | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
:80 { | ||
# Set this path to your site's directory. | ||
root * /var/lib/caddy-fileserver | ||
|
||
# Enable the static file server. | ||
file_server browse | ||
header { | ||
Access-Control-Allow-Origin * | ||
Access-Control-Allow-Methods GET, POST, PUT, DELETE, OPTIONS | ||
Access-Control-Allow-Headers * | ||
} | ||
|
||
log { | ||
output file /var/log/access.log | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: ros2bag-fileserver | ||
summary: The ROS 2 bag fileserver | ||
description: | | ||
The ROS 2 bag fileserver to host | ||
mcap files | ||
version: '0.1' | ||
license: GPL-3.0 | ||
|
||
base: [email protected] | ||
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
|
||
package-repositories: | ||
- components: [main] | ||
formats: [deb] | ||
key-id: 65760C51EDEA2017CEA2CA15155B6D79CA56EA34 | ||
key-server: keyserver.ubuntu.com | ||
suites: [any-version] | ||
type: apt | ||
url: https://dl.cloudsmith.io/public/caddy/stable/deb/debian | ||
|
||
services: | ||
ros2bag-fileserver: | ||
override: replace | ||
startup: enabled | ||
command: /usr/bin/caddy run --config /srv/Caddyfile | ||
|
||
# Parts section | ||
parts: | ||
caddy: | ||
plugin: dump | ||
source: rock/local | ||
stage-packages: [rsync, caddy] | ||
overlay-packages: [openssh-server] | ||
organize: | ||
'Caddyfile' : srv/ | ||
|