Skip to content

Commit fe82a5d

Browse files
authored
Merge branch 'main' into 185-test-workflows-for-lhm_actions
2 parents 5abdfeb + 6db6885 commit fe82a5d

6 files changed

Lines changed: 85 additions & 11 deletions

File tree

action-templates/actions/action-build-docs/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ inputs:
1919
description: "Output directory that will be uploaded to GitHub Pages"
2020
required: false
2121
default: ".vitepress/dist"
22+
npm-ci-parameter:
23+
description: "disallow external scripts during npm ci https://about.gitlab.com/blog/pipeline-security-lessons-from-march-supply-chain-incidents/#use-case-2-detect-dependency-tampering-and-lockfile-manipulation"
24+
required: false
25+
default: "--ignore-scripts"
2226

2327
runs:
2428
using: "composite"
@@ -41,8 +45,9 @@ runs:
4145
env:
4246
DOCS_PATH: ${{ inputs.docs-path }}
4347
BUILD_CMD: ${{ inputs.build-cmd }}
48+
NPM_CI_PARAMETER: ${{ inputs.npm-ci-parameter }}
4449
run: |
45-
npm --prefix "$DOCS_PATH" ci
50+
npm --prefix "$DOCS_PATH" ci $NPM_CI_PARAMETER
4651
npm --prefix "$DOCS_PATH" run lint
4752
npm --prefix "$DOCS_PATH" run "$BUILD_CMD"
4853
- name: Upload artifact

action-templates/actions/action-filter/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ outputs:
2929
python:
3030
description: "Name of the python artifact upload"
3131
value: ${{ steps.filter.outputs.python }}
32+
changes:
33+
description: "JSON array of filter names that have matched changes"
34+
value: ${{ steps.filter.outputs.changes }}
3235

3336
runs:
3437
using: "composite"

action-templates/actions/action-maven-build/action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ outputs:
1414
artifact-name:
1515
description: "Name of the artifact upload"
1616
value: ${{steps.artifact-name.outputs.artifact-name}}
17+
cyclone-artifact-id:
18+
description: "ID of the sbom artifact"
19+
value: ${{steps.upload-sbom-artifact.outputs.artifact-id}}
20+
cyclone-path:
21+
description: "path of the sbom"
22+
value: ${{steps.artifact-name.outputs.cyclone-path}}
1723

1824
runs:
1925
using: "composite"
@@ -36,7 +42,11 @@ runs:
3642
shell: bash
3743
- id: artifact-name
3844
name: Set output variable $GITHUB_OUTPUT
39-
run: echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT"
45+
env:
46+
APP_PATH: ${{inputs.app-path}}
47+
run: |
48+
echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT"
49+
echo "cyclone-path=$APP_PATH/target/classes/META-INF/sbom/application.cdx.json" >> "$GITHUB_OUTPUT"
4050
shell: bash
4151
- id: upload-artifact
4252
name: Upload artifact
@@ -45,3 +55,11 @@ runs:
4555
name: ${{steps.artifact-name.outputs.artifact-name}}
4656
path: "**/target"
4757
retention-days: 5
58+
- id: upload-sbom-artifact
59+
name: upload-sbom-artifact
60+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
61+
with:
62+
name: ${{inputs.app-path}}
63+
path: "${{inputs.app-path}}/target/classes/META-INF/sbom/application.cdx.json"
64+
retention-days: 5
65+
archive: false

action-templates/actions/action-npm-build/action.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ inputs:
1717
description: "Controls the execution of the 'npm run test' script"
1818
required: false
1919
default: "true"
20+
npm-ci-parameter:
21+
description: "disallow external scripts during npm ci https://about.gitlab.com/blog/pipeline-security-lessons-from-march-supply-chain-incidents/#use-case-2-detect-dependency-tampering-and-lockfile-manipulation"
22+
required: false
23+
default: "--ignore-scripts=true"
2024

2125
outputs:
2226
artifact-name:
2327
description: "Name of the artifact upload"
2428
value: ${{steps.artifact-name.outputs.artifact-name}}
25-
29+
cyclone-artifact-id:
30+
description: "ID of the sbom artifact"
31+
value: ${{steps.upload-sbom-artifact.outputs.artifact-id}}
32+
cyclone-path:
33+
value: ${{steps.artifact-name.outputs.cyclone-path}}
34+
description: "path of the sbom"
2635
runs:
2736
using: "composite"
2837
steps:
@@ -35,7 +44,8 @@ runs:
3544
- name: Install dependencies
3645
env:
3746
APP_PATH: ${{inputs.app-path}}
38-
run: npm --prefix ./$APP_PATH ci
47+
NPM_CI_PARAMETER: ${{ inputs.npm-ci-parameter }}
48+
run: npm --prefix ./$APP_PATH ci $NPM_CI_PARAMETER
3949
shell: bash
4050
- name: Run lint
4151
env:
@@ -56,11 +66,22 @@ runs:
5666
shell: bash
5767
- id: artifact-name
5868
name: Sets output variable $GITHUB_OUTPUT
59-
run: echo "artifact-name=${{hashFiles(format('./{0}/package.json', inputs.app-path))}}" >> "$GITHUB_OUTPUT"
69+
env:
70+
APP_PATH: ${{inputs.app-path}}
71+
run: |
72+
echo "artifact-name=${{hashFiles(format('./{0}/package.json', inputs.app-path))}}" >> "$GITHUB_OUTPUT"
73+
echo "cyclone-path=$APP_PATH/dist/application.cdx.json" >> "$GITHUB_OUTPUT"
6074
shell: bash
6175
- name: Upload artifact
6276
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6377
with:
6478
name: ${{steps.artifact-name.outputs.artifact-name}}
6579
path: "**/dist"
6680
retention-days: 5
81+
- id: upload-sbom-artifact
82+
name: upload-sbom-artifact
83+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
84+
with:
85+
path: "${{inputs.app-path}}/dist/application.cdx.json"
86+
retention-days: 5
87+
archive: false

