Skip to content

Commit

Permalink
Merge branch 'main' into tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag authored Feb 5, 2025
2 parents c68bb38 + 6459879 commit ab01475
Show file tree
Hide file tree
Showing 20 changed files with 280 additions and 93 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# /********************************************************************************
# * Copyright (c) 2024 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 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/

FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
ARG DEBIAN_FRONTEND=noninteractive
ENV CROSS_CONTAINER_IN_CONTAINER=true
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt install software-properties-common build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev -y

USER vscode
RUN cargo install cross cargo-license cargo-cyclonedx

# Installing pyEnv to set up specific version of Python
ENV HOME=/home/vscode
WORKDIR ${HOME}
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
ENV PYTHON_VERSION=3.12
RUN pyenv install ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}

# Fails due to gpg keyserver not accessible via corporate proxy
# Moved to postStartCommand.sh for DevContainer
# RUN pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Kuksa DevContainer",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
"mounts": [
{
"target": "/var/run/docker.sock",
"source": "/var/run/docker.sock",
"type": "bind"
}
]
}
14 changes: 14 additions & 0 deletions .devcontainer/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# Building all currently supported targets for databroker-cli.
# Uses cross for cross-compiling. Needs to be executed
# before docker build, as docker collects the artifacts
# created by this script
# this needs the have cross, cargo-license and kuksa sbom helper
# installed
#
# SPDX-License-Identifier: Apache-2.0

pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"
39 changes: 5 additions & 34 deletions .github/workflows/create_draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,16 @@
name: Create Draft Release

on:
workflow_dispatch: # input version manually. Overrides push tag
inputs:
tag:
description: "Release version, eg:latest, 0.2.1"
required: true
default: "0.0.0"

# As of today trigger only manually
#push:
# tags:
# - "*.*.*"
push:
tags:
- "*.*.*"

# Needed if GITHUB_TOKEN by default do not have right to create release
permissions:
contents: write
packages: write

jobs:
get_version:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
version: ${{ steps.eval_version.outputs.version }}
steps:
- name: Get tag or user release version
id: eval_version
run: |
GIT_VER="${GITHUB_REF/refs\/tags\//}"
echo "### Detected tag: $GIT_VER"
if [ -n "${{ github.event.inputs.tag }}" ]; then
GIT_VER="${{ github.event.inputs.tag }}"
echo "Forced release version: $GIT_VER"
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
else
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
fi
call_kuksa_databroker_build:
uses: ./.github/workflows/kuksa_databroker_build.yml
secrets:
Expand All @@ -66,7 +39,6 @@ jobs:
runs-on: ubuntu-latest
needs:
[
get_version,
call_kuksa_databroker_build,
call_kuksa_databroker-cli_build,
]
Expand All @@ -87,16 +59,15 @@ jobs:
ls -R build-artifacts
cd build-artifacts
# Rename, add release name (usually tag)
for f in databroker*.tar.gz; do mv "$f" "$(echo "$f" | sed s/.tar.gz/-${{ needs.get_version.outputs.version }}.tar.gz/)"; done
for f in databroker*.tar.gz; do mv "$f" "$(echo "$f" | sed s/.tar.gz/-${{ github.ref_name }}.tar.gz/)"; done
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/'
with:
draft: true
tag_name: KUKSA Databroker ${{ needs.get_version.outputs.version }}
name: KUKSA Databroker ${{ github.ref_name }}
fail_on_unmatched_files: true
files: |
build-artifacts/*
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/kuksa_databroker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ jobs:
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- uses: taiki-e/[email protected]
with:
tool: [email protected]
- name: "Check each feature"
working-directory: ${{github.workspace}}
run: cargo hack check --each-feature

build:
name: Build
Expand Down
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ https://www.eclipse.org/projects/handbook/#resources-commit

Contact the project developers via the project's "dev" list.

* https://dev.eclipse.org/mailman/listinfo/kuksa-dev
* https://accounts.eclipse.org/mailing-list/kuksa-dev

## Pre-commit set up
This repository is set up to use [pre-commit](https://pre-commit.com/) hooks.
Use `pip install pre-commit` to install pre-commit.
After you clone the project, run `pre-commit install` to install pre-commit into your git hooks.
Pre-commit will now run on every commit.
Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do.

## Linting

Please run the formatter and linter before opening pull requests:

```sh
cargo fmt -- --check
cargo clippy --all-targets -- -W warnings -D warnings
```
2 changes: 1 addition & 1 deletion databroker-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ http = "0.2.8"

[features]
default = ["tls"]
tls = ["tonic/tls"]
tls = ["tonic/tls", "kuksa-common/tls", "kuksa/tls"]
1 change: 1 addition & 0 deletions databroker-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct Cli {
}

impl Cli {
#[cfg(feature = "tls")]
pub fn get_ca_cert(&mut self) -> Option<String> {
self.ca_cert.clone()
}
Expand Down
2 changes: 1 addition & 1 deletion databroker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sd-notify = "0.4.1"

[features]
default = ["tls"]
tls = ["tonic/tls"]
tls = ["tonic/tls", "kuksa-common/tls", "kuksa/tls"]
jemalloc = ["dep:jemallocator"]
viss = ["dep:axum", "dep:chrono", "dep:uuid"]
libtest = []
Expand Down
2 changes: 1 addition & 1 deletion databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ pub struct AuthorizedAccess<'a, 'b> {
permissions: &'b Permissions,
}

impl<'a, 'b> AuthorizedAccess<'a, 'b> {
impl AuthorizedAccess<'_, '_> {
#[allow(clippy::too_many_arguments)]
pub async fn add_entry(
&self,
Expand Down
Loading

0 comments on commit ab01475

Please sign in to comment.