Skip to content

Commit d54cfd9

Browse files
committed
Add hab path
Signed-off-by: sandhi <sagarwal@progress.com>
1 parent 944c7bd commit d54cfd9

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

.github/workflows/ci-main-pull-request.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ on:
196196
required: false
197197
type: string
198198
default: 'stable'
199+
grype-hab-path:
200+
description: "Path to built Habitat package (used if build_package is true, overrides hab_origin/hab_package inputs)"
201+
required: false
202+
type: string
199203
grype-hab-scan-linux:
200204
description: 'Scan Linux (x86_64-linux) Habitat package'
201205
required: false
@@ -974,7 +978,7 @@ jobs:
974978
run-grype-hab-package-scan:
975979
name: 'Grype scan Habitat packages from bldr.habitat.sh'
976980
if: ${{ inputs.perform-grype-hab-scan == true }}
977-
uses: chef/common-github-actions/.github/workflows/grype-hab-package-scan.yml@main
981+
uses: chef/common-github-actions/.github/workflows/grype-hab-package-scan.yml@sandhi/add-hab-path
978982
needs: checkout
979983
secrets: inherit
980984
with:
@@ -984,6 +988,7 @@ jobs:
984988
hab_version: ${{ inputs.grype-hab-version }}
985989
hab_release: ${{ inputs.grype-hab-release }}
986990
hab_channel: ${{ inputs.grype-hab-channel }}
991+
hab_path: ${{ inputs.grype-hab-path }}
987992
scan-linux: ${{ inputs.grype-hab-scan-linux }}
988993
scan-windows: ${{ inputs.grype-hab-scan-windows }}
989994
scan-macos: ${{ inputs.grype-hab-scan-macos }}

.github/workflows/grype-hab-package-scan.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ on:
8888
required: false
8989
type: boolean
9090
default: false
91+
hab_path:
92+
description: "Path to built Habitat package (used if build_package is true, overrides hab_origin/hab_package inputs)"
93+
required: false
94+
type: string
9195

9296
jobs:
9397
habitat-grype-scan-linux:
@@ -139,7 +143,12 @@ jobs:
139143
hab origin key download --auth $HAB_AUTH_TOKEN --secret $HAB_ORIGIN
140144
echo "--- running linux hab build"
141145
export BUILD_ARGS="-X 'main.version=${{ inputs.hab_version }}' -X 'main.build_date_time=$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
142-
hab pkg build .
146+
if [ -z "${{ inputs.hab_path }}" ]; then
147+
hab pkg build .
148+
else
149+
hab pkg build ${{ inputs.hab_path }}
150+
fi
151+
143152
hartifacts=$(ls results/*.hart)
144153
if [ -f "$hartifacts" ]; then
145154
echo "Built package artifact: $hartifacts"
@@ -322,7 +331,12 @@ jobs:
322331
hab origin key download $env:HAB_ORIGIN
323332
hab origin key download --auth $env:HAB_AUTH_TOKEN --secret $env:HAB_ORIGIN
324333
write-output "--- running windows hab build"
325-
hab pkg build .
334+
if ([string]::IsNullOrEmpty("${{ inputs.hab_path }}")) {
335+
hab pkg build .
336+
} else {
337+
hab pkg build ${{ inputs.hab_path }}
338+
}
339+
# hab pkg build .
326340
327341
- name: Extract built package info
328342
if: ${{ inputs.build_package == true }}
@@ -521,7 +535,12 @@ jobs:
521535
elif [ -n "${{ secrets.HAB_AUTH_TOKEN }}" ]; then
522536
export HAB_AUTH_TOKEN="${{ secrets.HAB_AUTH_TOKEN }}"
523537
fi
524-
hab pkg build .
538+
if [ -z "${{ inputs.hab_path }}" ]; then
539+
hab pkg build .
540+
else
541+
hab pkg build ${{ inputs.hab_path }}
542+
fi
543+
# hab pkg build .
525544
526545
- name: Extract built package info
527546
if: ${{ inputs.build_package == true }}

0 commit comments

Comments
 (0)