@@ -229,6 +229,14 @@ ENV apikey=bar sunflower=foo
229229ENV git_key=
230230ENV PUBLIC_KEY=
231231ARG public_token
232+ # check=skip=SecretsUsedInArgOrEnv // allow secret in environment
233+ ENV password=bar
234+ # check=skip=SecretsUsedInArgOrEnv // allow secret in arg
235+ ARG password
236+ # check=skip=all // is local to only this instruction
237+ ENV alternate_password=bar
238+ # check=skip=all // is local to only this instruction
239+ ARG alternate_password
232240` )
233241 checkLinterWarnings (t , sb , & lintTestParams {
234242 Dockerfile : dockerfile ,
830838 dockerfile = []byte (`
831839FROM scratch
832840LABEL org.opencontainers.image.authors="[email protected] " 841+ ` )
842+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
843+
844+ dockerfile = []byte (`
845+ FROM scratch
846+ # check=skip=JSONArgsRecommended
847+ CMD mycommand
848+ ` )
849+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
850+
851+ dockerfile = []byte (`
852+ FROM scratch
853+ # check=skip=JSONArgsRecommended
854+ ENTRYPOINT mycommand
855+ ` )
856+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
857+
858+ dockerfile = []byte (`
859+ FROM scratch
860+ # check=skip=MaintainerDeprecated
861+ 833862` )
834863 checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
835864}
@@ -1005,6 +1034,13 @@ WORKDIR /app
10051034
10061035FROM a AS b
10071036WORKDIR subdir/
1037+ ` )
1038+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
1039+
1040+ dockerfile = []byte (`
1041+ FROM scratch
1042+ # check=skip=WorkdirRelativePath
1043+ WORKDIR app/
10081044` )
10091045 checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
10101046}
@@ -1239,6 +1275,15 @@ FROM a AS c
12391275 },
12401276 },
12411277 })
1278+
1279+ dockerfile = []byte (`
1280+ FROM scratch
1281+ # check=skip=LegacyKeyValueFormat
1282+ ENV testkey value
1283+ # check=skip=LegacyKeyValueFormat
1284+ LABEL key value
1285+ ` )
1286+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
12421287}
12431288
12441289func testRedundantTargetPlatform (t * testing.T , sb integration.Sandbox ) {
@@ -1275,6 +1320,12 @@ FROM --platform=${TARGETPLATFORM} scratch
12751320 },
12761321 },
12771322 })
1323+
1324+ dockerfile = []byte (`
1325+ # check=skip=RedundantTargetPlatform
1326+ FROM --platform=$TARGETPLATFORM scratch
1327+ ` )
1328+ checkLinterWarnings (t , sb , & lintTestParams {Dockerfile : dockerfile })
12781329}
12791330
12801331func testInvalidDefaultArgInFrom (t * testing.T , sb integration.Sandbox ) {
0 commit comments