mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 16:57:40 +03:00
fixup whitespace in release/src/Upload.hs (#7414)
Please indulge my OCD. And apologies to whoever was counting on these for their steganographed [Whitespace] program. [Whitespace]: https://esolangs.org/wiki/Whitespace CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
68c3f0de3e
commit
3baa96be14
@ -44,12 +44,12 @@ import Util
|
||||
--
|
||||
-- The artifacts are first uploaded to a staging repository on the Sonatype Open Source Repository Hosting platform
|
||||
-- where the repository contents is verified to conform to the Maven Central standards before being released to
|
||||
-- the public repository.
|
||||
-- the public repository.
|
||||
--
|
||||
-- Digitalasset has been assigned the 'com.daml' and 'com.digitalasset' namespaces (group IDs for Maven repos and artifacts
|
||||
-- need to be uploaded to the staging repository corresponding with their group ID. The staging repository for each group ID
|
||||
-- is handled separately, hence there are several 'duplicated' REST calls.
|
||||
--
|
||||
--
|
||||
-- Further information:
|
||||
--
|
||||
-- Staging requirements: https://central.sonatype.org/pages/requirements.html
|
||||
@ -60,7 +60,7 @@ uploadToMavenCentral MavenUploadConfig{..} releaseDir artifacts = do
|
||||
|
||||
-- Note: TLS verification settings switchable by MavenUpload settings
|
||||
let managerSettings = if getAllowUnsecureTls mucAllowUnsecureTls then noVerifyTlsManagerSettings else tlsManagerSettings
|
||||
|
||||
|
||||
-- Create HTTP Connection manager with 2min response timeout as the OSSRH can be slow...
|
||||
manager <- liftIO $ newManager managerSettings { managerResponseTimeout = responseTimeoutMicro (120 * 1000 * 1000) }
|
||||
|
||||
@ -127,7 +127,7 @@ uploadToMavenCentral MavenUploadConfig{..} releaseDir artifacts = do
|
||||
<*> Async.Concurrently (recovering uploadRetryPolicy [ httpResponseHandler ] (\_ -> liftIO $ httpNoBody sha1CksumRequest manager))
|
||||
<*> Async.Concurrently (recovering uploadRetryPolicy [ httpResponseHandler ] (\_ -> liftIO $ httpNoBody md5CksumRequest manager))
|
||||
|
||||
pure ()
|
||||
pure ()
|
||||
|
||||
$logInfo "Finished uploading artifacts"
|
||||
|
||||
@ -219,7 +219,7 @@ publishStagingRepo baseRequest manager comDamlRepoId comDigitalassetRepoId = do
|
||||
|
||||
--
|
||||
-- Drop" (delete) both staging repositories if one or more fails the checks (and are not in the "closed" state)
|
||||
--
|
||||
--
|
||||
when (comDamlNotClosed || comDigitalassetNotClosed) $ do
|
||||
when comDamlNotClosed $ do logStagingRepositoryActivity baseRequest manager comDamlRepoId
|
||||
when comDigitalassetNotClosed $ do logStagingRepositoryActivity baseRequest manager comDigitalassetRepoId
|
||||
@ -240,10 +240,10 @@ publishStagingRepo baseRequest manager comDamlRepoId comDigitalassetRepoId = do
|
||||
|
||||
$logWarn "Published to Maven Central"
|
||||
|
||||
pure ()
|
||||
pure ()
|
||||
|
||||
-- Print out a log of the repository activity which includes details of which verification rule failed.
|
||||
-- The output is not prettified as it should only be print in rare(ish) error cases.
|
||||
-- The output is not prettified as it should only be print in rare(ish) error cases.
|
||||
logStagingRepositoryActivity :: (MonadCI m) => Request -> Manager -> Text -> m ()
|
||||
logStagingRepositoryActivity baseRequest manager repoId = do
|
||||
|
||||
@ -263,8 +263,8 @@ dropStagingRepositories :: (MonadCI m) => Request -> Manager -> [Text] -> m ()
|
||||
dropStagingRepositories baseRequest manager repoIdList = do
|
||||
--
|
||||
-- Note: This is a "Bulk Drop" request used by the Nexus UI and not a Staging REST API.
|
||||
--
|
||||
let dropReposJson = "{\"data\":{\"description\":\"\",\"stagedRepositoryIds\":" <> tshow repoIdList <> "}}"
|
||||
--
|
||||
let dropReposJson = "{\"data\":{\"description\":\"\",\"stagedRepositoryIds\":" <> tshow repoIdList <> "}}"
|
||||
let dropReposRequest
|
||||
= setRequestMethod "POST"
|
||||
$ setRequestPath "/service/local/staging/bulk/drop"
|
||||
@ -277,10 +277,10 @@ dropStagingRepositories baseRequest manager repoIdList = do
|
||||
return ()
|
||||
|
||||
decodeSigningKey :: (MonadCI m) => String -> m BS.ByteString
|
||||
decodeSigningKey signingKey = case Base64.decode $ C8.pack signingKey of
|
||||
decodeSigningKey signingKey = case Base64.decode $ C8.pack signingKey of
|
||||
Left err -> throwIO $ CannotDecodeSigningKey err
|
||||
Right decodedData -> return decodedData
|
||||
|
||||
|
||||
-- Note: Upload path is NOT documented in the REST API Guide.
|
||||
uploadPath :: MavenCoords -> Text -> Text -> Text
|
||||
uploadPath MavenCoords{..} comDamlStagingRepoId comDigitalassetRepoId = do
|
||||
@ -339,10 +339,10 @@ checkRepoStatusHandler :: (MonadIO m, MonadLogger m) => RetryStatus -> E.Handler
|
||||
checkRepoStatusHandler status = logRetries shouldStatusRetry logStatusRetry status
|
||||
|
||||
shouldRetry :: (MonadIO m) => HttpException -> m Bool
|
||||
shouldRetry e = case e of
|
||||
shouldRetry e = case e of
|
||||
HttpExceptionRequest _ ConnectionTimeout -> return True
|
||||
-- Don't retry POST requests if the response timeouts as the request might of been processed
|
||||
HttpExceptionRequest request ResponseTimeout -> return (method request == "POST")
|
||||
HttpExceptionRequest request ResponseTimeout -> return (method request == "POST")
|
||||
HttpExceptionRequest _ (StatusCodeException rsp _) ->
|
||||
case statusCode (responseStatus rsp) of
|
||||
408 {- requestTimeout -} -> return True
|
||||
@ -383,7 +383,7 @@ handleStatusRequest request manager = do
|
||||
statusResponse <- liftIO $ httpLbs request manager
|
||||
repoStatus <- liftIO $ decodeRepoStatus $ responseBody statusResponse
|
||||
if transitioning repoStatus
|
||||
then
|
||||
then
|
||||
throwIO RepoNotClosed
|
||||
else
|
||||
return $ status repoStatus == "open"
|
||||
@ -483,7 +483,7 @@ data UploadFailure
|
||||
| RepoFailedToClose [Text]
|
||||
|
||||
instance E.Exception UploadFailure
|
||||
instance Show UploadFailure where
|
||||
instance Show UploadFailure where
|
||||
show (ParseJsonException msg) = "Cannot parse JSON data: " <> msg
|
||||
show (CannotDecodeSigningKey msg) = "Cannot Base64 decode signing key: " <> msg
|
||||
show (RepoFailedToClose repoIds) = "The staging repositories " <> show repoIds <> " failed to close"
|
||||
|
Loading…
Reference in New Issue
Block a user