From 09573a163ec774eca15bf70e2a688e2b78d40444 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Tue, 4 Nov 2025 10:27:17 -0500 Subject: [PATCH] WIP: Updated multiple readmes and auto build scripts --- README.md | 2 +- airlock_libs/.gitea/workflows/build.yaml | 98 ------------------------ airlock_libs/Cargo.lock | 2 +- airlock_libs/README.md | 5 +- airlock_libs/src/services.rs | 6 +- 5 files changed, 8 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index 626650e..a464e7a 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Python toolkit for secure, auditable, and automated airlock agent and policy man ## 🧑‍💻 Requirements -TBD +[airlock_libs](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/0.1.1) --- diff --git a/airlock_libs/.gitea/workflows/build.yaml b/airlock_libs/.gitea/workflows/build.yaml index e28d228..e69de29 100644 --- a/airlock_libs/.gitea/workflows/build.yaml +++ b/airlock_libs/.gitea/workflows/build.yaml @@ -1,98 +0,0 @@ -name: Build and Release - -on: - push: - branches: - - master - -jobs: - build-linux: - runs-on: debian-bookworm - steps: - - uses: actions/checkout@v5 - with: - repository: 'brotoskyj/AirlockLibs' - token: ${{RUNNER_TOKEN}} - - name: Install Rust + Python + maturin - run: | - apt-get update && apt-get install -y python3 python3-pip curl node - curl https://sh.rustup.rs -sSf | sh -s -- -y - source $HOME/.cargo/env - pip3 install maturin --break-system-packages - - - name: Build Linux Wheel - run: | - source $HOME/.cargo/env - maturin build --release --interpreter python3 - - - name: Upload Linux wheel - uses: actions/upload-artifact@v4 - with: - name: wheel-linux - path: target/wheels/*.whl - - build-windows: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Docker - run: | - sudo apt-get update && sudo apt-get install -y docker.io - - - name: Build Windows Wheel with maturin in cross container - run: | - docker run --rm -v $PWD:/project -w /project ghcr.io/cross-rs/x86_64-pc-windows-gnu \ - bash -c "pip3 install maturin && maturin build --release --target x86_64-pc-windows-gnu" - - - name: Upload Windows wheel - uses: actions/upload-artifact@v4 - with: - name: wheel-windows - path: target/wheels/*win_amd64.whl - - release: - needs: [build-linux, build-windows] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v4 - with: - name: wheel-linux - path: dist/ - - - uses: actions/download-artifact@v4 - with: - name: wheel-windows - path: dist/ - - - name: Get Version - id: version - run: | - version=$(grep '^version' Cargo.toml | head -n1 | cut -d'"' -f2) - echo "version=$version" >> "$GITHUB_OUTPUT" - - - name: Generate changelog from commits - id: changelog - run: | - log=$(git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0)..HEAD) - echo "$log" > changes.md - echo "log<> "$GITHUB_OUTPUT" - echo "$log" >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" - - - name: Create Gitea Release - uses: https://gitea.com/actions/create-release@v1 - with: - tag: v${{ steps.version.outputs.version }} - title: Release v${{ steps.version.outputs.version }} - note: ${{ steps.changelog.outputs.log }} - env: - RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }} - - - name: Upload release assets - uses: https://gitea.com/actions/upload-release-asset@v1 - with: - tag: v${{ steps.version.outputs.version }} - file: dist/*.whl - env: - RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }} diff --git a/airlock_libs/Cargo.lock b/airlock_libs/Cargo.lock index 9429bbe..f5367f6 100644 --- a/airlock_libs/Cargo.lock +++ b/airlock_libs/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "airlock_libs" -version = "0.1.0" +version = "0.1.1" dependencies = [ "chrono", "indicatif", diff --git a/airlock_libs/README.md b/airlock_libs/README.md index 480ae14..1eea549 100644 --- a/airlock_libs/README.md +++ b/airlock_libs/README.md @@ -6,7 +6,8 @@ A Rust implementation of common Airlock API integrations for use in [AirlockTool ## Deployment To install and use this library in a standalone Python script - +### Install Using pip +Follow the instructions [here](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/) ### Install Wheel #### Linux @@ -18,7 +19,7 @@ To install and use this library in a standalone Python script #### Windows ```powershell cd target/wheels - python3 -m pip install airlock_libs--cp313-windows + python3 -m pip install airlock_libs--cp313-win_amd64.whl ``` or diff --git a/airlock_libs/src/services.rs b/airlock_libs/src/services.rs index 33ab85f..aad6a80 100644 --- a/airlock_libs/src/services.rs +++ b/airlock_libs/src/services.rs @@ -144,9 +144,9 @@ async fn history_logging( let parsed: Value = serde_json::from_str(headers_replace.as_str()).unwrap(); let mut header_map = HeaderMap::new(); if let Some(obj) = parsed.as_object() { - for (key, value) in obj { + for (_key, value) in obj { if let Some(v) = value.as_str() { - let val = HeaderValue::from_str(v).unwrap(); + let val = HeaderValue::from_str(v).unwrap(); header_map.insert(HeaderName::from_str("X-APIKey").unwrap(), val); } } @@ -176,7 +176,7 @@ async fn history_logging( .expect("Failed to retrieve response from API"); return first_response; } - Err(res) => { + Err(_res) => { let failed_response: ApiResponse = ApiResponse { error: "Failed".to_string(), response: ExecHistories {