@@ -242,6 +242,14 @@ ENV apikey=bar sunflower=foo
242242ENV git_key=
243243ENV PUBLIC_KEY=
244244ARG public_token
245+ # check=skip=SecretsUsedInArgOrEnv // allow secret in environment
246+ ENV password=bar
247+ # check=skip=SecretsUsedInArgOrEnv // allow secret in arg
248+ ARG password
249+ # check=skip=all // is local to only this instruction
250+ ENV alternate_password=bar
251+ # check=skip=all // is local to only this instruction
252+ ARG alternate_password
245253` )
246254 checkLinterWarnings (t , sb , & lintTestParams {
247255 Dockerfile : dockerfile ,
843851 dockerfile = []byte (`
844852FROM scratch
845853LABEL org.opencontainers.image.authors="[email protected] " 854+ ` )
855+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
856+
857+ dockerfile = []byte (`
858+ FROM scratch
859+ # check=skip=JSONArgsRecommended
860+ CMD mycommand
861+ ` )
862+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
863+
864+ dockerfile = []byte (`
865+ FROM scratch
866+ # check=skip=JSONArgsRecommended
867+ ENTRYPOINT mycommand
868+ ` )
869+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
870+
871+ dockerfile = []byte (`
872+ FROM scratch
873+ # check=skip=MaintainerDeprecated
874+ 846875` )
847876 checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
848877}
@@ -1018,6 +1047,13 @@ WORKDIR /app
10181047
10191048FROM a AS b
10201049WORKDIR subdir/
1050+ ` )
1051+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
1052+
1053+ dockerfile = []byte (`
1054+ FROM scratch
1055+ # check=skip=WorkdirRelativePath
1056+ WORKDIR app/
10211057` )
10221058 checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
10231059}
@@ -1252,6 +1288,15 @@ FROM a AS c
12521288 },
12531289 },
12541290 })
1291+
1292+ dockerfile = []byte (`
1293+ FROM scratch
1294+ # check=skip=LegacyKeyValueFormat
1295+ ENV testkey value
1296+ # check=skip=LegacyKeyValueFormat
1297+ LABEL key value
1298+ ` )
1299+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
12551300}
12561301
12571302func testRedundantTargetPlatform (t * testing.T , sb integration.Sandbox ) {
@@ -1288,6 +1333,12 @@ FROM --platform=${TARGETPLATFORM} scratch
12881333 },
12891334 },
12901335 })
1336+
1337+ dockerfile = []byte (`
1338+ # check=skip=RedundantTargetPlatform
1339+ FROM --platform=$TARGETPLATFORM scratch
1340+ ` )
1341+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
12911342}
12921343
12931344func testInvalidDefaultArgInFrom (t * testing.T , sb integration.Sandbox ) {
0 commit comments