diff --git a/app-casa-curator/Main.hs b/app-casa-curator/Main.hs index 2cbed27..2c1ff70 100644 --- a/app-casa-curator/Main.hs +++ b/app-casa-curator/Main.hs @@ -444,7 +444,11 @@ downloadHackagePackage continuousConfig count (i, (hackageCabalId, rpli)) = do threadDelay (1000 * 1000) attempt StatusCodeException r _ - | getResponseStatusCode r == 403 -> logit e + -- FIXME: Ignoring 500s from Hackage because of + -- https://github.com/haskell/hackage-server/issues/1023 + -- Also not sure about 403s. They seem suspicious. 410s seem + -- legit, though. + | getResponseStatusCode r `elem` [403, 410, 500] -> logit e _ -> throwM e) -- | Record that we've populated pantry with a snapshot. diff --git a/app-curator/Main.hs b/app-curator/Main.hs index dc9881b..ac55818 100644 --- a/app-curator/Main.hs +++ b/app-curator/Main.hs @@ -73,7 +73,7 @@ options = addCommand "upload-docs" "Upload documentation to an S3 bucket" uploadDocs' - parseTarget + parseUploadDocsArgs addCommand "upload-github" "Commit and push snapshot definition to Github repository" uploadGithub' @@ -95,6 +95,14 @@ options = <> metavar "TARGET" <> help "Target Stackage snapshot 'lts-MM.NN' or 'nightly-YYYY-MM-DD'" ) + parseUploadDocsArgs = UploadArgs <$> parseTarget <*> + strOption (mconcat + [ long "bucket" + , metavar "BUCKET" + , value "haddock.stackage.org" + , showDefault + , help "Target bucket name. All other AWS params are taken from environment variables." + ]) nightly = maybeReader $ \s -> do s' <- stripPrefix "nightly-" s TargetNightly <$> parseTimeM False defaultTimeLocale "%Y-%m-%d" s' @@ -114,6 +122,8 @@ options = <*> strOption (long "lts-haskell" <> metavar "DIR") <*> strOption (long "stackage-nightly" <> metavar "DIR") +data UploadArgs = UploadArgs Target Text + main :: IO () main = runPantryApp $ do ((), runCmd) <- liftIO options @@ -283,8 +293,8 @@ hackageDistro target = do Map.mapMaybe (snapshotVersion . spLocation) (snapshotPackages snapshot') uploadHackageDistro target packageVersions -uploadDocs' :: Target -> RIO PantryApp () -uploadDocs' target = do +uploadDocs' :: UploadArgs -> RIO PantryApp () +uploadDocs' (UploadArgs target bucket) = do docsDir <- fmap (T.unpack . T.dropSuffix "\n" . decodeUtf8Lenient . BL.toStrict) $ withWorkingDir unpackDir $ proc "stack" (words "path --local-doc-root") readProcessStdout_ logInfo "Uploading docs to S3" @@ -295,7 +305,7 @@ uploadDocs' target = do in "nightly-" <> fromString date TargetLts x y -> "lts-" <> display x <> "." <> display y - uploadDocs docsDir prefix haddockBucket + uploadDocs docsDir prefix bucket uploadGithub' :: Target -> RIO PantryApp () uploadGithub' target = do diff --git a/src/Curator/Constants.hs b/src/Curator/Constants.hs index d0a0204..bfe0e83 100644 --- a/src/Curator/Constants.hs +++ b/src/Curator/Constants.hs @@ -3,7 +3,6 @@ module Curator.Constants , constraintsFilename , snapshotsRepo , constraintsRepo - , haddockBucket ) where import RIO (Text, fromString) @@ -19,6 +18,3 @@ snapshotsRepo = "commercialhaskell/stackage-snapshots" constraintsRepo :: String constraintsRepo = "commercialhaskell/stackage-constraints" - -haddockBucket :: Text -haddockBucket = fromString "haddock.stackage.org" diff --git a/stack.yaml b/stack.yaml index a518d36..98871cc 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,6 @@ resolver: lts-21.25 +nix: + packages: [ pkg-config libz ] # For local dev # - ../pantry