Skip to content

Commit

Permalink
Merge pull request #39 from chreekat/b/handover-patches
Browse files Browse the repository at this point in the history
HF handover patches
  • Loading branch information
juhp authored Jan 22, 2024
2 parents b1528dc + 5146f84 commit dc6e10c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 5 additions & 1 deletion app-casa-curator/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 14 additions & 4 deletions app-curator/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/Curator/Constants.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Curator.Constants
, constraintsFilename
, snapshotsRepo
, constraintsRepo
, haddockBucket
) where

import RIO (Text, fromString)
Expand All @@ -19,6 +18,3 @@ snapshotsRepo = "commercialhaskell/stackage-snapshots"

constraintsRepo :: String
constraintsRepo = "commercialhaskell/stackage-constraints"

haddockBucket :: Text
haddockBucket = fromString "haddock.stackage.org"
2 changes: 2 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resolver: lts-21.25
nix:
packages: [ pkg-config libz ]

# For local dev
# - ../pantry
Expand Down

0 comments on commit dc6e10c

Please sign in to comment.