You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In purescript/registry#336 (comment) a package failed to commit and push metadata because the local checkout of the registry repo was behind the upstream by one commit. I don't think this should happen — we should be able to pull to re-sync and then try to push again.
The error in this case arose from the implementation of WriteMetadata:
result <- writeCommitPush (CommitManifestEntry name) \indexPath ->do
ManifestIndex.insertIntoEntryFile indexPath manifest >>= case _ of
Left error ->Except.throw $ "Could not insert manifest for " <> formatted <> " into its entry file in WriteManifest: " <> error
Right _ -> pure $ Just $ "Update manifest for " <> formatted
case result of
Left error ->Except.throw $ "Failed to write and commit manifest: " <> error
Right r ->do
case r of
Git.NoChange->Log.info "Did not commit manifest because it did not change."
Git.Changed->Log.info "Wrote and committed manifest."
Cache.put _registryCache AllManifests updated
...but it applies everywhere we use writeCommitPush, which includes writing metadata, manifests, package sets, and other registry data to the various registry repositories. There's a narrow window to get behind the upstream — you'd have to get behind in the time between the pull but before the push in the implementation linked below — but it's certainly possible:
Nothing-> pure $ Left $ "Failed to write file(s) to " <> path
Just message -> commit commitKey message >>= case _ of
Left error -> pure (Left error)
Right _ -> push repoKey
To drill down even further, the specific place where this error arises is in the call to Git.gitCommit. If we are behind the upstream then we bail out of the commit.
let inRepoErr error = " in local checkout " <> cwd <> ": " <> error
Log.debug $ "Committing to the " <> formatted <> " repo at " <> cwd <> " with message " <> message
-- First we fetch the origin to make sure we're up-to-date.
status <- gitStatus cwd
when (status.branch `Array.notElem` [ "main", "master" ]) do
Log.warn $ "Not on 'main' or 'master' branch in local checkout " <> cwd <> ", there may be unexpected results."
case status.status of
Current-> pure unit
Ahead n ->Log.warn do
"Ahead of origin by " <> show n <> " commits in local checkout of " <> cwd <> ", something may be wrong."
Behind n ->Except.throw do
"Behind of origin by " <> show n <> " commits in local checkout of " <> cwd <> ", committing would cause issues."
It's OK that we bail out, but we shouldn't bail out of the entire pipeline. Instead, we could bail out of the commit, pull again (with --autostash), and then try to commit again. Only on some n number of failures to resync with the upstream would it be reasonable to fully terminate the process.
The text was updated successfully, but these errors were encountered:
Is this really a problem? I don't think we gain anything in allowing multiple jobs to run concurrently, and we should just limit the amount of running jobs to a single one
It feels odd to arbitrarily limit jobs such that if someone else is uploading a package then I cannot publish mine. Isn’t it preferable to allow concurrent package uploads?
Certainly concurrent jobs are possible so long as the GitHub pipelines exist. We will have to rewrite the GitHub module to send requests to the server instead of executing anything in the action itself if we want control. (I know eventually we want to disable the GitHub API altogether.)
If we don’t want any concurrent operations (anything that touches a shared git resource, at least) then that would mean that the build matrix, daily importer, etc cannot run if a package is currently being published and vice versa. Isn’t that problematic?
In purescript/registry#336 (comment) a package failed to commit and push metadata because the local checkout of the
registry
repo was behind the upstream by one commit. I don't think this should happen — we should be able to pull to re-sync and then try to push again.The error in this case arose from the implementation of
WriteMetadata
:registry-dev/app/src/App/Effect/Registry.purs
Lines 250 to 271 in 8177cd3
...but it applies everywhere we use
writeCommitPush
, which includes writing metadata, manifests, package sets, and other registry data to the various registry repositories. There's a narrow window to get behind the upstream — you'd have to get behind in the time between thepull
but before thepush
in the implementation linked below — but it's certainly possible:registry-dev/app/src/App/Effect/Registry.purs
Lines 678 to 693 in 8177cd3
To drill down even further, the specific place where this error arises is in the call to
Git.gitCommit
. If we are behind the upstream then we bail out of the commit.registry-dev/app/src/App/CLI/Git.purs
Lines 181 to 200 in 8177cd3
It's OK that we bail out, but we shouldn't bail out of the entire pipeline. Instead, we could bail out of the commit, pull again (with --autostash), and then try to commit again. Only on some
n
number of failures to resync with the upstream would it be reasonable to fully terminate the process.The text was updated successfully, but these errors were encountered: