Skip to content

Commit

Permalink
Undo debug stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
csasarak committed Sep 11, 2024
1 parent 148c96d commit 8e74d75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/Control/Carrier/ContainerRegistryApi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ import Network.HTTP.Conduit qualified as HTTPConduit
import Network.HTTP.Types.Header (ResponseHeaders)
import Path (Abs, Dir, File, Path, filename, mkRelFile, toFilePath, (</>))
import Path.Internal (Path (..))
import Debug.Trace (traceShowM)

-- | A carrier to run Registry API functions in the IO monad
type ContainerRegistryApiC m = SimpleC ContainerRegistryApiF (ReaderC RegistryCtx m)
Expand Down Expand Up @@ -167,16 +166,14 @@ getImageManifest ::
m OciManifestV2
getImageManifest src = context "Getting Image Manifest" $ do
manager <- reqManager
endpoint <- manifestEndpoint src
traceShowM endpoint
resp <-
fromResponse
=<< mkRequest manager (registryCred src) (Just supportedManifestKinds) endpoint
=<< mkRequest manager (registryCred src) (Just supportedManifestKinds)
=<< manifestEndpoint src

let respBody :: ByteStringLazy.ByteString
respBody = responseBody resp

traceShowM respBody
if isManifestIndex (responseHeaders resp)
then do
manifestIndex <- fromEither $ eitherDecode respBody
Expand All @@ -185,7 +182,6 @@ getImageManifest src = context "Getting Image Manifest" $ do
let platformArch :: Text
platformArch = platformArchitecture src

traceShowM manifestIndex
logDebug . pretty $ "Looking for platform architecture: " <> platformArch
manifestDigest <-
fromMaybeText
Expand All @@ -197,10 +193,7 @@ getImageManifest src = context "Getting Image Manifest" $ do
=<< (manifestEndpoint $ src{registryContainerRepositoryReference = manifestDigest})
else do
logDebug "Retrieved single-platform image manifest."

res <- parseOciManifest resp
traceShowM res
pure res
parseOciManifest resp
where
isSupportedManifestKind :: ResponseHeaders -> Bool
isSupportedManifestKind headers =
Expand Down
4 changes: 2 additions & 2 deletions test/Container/RegistryApiSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Control.Effect.Lift (Lift)
import Data.Text (Text)
import Data.Void (Void)
import Test.Effect (it', shouldBe')
import Test.Hspec (Expectation, Spec, describe, it, focus)
import Test.Hspec (Expectation, Spec, describe, it)
import Test.Hspec.Megaparsec (shouldParse)
import Text.Megaparsec (Parsec, parse)
import Text.Megaparsec.Error (ParseErrorBundle)
Expand Down Expand Up @@ -42,7 +42,7 @@ getImageConfig arch img =
<$> (getImageManifest =<< fromEitherShow (decodeStrict arch img))

spec :: Spec
spec = focus $ do
spec = do
registryApiSpec
parseAuthChallengeSpec

Expand Down

0 comments on commit 8e74d75

Please sign in to comment.