Skip to content

Commit 1145279

Browse files
authored
Merge branch 'main' into feature/performance_improvements
2 parents 33e0d0b + 6459879 commit 1145279

File tree

21 files changed

+295
-105
lines changed

21 files changed

+295
-105
lines changed

Diff for: .devcontainer/Dockerfile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# /********************************************************************************
2+
# * Copyright (c) 2024 Contributors to the Eclipse Foundation
3+
# *
4+
# * See the NOTICE file(s) distributed with this work for additional
5+
# * information regarding copyright ownership.
6+
# *
7+
# * This program and the accompanying materials are made available under the
8+
# * terms of the Apache License 2.0 which is available at
9+
# * http://www.apache.org/licenses/LICENSE-2.0
10+
# *
11+
# * SPDX-License-Identifier: Apache-2.0
12+
# ********************************************************************************/
13+
14+
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
15+
ARG DEBIAN_FRONTEND=noninteractive
16+
ENV CROSS_CONTAINER_IN_CONTAINER=true
17+
ENV TZ=Europe/Berlin
18+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
19+
RUN apt-get update -y
20+
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
21+
22+
USER vscode
23+
RUN cargo install cross cargo-license cargo-cyclonedx
24+
25+
# Installing pyEnv to set up specific version of Python
26+
ENV HOME=/home/vscode
27+
WORKDIR ${HOME}
28+
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
29+
ENV PYENV_ROOT="${HOME}/.pyenv"
30+
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
31+
ENV PYTHON_VERSION=3.12
32+
RUN pyenv install ${PYTHON_VERSION}
33+
RUN pyenv global ${PYTHON_VERSION}
34+
35+
# Fails due to gpg keyserver not accessible via corporate proxy
36+
# Moved to postStartCommand.sh for DevContainer
37+
# RUN pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"

Diff for: .devcontainer/devcontainer.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
3+
{
4+
"name": "Kuksa DevContainer",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
},
8+
"features": {
9+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
10+
},
11+
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
12+
"mounts": [
13+
{
14+
"target": "/var/run/docker.sock",
15+
"source": "/var/run/docker.sock",
16+
"type": "bind"
17+
}
18+
]
19+
}

Diff for: .devcontainer/postStartCommand.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2024 Contributors to the Eclipse Foundation
4+
#
5+
# Building all currently supported targets for databroker-cli.
6+
# Uses cross for cross-compiling. Needs to be executed
7+
# before docker build, as docker collects the artifacts
8+
# created by this script
9+
# this needs the have cross, cargo-license and kuksa sbom helper
10+
# installed
11+
#
12+
# SPDX-License-Identifier: Apache-2.0
13+
14+
pip install "git+https://github.com/eclipse-kuksa/kuksa-common.git@v1#subdirectory=sbom-tools"

Diff for: .github/workflows/create_draft_release.yml

+5-34
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,16 @@
1414
name: Create Draft Release
1515

1616
on:
17-
workflow_dispatch: # input version manually. Overrides push tag
18-
inputs:
19-
tag:
20-
description: "Release version, eg:latest, 0.2.1"
21-
required: true
22-
default: "0.0.0"
23-
24-
# As of today trigger only manually
25-
#push:
26-
# tags:
27-
# - "*.*.*"
17+
push:
18+
tags:
19+
- "*.*.*"
2820

2921
# Needed if GITHUB_TOKEN by default do not have right to create release
3022
permissions:
3123
contents: write
3224
packages: write
3325

