Skip to content

Commit d45cfe8

Browse files
committed
make rust cargo deny depdency auditing disabled by default in Jenkins CICD
1 parent 4a40578 commit d45cfe8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
working-directory: common/jenkins-agents/rust/docker
109109
run: |
110110
docker build --tag agent-rust-test-ubi8 --file Dockerfile.ubi8 \
111-
--build-arg rustVersion=1.86.0 \
111+
--build-arg rustVersion=1.88.0 \
112112
--build-arg rustToolchain=x86_64-unknown-linux-gnu \
113113
--build-arg cargoNextestVersion=0.9.94 \
114114
--build-arg cargoLlvmCovVersion=0.6.16 \

be-rust-axum/Jenkinsfile.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ odsComponentPipeline(
1010
]
1111
) { context ->
1212
odsComponentFindOpenShiftImageOrElse(context) {
13-
stageCI(context, true) // set `lintDependencies` to false if cargo-deny is not needed
13+
stageCI(context, false) // set `auditDependencies` to true if using cargo-deny
1414
odsComponentStageScanWithSonar(context)
1515
stageBuild(context)
1616
odsComponentStageBuildOpenShiftImage(context)
@@ -27,7 +27,7 @@ def stageBuild(def context) {
2727
}
2828
}
2929

30-
def stageCI(def context, def lintDependencies) {
30+
def stageCI(def context, def auditDependencies) {
3131
stage('Cargo Check') {
3232
sh """
3333
cargo --version
@@ -51,7 +51,7 @@ def stageCI(def context, def lintDependencies) {
5151
cargo clippy --message-format=json &> build/test-results/clippy/report.json
5252
"""
5353
}
54-
if (lintDependencies) {
54+
if (auditDependencies) {
5555
stage('Cargo Deny') {
5656
sh """
5757
mkdir -p build/test-results/deny

be-rust-axum/rust-template/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ This project uses [pre-commit](https://pre-commit.com).
1313
pre-commit install
1414
```
1515

16+
The provided pre-commit hooks are:
17+
- gitleaks (check for secrets)
18+
- cargo-deny (dependency auditing, see/update `deny.toml` config file)
19+
- cargo-fmt (formatter, see/update `rustfmt.toml` config file)
20+
- cargo-clippy (linter)
21+
22+
**NOTE**: the cargo hooks also run in Jenkins CICD, but cargo deny is disabled by default, see Jenkinsfile.
23+
1624
## Adding caching in your CICD
1725

1826
One can improve the build pipeline time by implementing a caching mechanism as shown next:

be-rust-axum/testdata/golden/jenkins-build-stages.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
"stage": "Cargo Clippy",
1616
"status": "SUCCESS"
1717
},
18-
{
19-
"stage": "Cargo Deny",
20-
"status": "SUCCESS"
21-
},
2218
{
2319
"stage": "Cargo Test",
2420
"status": "SUCCESS"

0 commit comments

Comments
 (0)