Skip to content

Check candidate uploads against main index#1469

Merged
gbaz merged 1 commit intohaskell:masterfrom
TuongNM:check-candidate-upload
Mar 21, 2026
Merged

Check candidate uploads against main index#1469
gbaz merged 1 commit intohaskell:masterfrom
TuongNM:check-candidate-upload

Conversation

@TuongNM
Copy link
Copy Markdown
Contributor

@TuongNM TuongNM commented Mar 1, 2026

Reuse logic of checkPublish to prevent uploading a candidate version if that version is already published or would be a case-variant of a published version.

Fixes #907
Fixes #768
Fixes #920

These issues talk about this matter as well but they also include other things so I'm not sure if they can be closed by this:
#558
#69

Reuse logic of checkPublish to prevent uploading a candidate version if that
version is already published or would be a case-variant of a published version.
@gbaz gbaz merged commit 6ce7c5d into haskell:master Mar 21, 2026
12 checks passed
@gbaz
Copy link
Copy Markdown
Contributor

gbaz commented Mar 21, 2026

Thank you!

@TuongNM TuongNM deleted the check-candidate-upload branch March 21, 2026 22:08
DigitalBrains1 added a commit to clash-lang/clash-compiler that referenced this pull request Apr 12, 2026
Since haskell/hackage-server#1469
(Check candidate uploads against main index), Hackage no longer allows
candidates for published versions.

But we use the `.ci/publish_sdist.sh` script from our stable branches to
publish a candidate before we do the final release, so we do want it to
run for nightlies on our stable branch. But we need to differentiate between
runs that do not contain a new version and runs that do contain a new
version.

So we do this check in the CI job, and exit with a special exit code to
flag when we did not upload a candidate. This means normal nightlies
will have an exclamation mark in an orange circle next to the
`hackage-release-candidate`, indicating a failure that does not cause
the pipeline as a whole to fail.

When the "special" nightly before a release is run, the developer
inspecting the result should verify a candidate was published (check
mark in green circle). In the usual case, where only one candidate will
be uploaded before release, they will also necessarily notice that the
candidate is simply not on Hackage if they forget to check the CI job's
result.

Because we don't have control over the exit codes of any binaries we
invoke, a trap handler is added in `.ci/functions.sh` that makes sure no
other exits will have the exit code we reserve for allowed-to-fail.
Currently, GitLab runners will not actually propagate the exit code of a
failing step in the script, but this might very well change in an
update. So we also proof our `.ci/setup.sh` script against such exits so
they don't trigger unwantedly in the `hackage-release-candidate` job.
DigitalBrains1 added a commit to clash-lang/clash-compiler that referenced this pull request Apr 12, 2026
Since haskell/hackage-server#1469
(Check candidate uploads against main index), Hackage no longer allows
candidates for published versions.

But we use the `.ci/publish_sdist.sh` script from our stable branches to
publish a candidate before we do the final release, so we do want it to
run for nightlies on our stable branch. But we need to differentiate between
runs that do not contain a new version and runs that do contain a new
version.

So we do this check in the CI job, and exit with a special exit code to
flag when we did not upload a candidate. This means normal nightlies
will have an exclamation mark in an orange circle next to the
`hackage-release-candidate`, indicating a failure that does not cause
the pipeline as a whole to fail.

When the "special" nightly before a release is run, the developer
inspecting the result should verify a candidate was published (check
mark in green circle). In the usual case, where only one candidate will
be uploaded before release, they will also necessarily notice that the
candidate is simply not on Hackage if they forget to check the CI job's
result.

Because we don't have control over the exit codes of any binaries we
invoke, a trap handler is added in `.ci/functions.sh` that makes sure no
other exits will have the exit code we reserve for allowed-to-fail.
Currently, GitLab runners will not actually propagate the exit code of a
failing step in the script, but this might very well change in an
update. So we also proof our `.ci/setup.sh` script against such exits so
they don't trigger unwantedly in the `hackage-release-candidate` job.
DigitalBrains1 added a commit to clash-lang/clash-compiler that referenced this pull request Apr 12, 2026
Since haskell/hackage-server#1469
(Check candidate uploads against main index), Hackage no longer allows
candidates for published versions.

