Skip to content
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

CI for Confidential Data Hub #395

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/cdh_basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: confidential-data-hub basic build and unit tests

on:
push:
branches:
- "main"
paths:
- 'confidential-data-hub/**'
- '.github/workflows/cdh_basic.yml'
- 'Cargo.toml'
pull_request:
paths:
- 'confidential-data-hub/**'
- '.github/workflows/cdh_basic.yml'
- 'Cargo.toml'
create:
workflow_dispatch:

jobs:
basic_ci:
name: Check
defaults:
run:
working-directory: ./confidential-data-hub
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Rust toolchain (${{ matrix.rust }})
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- name: Install protoc
run: |
sudo apt-get update && sudo apt-get install -y protobuf-compiler

- name: Build and install
run: |
make && make install

- name: Musl build
run: |
make LIBC=musl

- name: s390x build
run:
make ARCH=s390x

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --features kbs,aliyun,sev,bin -p kms -p confidential-data-hub -p secret -p image

- name: Run cargo fmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -p kms -p confidential-data-hub -p secret -p image -- --check

- name: Run rust lint check
uses: actions-rs/cargo@v1
with:
command: clippy
# We are getting error in generated code due to derive_partial_eq_without_eq check, so ignore it for now
args: -p kms -p confidential-data-hub -p secret -p image -- -D warnings -A clippy::derive-partial-eq-without-eq
4 changes: 2 additions & 2 deletions confidential-data-hub/hub/src/auth/kbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
//!
//! For the first implementation, it is assumed that all the resource
//! ids are from the kernel commandline in the following format:
//! ```
//! ```shell
//! cdh.kbs_resources=<resource id 1>::<target path 1>,<resource id 2>::<target path 2>...
//! ```
//!
//! for example
//! ```
//! ```shell
//! cdh.kbs_resources=kbs:///default/key/1::/run/temp1,kbs:///default/key/2::/run/temp2
//! ```
//!
Expand Down
9 changes: 5 additions & 4 deletions confidential-data-hub/kms/src/plugins/aliyun/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ impl Decrypter for AliyunKmsClient {
}

impl AliyunKmsClient {
const API_VERSION: &str = "dkms-gcs-0.2";
const SIGNATURE_METHOD: &str = "RSA_PKCS1_SHA_256";
const CONTENT_TYPE: &str = "application/x-protobuf";
const API_VERSION: &'static str = "dkms-gcs-0.2";
const SIGNATURE_METHOD: &'static str = "RSA_PKCS1_SHA_256";
const CONTENT_TYPE: &'static str = "application/x-protobuf";

fn build_headers(&self, api_name: &str, body: &[u8]) -> anyhow::Result<HeaderMap> {
let mut headers = HeaderMap::new();
Expand Down Expand Up @@ -317,9 +317,10 @@ mod tests {

use crate::{plugins::aliyun::client::AliyunKmsClient, Decrypter, Encrypter};

#[ignore]
#[rstest]
#[ignore]
#[case(b"this is a test plaintext")]
#[ignore]
#[case(b"this is a another test plaintext")]
#[tokio::test]
async fn key_lifetime(#[case] plaintext: &[u8]) {
Expand Down
Loading