language-docker 9.0.1 → 9.1.0
raw patch · 7 files changed
+50/−15 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Language.Docker.Syntax: CacheOpts :: !TargetPath -> !CacheSharing -> !Maybe Text -> !Maybe Bool -> !Maybe Text -> !Maybe SourcePath -> !Maybe Text -> !Maybe Integer -> !Maybe Integer -> CacheOpts
+ Language.Docker.Syntax: CacheOpts :: !TargetPath -> !Maybe CacheSharing -> !Maybe Text -> !Maybe Bool -> !Maybe Text -> !Maybe SourcePath -> !Maybe Text -> !Maybe Integer -> !Maybe Integer -> CacheOpts
- Language.Docker.Syntax: [$sel:cSharing:CacheOpts] :: CacheOpts -> !CacheSharing
+ Language.Docker.Syntax: [$sel:cSharing:CacheOpts] :: CacheOpts -> !Maybe CacheSharing
Files
- language-docker.cabal +4/−2
- src/Language/Docker/Parser/Run.hs +2/−2
- src/Language/Docker/PrettyPrint.hs +1/−1
- src/Language/Docker/Syntax.hs +2/−2
- test/Language/Docker/ParserSpec.hs +8/−8
- test/fixtures/1.Dockerfile +17/−0
- test/fixtures/2.Dockerfile +16/−0
language-docker.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 575a027197150763590bb1ff4488b00c9864b6c2abfd2208842c73971ad6ac23+-- hash: ead90f9d8a8521aaa2655fc03070f462119ea0218d8ab0aa42c04fc065f55856 name: language-docker-version: 9.0.1+version: 9.1.0 synopsis: Dockerfile parser, pretty-printer and embedded DSL description: All functions for parsing and pretty-printing Dockerfiles are exported through @Language.Docker@. For more fine-grained operations look for specific modules that implement a certain functionality. See the <https://github.com/hadolint/language-docker GitHub project> for the source-code and examples.@@ -26,6 +26,8 @@ build-type: Simple extra-source-files: README.md+ test/fixtures/1.Dockerfile+ test/fixtures/2.Dockerfile source-repository head type: git
src/Language/Docker/Parser/Run.hs view
@@ -130,10 +130,10 @@ Right as -> return $ foldr cacheOpts def as where allowed = Set.fromList ["target", "sharing", "id", "ro", "from", "source", "mode", "uid", "gid"]- required = Set.fromList ["target", "sharing"]+ required = Set.singleton "target" cacheOpts :: RunMountArg -> CacheOpts -> CacheOpts cacheOpts (MountArgTarget path) co = co {cTarget = path}- cacheOpts (MountArgSharing sh) co = co {cSharing = sh}+ cacheOpts (MountArgSharing sh) co = co {cSharing = Just sh} cacheOpts (MountArgId i) co = co {cCacheId = Just i} cacheOpts (MountArgReadOnly ro) co = co {cReadOnly = Just ro} cacheOpts (MountArgFromImage img) co = co {cFromImage = Just img}
src/Language/Docker/PrettyPrint.hs view
@@ -168,7 +168,7 @@ CacheMount CacheOpts {..} -> "type=cache" <> printTarget cTarget- <> printSharing cSharing+ <> maybe mempty printSharing cSharing <> maybe mempty printId cCacheId <> maybe mempty printFromImage cFromImage <> maybe mempty printSource cSource
src/Language/Docker/Syntax.hs view
@@ -222,7 +222,7 @@ data CacheOpts = CacheOpts { cTarget :: !TargetPath,- cSharing :: !CacheSharing,+ cSharing :: !(Maybe CacheSharing), cCacheId :: !(Maybe Text), cReadOnly :: !(Maybe Bool), cFromImage :: !(Maybe Text),@@ -234,7 +234,7 @@ deriving (Show, Eq, Ord) instance Default CacheOpts where- def = CacheOpts "" Shared Nothing Nothing Nothing Nothing Nothing Nothing Nothing+ def = CacheOpts "" Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing newtype TmpOpts = TmpOpts {tTarget :: TargetPath} deriving (Eq, Show, Ord)
test/Language/Docker/ParserSpec.hs view
@@ -479,16 +479,16 @@ file [ Run $ RunArgs (ArgumentsText "echo foo") flags ]- it "--mount=type=cache with target and sharing" $+ it "--mount=type=cache with target" $ let file = Text.unlines- [ "RUN --mount=type=cache,target=/foo,sharing=private echo foo",- "RUN --mount=type=cache,target=/bar,sharing=shared echo foo",- "RUN --mount=type=cache,target=/baz,sharing=locked echo foo"+ [ "RUN --mount=type=cache,target=/foo echo foo",+ "RUN --mount=type=cache,target=/bar echo foo",+ "RUN --mount=type=cache,target=/baz echo foo" ]- flags1 = def {mount = Just $ CacheMount (def {cTarget = "/foo", cSharing = Private})}- flags2 = def {mount = Just $ CacheMount (def {cTarget = "/bar", cSharing = Shared})}- flags3 = def {mount = Just $ CacheMount (def {cTarget = "/baz", cSharing = Locked})}+ flags1 = def {mount = Just $ CacheMount (def {cTarget = "/foo"})}+ flags2 = def {mount = Just $ CacheMount (def {cTarget = "/bar"})}+ flags3 = def {mount = Just $ CacheMount (def {cTarget = "/baz"})} in assertAst file [ Run $ RunArgs (ArgumentsText "echo foo") flags1,@@ -507,7 +507,7 @@ CacheMount ( def { cTarget = "/foo",- cSharing = Private,+ cSharing = Just Private, cCacheId = Just "a", cReadOnly = Just True, cFromImage = Just "ubuntu",
+ test/fixtures/1.Dockerfile view
@@ -0,0 +1,17 @@+FROM foo:7-slim++# An extra space after the env value should be no problem+ENV container=false\+ container2=true ++ENV A="a.sh" D="c"\+ B="installDBBinaries.sh" ++ENV X "Y" Z++ENV DOG=Rex\ The\ Dog\ + CAT=Top\ Cat++ENV DOCKER_TLS_CERTDIR=+ENV foo\ a=afoo' bar 'baz"qu\"z"+ENV BASE_PATH /var/spool/apt-mirror
+ test/fixtures/2.Dockerfile view
@@ -0,0 +1,16 @@+FROM scratch++RUN set -ex; \+ apt-get update; \+ if ! which gpg; then \+ apt-get install -y --no-install-recommends gnupg; \+ fi; \+ if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \+# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr+# so, if we're not running gnupg 1.x, explicitly install dirmngr too+ apt-get install -y --no-install-recommends dirmngr; \+ fi; \+ rm -rf /var/lib/apt/lists/*++ONBUILD ENV RUNNER_CMD_EXEC=${RUNNER_CMD_EXEC:-"java \$JAVA_OPTS -jar /runtime/server.jar \$JAR_OPTS"}+ENV BUNDLE_WITHOUT=${bundle_without:-'development test'}