But we use the `.ci/publish_sdist.sh` script from our stable branches to
publish a candidate before we do the final release, so we do want it to
run for nightlies on our stable branch. But we need to differentiate between
runs that do not contain a new version and runs that do contain a new
version.

So we do this check in the CI job, and exit with a special exit code to
flag when we did not upload a candidate. This means normal nightlies
will have an exclamation mark in an orange circle next to the
`hackage-release-candidate`, indicating a failure that does not cause
the pipeline as a whole to fail.

When the "special" nightly before a release is run, the developer
inspecting the result should verify a candidate was published (check
mark in green circle). In the usual case, where only one candidate will
be uploaded before release, they will also necessarily notice that the
candidate is simply not on Hackage if they forget to check the CI job's
result.

Because we don't have control over the exit codes of any binaries we
invoke, a trap handler is added in `.ci/functions.sh` that makes sure no
other exits will have the exit code we reserve for allowed-to-fail.
Currently, GitLab runners will not actually propagate the exit code of a
failing step in the script, but this might very well change in an
update. So we also proof our `.ci/setup.sh` script against such exits so
they don't trigger unwantedly in the `hackage-release-candidate` job.
mergify bot pushed a commit to clash-lang/clash-compiler that referenced this pull request Apr 12, 2026
Since haskell/hackage-server#1469
(Check candidate uploads against main index), Hackage no longer allows
candidates for published versions.

But we use the `.ci/publish_sdist.sh` script from our stable branches to
publish a candidate before we do the final release, so we do want it to
run for nightlies on our stable branch. But we need to differentiate between
runs that do not contain a new version and runs that do contain a new
version.

So we do this check in the CI job, and exit with a special exit code to
flag when we did not upload a candidate. This means normal nightlies
will have an exclamation mark in an orange circle next to the
`hackage-release-candidate`, indicating a failure that does not cause
the pipeline as a whole to fail.

When the "special" nightly before a release is run, the developer
inspecting the result should verify a candidate was published (check
mark in green circle). In the usual case, where only one candidate will
be uploaded before release, they will also necessarily notice that the
candidate is simply not on Hackage if they forget to check the CI job's
result.

Because we don't have control over the exit codes of any binaries we
invoke, a trap handler is added in `.ci/functions.sh` that makes sure no
other exits will have the exit code we reserve for allowed-to-fail.
Currently, GitLab runners will not actually propagate the exit code of a
failing step in the script, but this might very well change in an
update. So we also proof our `.ci/setup.sh` script against such exits so
they don't trigger unwantedly in the `hackage-release-candidate` job.

(cherry picked from commit 7aef241)
DigitalBrains1 added a commit to clash-lang/clash-compiler that referenced this pull request Apr 12, 2026
Since haskell/hackage-server#1469
(Check candidate uploads against main index), Hackage no longer allows
candidates for published versions.

But we use the `.ci/publish_sdist.sh` script from our stable branches to
publish a candidate before we do the final release, so we do want it to
run for nightlies on our stable branch. But we need to differentiate between
runs that do not contain a new version and runs that do contain a new
version.

So we do this check in the CI job, and exit with a special exit code to
flag when we did not upload a candidate. This means normal nightlies
will have an exclamation mark in an orange circle next to the
`hackage-release-candidate`, indicating a failure that does not cause
the pipeline as a whole to fail.

When the "special" nightly before a release is run, the developer
inspecting the result should verify a candidate was published (check
mark in green circle). In the usual case, where only one candidate will
be uploaded before release, they will also necessarily notice that the
candidate is simply not on Hackage if they forget to check the CI job's
result.

Because we don't have control over the exit codes of any binaries we
invoke, a trap handler is added in `.ci/functions.sh` that makes sure no
other exits will have the exit code we reserve for allowed-to-fail.
Currently, GitLab runners will not actually propagate the exit code of a
failing step in the script, but this might very well change in an
update. So we also proof our `.ci/setup.sh` script against such exits so
they don't trigger unwantedly in the `hackage-release-candidate` job.

(cherry picked from commit 7aef241)

Co-authored-by: Peter Lebbing <peter@digitalbrains.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants