mirror of
https://github.com/anchore/syft.git
synced 2026-06-17 09:48:24 +02:00
ensure we have a snapshot build for cli tests (#4981)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
parent
cff5a05681
commit
8d48a8b8c2
@ -56,11 +56,14 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// cli tests: native go-make Task. Requires SYFT_BINARY_LOCATION pointing at
|
// cli tests: native go-make Task. Runs SYFT_BINARY_LOCATION at an *absolute*
|
||||||
// an *absolute* path to the snapshot binary. Intentionally does NOT depend
|
// path to the snapshot binary. Builds the snapshot only when the binary is
|
||||||
// on snapshot: in CI we download a pre-built snapshot artifact and re-running
|
// missing rather than depending on the snapshot task unconditionally: in
|
||||||
// goreleaser here would both burn ~10m and clobber the downloaded binary.
|
// validations.yaml CI we download a pre-built snapshot artifact, so the binary
|
||||||
// Locally, the failure message tells you to run `make snapshot` first.
|
// already exists and rebuilding would both burn ~10m and clobber it. When
|
||||||
|
// `make test` runs cold (e.g. the release pipeline) or locally with no
|
||||||
|
// snapshot, we build a single-target snapshot (current OS/arch only) since
|
||||||
|
// that's all the CLI tests need.
|
||||||
Task{
|
Task{
|
||||||
Name: "cli",
|
Name: "cli",
|
||||||
Description: "Run CLI tests",
|
Description: "Run CLI tests",
|
||||||
@ -68,7 +71,8 @@ func main() {
|
|||||||
Run: func() {
|
Run: func() {
|
||||||
bin := snapshotBinPath()
|
bin := snapshotBinPath()
|
||||||
if !file.Exists(bin) {
|
if !file.Exists(bin) {
|
||||||
panic(fmt.Sprintf("snapshot binary not found at %s; run `make snapshot` first", bin))
|
Log("snapshot binary not found at %s; building single-target snapshot", bin)
|
||||||
|
Run("make snapshot:single-target")
|
||||||
}
|
}
|
||||||
Log("testing binary: %s", bin)
|
Log("testing binary: %s", bin)
|
||||||
Run(
|
Run(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user