action-templates/actions/action-trivy/action.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,23 @@ inputs:
77
required: false
88
default: ".trivyignore"
99
timeout:
10-
description: "timeout for trivy scan"
10+
description: "Timeout for Trivy scan"
1111
required: false
1212
default: 15m0s
13+
path:
14+
description: "Path to scan with Trivy. For scan-type=sbom, this must point to a specific SBOM file (e.g. sbom.cdx.json), not a directory."
15+
required: false
16+
default: "."
17+
scan-type:
18+
description: "scan type, e.g. fs or sbom"
19+
required: false
20+
default: "fs"
1321

1422
runs:
1523
using: "composite"
1624
steps:
1725
- name: Checkout repository
26+
if: inputs.scan-type == 'fs'
1827
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
1928
with:
2029
fetch-depth: 0 # Required for vitepress lastUpdated
@@ -24,8 +33,8 @@ runs:
2433
env:
2534
TRIVY_INCLUDE_DEV_DEPS: "true"
2635
with:
27-
scan-type: "fs"
28-
scan-ref: "."
36+
scan-type: "${{ inputs.scan-type }}"
37+
scan-ref: "${{ inputs.path }}"
2938
format: "json"
3039
exit-code: "1"
3140
timeout: "${{ inputs.timeout }}"

docs/actions.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ Workflows using that action need the following permissions:
8585
# VitePress output path that will be uploaded as artifact
8686
# Default: .vitepress/dist
8787
dist-path: ".vitepress/dist"
88-
```
88+
# disallow external scripts during npm ci https://about.gitlab.com/blog/pipeline-security-lessons-from-march-supply-chain-incidents/#use-case-2-detect-dependency-tampering-and-lockfile-manipulation
89+
# Default: "--ignore-scripts"
90+
npm-ci-parameter: "--ignore-scripts"
8991
9092
### action-build-image
9193
@@ -223,9 +225,10 @@ Executes the following steps:
223225

224226
Output parameters:
225227

226-
- For each filter, it sets output variable named by the filter to the text:
228+
- For each filter (Java, javascript-typescript-vue, python), it sets output variable named by the filter to the text:
227229
- 'true' - if any of changed files matches any of filter rules
228230
- 'false' - if none of changed files matches any of filter rules
231+
- 'changes' - JSON array with names of all filters matching any of the changed files.
229232

230233
Workflows using that action need the following permissions:
231234

@@ -425,6 +428,8 @@ Executes the following steps:
425428
Output parameters:
426429

427430
1. `artifact-name`: Name of the uploaded artifact
431+
2. `cyclone-artifact-id`: ID of the sbom artifact
432+
3. `cyclone-path`: path of the sbom
428433

429434
Workflows using that action need the following permissions:
430435

@@ -530,6 +535,8 @@ Executes the following steps:
530535
Output parameters:
531536

532537
1. `artifact-name`: Name of the uploaded artifact
538+
2. `cyclone-artifact-id`: ID of the sbom artifact
539+
3. `cyclone-path`: path of the sbom
533540

534541
Workflows using that action need the following permissions:
535542

@@ -555,7 +562,9 @@ Workflows using that action need the following permissions:
555562
# Controls the execution of the 'npm run test' script
556563
# Default: true
557564
run-test: "true"
558-
```
565+
# disallow external scripts during npm ci https://about.gitlab.com/blog/pipeline-security-lessons-from-march-supply-chain-incidents/#use-case-2-detect-dependency-tampering-and-lockfile-manipulation
566+
# Default: "--ignore-scripts=true"
567+
npm-ci-parameter: "--ignore-scripts=true"
559568
560569
### action-npm-release
561570
@@ -663,4 +672,13 @@ Workflows using that action need the following permissions:
663672
# Relative Path to the trivyignore files
664673
# Default: ".trivyignore"
665674
trivyignore-files: ".trivyignore"
675+
# Timeout for Trivy scan
676+
# Default: 15m0s
677+
timeout: "15m0s"
678+
# scan type, e.g. fs or sbom
679+
# default: fs
680+
scan-type: fs
681+
# Path to scan with Trivy
682+
# Default: .
683+
path: "."
666684
```

0 commit comments

Comments
 (0)