cosign
cosign copied to clipboard
verify-dockerfile: does not recognize default parameter substitution
Description
Minimal reproduce:
- Set the
$BUILDPLATFORMenv toarm/v7.
Happy-path test case:
FROM --platform=${BUILDPLATFORM} golang:1.16.3-alpine3.13 AS builder
- Unset the
$BUILDPLATFORMenv.
Failing test case:
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16.3-alpine3.13 AS builder
i.e.:
{
name: "digest-platform",
fileContents: `FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16.3-alpine3.13 AS builder`,
expected: []string{"golang:1.16.3-alpine3.13"},
},
getImageFromLine() function returns --platform= instead of --platform=linux/amd64
P.S: This is a limitation of os.ExpandEnv functions. Go currently does not support this feature. We may need to use a custom framework to make a workaround to fix this.
cc: @developer-guy
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.