3426
jobs:
35-
get_version:
36-
runs-on: ubuntu-latest
37-
# Map a step output to a job output
38-
outputs:
39-
version: ${{ steps.eval_version.outputs.version }}
40-
steps:
41-
- name: Get tag or user release version
42-
id: eval_version
43-
run: |
44-
GIT_VER="${GITHUB_REF/refs\/tags\//}"
45-
echo "### Detected tag: $GIT_VER"
46-
if [ -n "${{ github.event.inputs.tag }}" ]; then
47-
GIT_VER="${{ github.event.inputs.tag }}"
48-
echo "Forced release version: $GIT_VER"
49-
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
50-
else
51-
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
52-
fi
53-
5427
call_kuksa_databroker_build:
5528
uses: ./.github/workflows/kuksa_databroker_build.yml
5629
secrets:
@@ -66,7 +39,6 @@ jobs:
6639
runs-on: ubuntu-latest
6740
needs:
6841
[
69-
get_version,
7042
call_kuksa_databroker_build,
7143
call_kuksa_databroker-cli_build,
7244
]
@@ -87,16 +59,15 @@ jobs:
8759
ls -R build-artifacts
8860
cd build-artifacts
8961
# Rename, add release name (usually tag)
90-
for f in databroker*.tar.gz; do mv "$f" "$(echo "$f" | sed s/.tar.gz/-${{ needs.get_version.outputs.version }}.tar.gz/)"; done
91-
62+
for f in databroker*.tar.gz; do mv "$f" "$(echo "$f" | sed s/.tar.gz/-${{ github.ref_name }}.tar.gz/)"; done
9263
9364
- name: Create release
9465
id: create_release
9566
uses: softprops/action-gh-release@v2
9667
# if: startsWith(github.ref, 'refs/tags/'
9768
with:
9869
draft: true
99-
tag_name: KUKSA Databroker ${{ needs.get_version.outputs.version }}
70+
name: KUKSA Databroker ${{ github.ref_name }}
10071
fail_on_unmatched_files: true
10172
files: |
10273
build-artifacts/*

Diff for: .github/workflows/kuksa_databroker_build.yml

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ on:
2424
QUAY_IO_USERNAME:
2525
required: true
2626
workflow_dispatch:
27+
# Run every Sunday night to check regressions, for example from clippy
28+
schedule:
29+
- cron: "0 4 * * 0"
2730

2831
# suffix to avoid cancellation when running from release workflow
2932
concurrency:
@@ -127,6 +130,12 @@ jobs:
127130
with:
128131
files: lcov.info
129132
token: ${{ secrets.CODECOV_TOKEN }}
133+
- uses: taiki-e/[email protected]
134+
with:
135+
136+
- name: "Check each feature"
137+
working-directory: ${{github.workspace}}
138+
run: cargo hack check --each-feature
130139

131140
build:
132141
name: Build

Diff for: CONTRIBUTING.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ https://www.eclipse.org/projects/handbook/#resources-commit
2222

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

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

2727
## Pre-commit set up
2828
This repository is set up to use [pre-commit](https://pre-commit.com/) hooks.
2929
Use `pip install pre-commit` to install pre-commit.
3030
After you clone the project, run `pre-commit install` to install pre-commit into your git hooks.
3131
Pre-commit will now run on every commit.
3232
Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do.
33+
34+
## Linting
35+
36+
Please run the formatter and linter before opening pull requests:
37+
38+
```sh
39+
cargo fmt -- --check
40+
cargo clippy --all-targets -- -W warnings -D warnings
41+
```

Diff for: databroker-cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ http = "0.2.8"
4848

4949
[features]
5050
default = ["tls"]
51-
tls = ["tonic/tls"]
51+
tls = ["tonic/tls", "kuksa-common/tls", "kuksa/tls"]

Diff for: databroker-cli/src/cli.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub struct Cli {
6161
}
6262

6363
impl Cli {
64+
#[cfg(feature = "tls")]
6465
pub fn get_ca_cert(&mut self) -> Option<String> {
6566
self.ca_cert.clone()
6667
}

Diff for: databroker/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ sd-notify = "0.4.1"
7575

7676
[features]
7777
default = ["tls"]
78-
tls = ["tonic/tls"]
78+
tls = ["tonic/tls", "kuksa-common/tls", "kuksa/tls"]
7979
jemalloc = ["dep:jemallocator"]
8080
viss = ["dep:axum", "dep:chrono", "dep:uuid"]
8181
libtest = []

Diff for: databroker/src/broker.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,10 @@ impl Subscriptions {
891891

892892
self.actuation_subscriptions.retain(|sub| {
893893
if !sub.actuation_provider.is_available() {
894-
info!("Provider gone: removing subscription");
894+
info!("Provider gone: removing provided actuation");
895895
false
896896
} else if sub.permissions.is_expired() {
897-
info!("Permissions of Provider expired: removing subscription");
897+
info!("Permissions of Provider expired: removing provided actuation");
898898
false
899899
} else {
900900
true
@@ -1180,7 +1180,7 @@ pub enum EntryReadAccess<'a> {
11801180
Err(&'a Metadata, ReadError),
11811181
}
11821182

1183-
impl<'a> EntryReadAccess<'a> {
1183+
impl EntryReadAccess<'_> {
11841184
pub fn datapoint(&self) -> Result<&Datapoint, ReadError> {
11851185
match self {
11861186
Self::Entry(entry) => Ok(&entry.datapoint),
@@ -1220,7 +1220,7 @@ pub struct EntryReadIterator<'a, 'b> {
12201220
permissions: &'b Permissions,
12211221
}
12221222

1223-
impl<'a, 'b> Iterator for EntryReadIterator<'a, 'b> {
1223+
impl<'a> Iterator for EntryReadIterator<'a, '_> {
12241224
type Item = EntryReadAccess<'a>;
12251225

12261226
#[inline]
@@ -1236,7 +1236,7 @@ impl<'a, 'b> Iterator for EntryReadIterator<'a, 'b> {
12361236
}
12371237
}
12381238

1239-
impl<'a, 'b> DatabaseReadAccess<'a, 'b> {
1239+
impl DatabaseReadAccess<'_, '_> {
12401240
pub fn get_entry_by_id(&self, id: i32) -> Result<&Entry, ReadError> {
12411241
match self.db.entries.get(&id) {
12421242
Some(entry) => match self.permissions.can_read(&entry.metadata.path) {
@@ -1277,7 +1277,7 @@ impl<'a, 'b> DatabaseReadAccess<'a, 'b> {
12771277
}
12781278
}
12791279

1280-
impl<'a, 'b> DatabaseWriteAccess<'a, 'b> {
1280+
impl DatabaseWriteAccess<'_, '_> {
12811281
pub fn update_by_path(
12821282
&mut self,
12831283
path: &str,
@@ -1471,7 +1471,7 @@ impl Database {
14711471
}
14721472
}
14731473

1474-
impl<'a, 'b> query::CompilationInput for DatabaseReadAccess<'a, 'b> {
1474+
impl query::CompilationInput for DatabaseReadAccess<'_, '_> {
14751475
fn get_datapoint_type(&self, path: &str) -> Result<DataType, query::CompilationError> {
14761476
match self.get_metadata_by_path(path) {
14771477
Some(metadata) => Ok(metadata.data_type.to_owned()),
@@ -1485,7 +1485,7 @@ pub struct AuthorizedAccess<'a, 'b> {
14851485
permissions: &'b Permissions,
14861486
}
14871487

1488-
impl<'a, 'b> AuthorizedAccess<'a, 'b> {
1488+
impl AuthorizedAccess<'_, '_> {
14891489
#[allow(clippy::too_many_arguments)]
14901490
pub async fn add_entry(
14911491
&self,

0 commit comments

Comments
 (0)