Skip to content
Open
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
31 changes: 27 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
- run: rustup default stable-x86_64-pc-windows-msvc
- run: choco install -y mingw --version=13.2.0
- run: choco install -y nsis
# Install quality tools
- run: cargo install cargo-audit
# Run checks
- run: cargo check
- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo audit
- run:
name: Lint PowerShell installer scripts (PSScriptAnalyzer)
shell: powershell.exe
Expand Down Expand Up @@ -110,8 +114,12 @@ jobs:
# Install quality tools
- run: |
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH;
Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" install cargo-audit'
# Run checks
- run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" check'
- run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" fmt -- --check'
- run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" clippy -- -D warnings'
- run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" audit'
- run:
name: Lint PowerShell installer scripts (PSScriptAnalyzer)
shell: powershell.exe
Expand Down Expand Up @@ -199,8 +207,13 @@ jobs:
- run: sudo apt-get -y install curl musl-tools
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- run: . "$HOME/.cargo/env"; rustup target add x86_64-unknown-linux-musl
# Install quality tools
- run: cargo install cargo-audit
# Run checks
- run: cargo check
- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo audit
- run: . "$HOME/.cargo/env"; cargo build --target=x86_64-unknown-linux-musl --release
- run: . "$HOME/.cargo/env"; cargo test --release
- run: strip ./target/x86_64-unknown-linux-musl/release/openaev-agent
Expand Down Expand Up @@ -259,8 +272,13 @@ jobs:
- run: sudo apt-get -y install curl musl-tools
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- run: . "$HOME/.cargo/env"; rustup target add aarch64-unknown-linux-musl
# Install quality tools
- run: cargo install cargo-audit
# Run checks
- run: cargo check
- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo audit
- run: . "$HOME/.cargo/env"; cargo build --target=aarch64-unknown-linux-musl --release
- run: . "$HOME/.cargo/env"; cargo test --release
- run: strip ./target/aarch64-unknown-linux-musl/release/openaev-agent
Expand Down Expand Up @@ -317,8 +335,13 @@ jobs:
- cargo-{{ arch }}-{{ checksum "Cargo.toml" }}
- cargo-{{ arch }}
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y
# Install quality tools
- run: cargo install cargo-audit
# Run checks
- run: cargo check
- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo audit
- run: . "$HOME/.cargo/env"; cargo build --release
- run: . "$HOME/.cargo/env"; cargo test --release
- run: strip ./target/release/openaev-agent
Expand Down Expand Up @@ -374,12 +397,12 @@ jobs:
- run: rustup toolchain install stable-x86_64-apple-darwin
- run: rustup default stable-x86_64-apple-darwin
# Install quality tools
- run: |
rustup component add clippy
rustup component add rustfmt
cargo install cargo-audit
- run: cargo install cargo-audit
# Run checks
- run: cargo check
- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo audit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question : why cargo audit only here ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I aligned every compile step

- run: . "$HOME/.cargo/env"; cargo build --release
- run: . "$HOME/.cargo/env"; cargo test --release
- run: strip ./target/release/openaev-agent
Expand Down
4 changes: 2 additions & 2 deletions src/api/manage_jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Client {
}
}
Err(err) => {
error!("Error API list_jobs {}", err.to_string());
error!("Error API list_jobs {}", err);
Err(Error::Internal(err.to_string()))
}
}
Expand All @@ -62,7 +62,7 @@ impl Client {
}
}
Err(err) => {
error!("Error API clean_job {}", err.to_string());
error!("Error API clean_job {}", err);
Err(Error::Internal(err.to_string()))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/register_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Client {
}
}
Err(err) => {
error!("Error API register_agent {}", err.to_string());
error!("Error API register_agent {}", err);
Err(Error::Internal(err.to_string()))
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/process/agent_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub fn listen(
execution_details.is_elevated,
execution_details.executed_by_user.clone(),
);
if jobs.is_ok() {
if let Ok(jobs) = jobs {
match jobs {
Ok(jobs) => {
jobs.iter().for_each(|j| {
info!("Start handling inject: {:?}", j.asset_agent_inject);
// 01. Remove the execution job
Expand All @@ -43,8 +43,9 @@ pub fn listen(
info!("Done handling inject: {:?}", j.asset_agent_inject);
});
}
} else {
error!("Fail getting jobs {}", jobs.unwrap_err())
Err(err) => {
error!("Fail getting jobs {}", err)
}
}
// Wait for the next ping (30 secs)
sleep(Duration::from_secs(30));
Expand Down
4 changes: 2 additions & 2 deletions src/process/keep_alive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub fn ping(
installation_mode.clone(),
service_name.clone(),
);
if register.is_err() {
error!("Fail registering the agent {}", register.unwrap_err())
if let Err(err) = register {
error!("Fail registering the agent {}", err)
}
// Wait for the next ping (2 minutes)
sleep(Duration::from_secs(120));
Expand Down