Skip to content

Commit 370e31c

Browse files
petermetzzondervancalvez
authored andcommitted
trivy scan conditioning
1 parent 1efd3a1 commit 370e31c

File tree

6 files changed

+632
-8
lines changed

6 files changed

+632
-8
lines changed

.cspell.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
"minWordLength": 4,
55
"allowCompoundWords": true,
66
"words": [
7-
"outsh",
87
"adminpw",
98
"Albertirsa",
109
"ALLFORTX",
11-
"Anoncreds",
1210
"anoncreds",
11+
"Anoncreds",
1312
"ANYFORTX",
14-
"APIV",
1513
"Apim",
14+
"APIV",
1615
"approveformyorg",
17-
"Askar",
1816
"askar",
17+
"Askar",
1918
"Authz",
2019
"authzn",
2120
"AWSSM",
21+
"benchmarkjs",
2222
"Besu",
2323
"Bools",
2424
"brioux",
@@ -47,8 +47,8 @@
4747
"data",
4848
"dclm",
4949
"DHTAPI",
50-
"Dids",
5150
"dids",
51+
"Dids",
5252
"DockerOde",
5353
"ealen",
5454
"ecparams",
@@ -80,8 +80,8 @@
8080
"ipaddress",
8181
"ipfs",
8282
"IPFSHTTP",
83-
"IPLD",
8483
"ipld",
84+
"IPLD",
8585
"Iroha",
8686
"Irohad",
8787
"isready",
@@ -127,6 +127,7 @@
127127
"organisation",
128128
"Orgs",
129129
"ossp",
130+
"outsh",
130131
"parameterizable",
131132
"Postgres",
132133
"proto",

.github/workflows/ci.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ jobs:
1515
lint-git-repo-request: '{"cloneUrl": "${{ github.server_url }}/${{ github.repository }}.git", "fetchArgs": ["--update-head-ok", "--no-tags", "--prune", "--progress", "--no-recurse-submodules", "--depth=1", "origin" ,"+${{ github.sha }}:${{ github.ref }}"], "checkoutArgs": [ "${{ github.ref }}"], "targetPhrasePatterns": [], "configDefaultsUrl": "https://inclusivenaming.org/json/dci-lint-config-recommended-v1.json" }'
1616
- name: Get the output response
1717
run: echo "${{ steps.lint-git-repo.outputs.lint-git-repo-response }}"
18-
18+
19+
check_trivy_condition:
20+
name: Check Trivy Condition
21+
runs-on: ubuntu-20.04
22+
outputs:
23+
run_trivy_scan: ${{ steps.set_condition_trivy_scan.outputs.run_trivy_scan }}
24+
steps:
25+
- name: Set Trivy Condition
26+
id: set_condition_trivy_scan
27+
run: echo "::set-output name=run_trivy_scan::false" # Set your condition for cactus-example-carbon-accounting here
1928
compute_changed_packages:
2029
outputs:
2130
cmd-api-server-changed: ${{ steps.changes.outputs.cmd-api-server-changed }}
@@ -386,6 +395,38 @@ jobs:
386395
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
387396
388397
- run: ./tools/ci.sh
398+
399+
- name: Ensure .tmp Directory Exists
400+
run: mkdir -p .tmp/benchmark-results/cmd-api-server/
401+
402+
# Download previous benchmark result from cache (if exists)
403+
- name: Download previous benchmark data
404+
uses: actions/cache@v3.3.1
405+
with:
406+
path: .tmp/benchmark-results/cmd-api-server/
407+
key: ${{ runner.os }}-benchmark
408+
409+
- name: Run Benchmarks
410+
working-directory: ./packages/cactus-cmd-api-server/
411+
run: yarn run benchmark
412+
413+
- name: Store benchmark result
414+
uses: benchmark-action/github-action-benchmark@v1.19.2
415+
with:
416+
tool: 'benchmarkjs'
417+
output-file-path: .tmp/benchmark-results/cmd-api-server/run-cmd-api-server-benchmark.ts.log
418+
github-token: ${{ secrets.GITHUB_TOKEN }}
419+
420+
# Only push the benchmark results to gh-pages website if we are running on the main branch
421+
# We do not want to clutter the benchmark results with intermediate results from PRs that could be drafts
422+
auto-push: ${{ github.ref == 'refs/heads/main' }}
423+
424+
# Show alert with commit comment on detecting possible performance regression
425+
alert-threshold: '5%'
426+
comment-on-alert: true
427+
fail-on-alert: true
428+
alert-comment-cc-users: '@petermetz'
429+
389430
cactus-cmd-socketio-server:
390431
continue-on-error: false
391432
env:
@@ -2021,6 +2062,10 @@ jobs:
20212062
- run: ./tools/ci.sh
20222063
ghcr-besu-all-in-one:
20232064
runs-on: ubuntu-20.04
2065+
needs:
2066+
- compute_changed_packages
2067+
- check_trivy_condition
2068+
if: needs.compute_changed_packages.outputs.cmd-api-server-changed == 'true' || needs.check_trivy_condition.outputs.run_trivy_scan == 'true'
20242069
steps:
20252070
- uses: actions/checkout@v3.5.2
20262071
- name: ghcr.io/hyperledger/cactus-besu-all-in-one

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"@lerna-lite/version": "3.1.0",
113113
"@openapitools/openapi-generator-cli": "2.7.0",
114114
"@types/adm-zip": "0.5.0",
115+
"@types/benchmark": "2.1.5",
115116
"@types/fs-extra": "9.0.13",
116117
"@types/jest": "29.5.3",
117118
"@types/node": "16.18.41",
@@ -123,6 +124,7 @@
123124
"@typescript-eslint/eslint-plugin": "6.4.0",
124125
"@typescript-eslint/parser": "6.4.0",
125126
"adm-zip": "0.5.10",
127+
"benchmark": "2.1.4",
126128
"buffer": "6.0.3",
127129
"cpy-cli": "4.2.0",
128130
"cross-env": "7.0.3",

packages/cactus-cmd-api-server/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"dist/*"
4444
],
4545
"scripts": {
46+
"benchmark": "tsx ./src/test/typescript/benchmark/run-cmd-api-server-benchmark.ts .tmp/benchmark-results/cmd-api-server/run-cmd-api-server-benchmark.ts.log",
4647
"codegen": "run-p 'codegen:*'",
4748
"codegen:openapi": "npm run generate-sdk",
4849
"codegen:proto": "run-s proto:openapi proto:protoc-gen-ts",
@@ -97,6 +98,7 @@
9798
"@hyperledger/cactus-plugin-keychain-vault": "2.0.0-alpha.2",
9899
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
99100
"@openapitools/openapi-generator-cli": "2.7.0",
101+
"@types/benchmark": "2.1.5",
100102
"@types/compression": "1.7.4",
101103
"@types/convict": "6.1.1",
102104
"@types/cors": "2.8.12",
@@ -114,11 +116,13 @@
114116
"@types/semver": "7.3.8",
115117
"@types/uuid": "8.3.4",
116118
"@types/xml2js": "0.4.9",
119+
"benchmark": "2.1.4",
117120
"google-protobuf": "3.18.0-rc.2",
118121
"grpc-tools": "1.12.4",
119122
"grpc_tools_node_protoc_ts": "5.3.3",
120123
"http-status-codes": "2.1.4",
121-
"protobufjs": "7.2.5"
124+
"protobufjs": "7.2.5",
125+
"tsx": "4.7.0"
122126
},
123127
"engines": {
124128
"node": ">=18",

0 commit comments

Comments
 (0)