New token-command option for cabal upload - #12132
Conversation
713327d to
95ac8c0
Compare
I do not see them. |
|
You are right, I misread as "Manual QA done". Apologies! |
There was a problem hiding this comment.
Pull request overview
Adds support for obtaining a Hackage upload token by executing an external command, addressing the need to avoid storing tokens in plaintext config files (Issue #12130). This integrates with existing cabal upload flag/config handling patterns similar to --password-command.
Changes:
- Add
--token-command(-T) option tocabal upload, plumbed throughUploadFlagsand config merging. - Execute the configured command during
cabal uploadto obtain the token. - Update docs/changelog and extend config-related tests to cover the new option’s presence/serialization.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/cabal-commands.rst | Documents the new --token-command option for cabal upload. |
| changelog.d/token-command.md | Adds a user-facing changelog entry for the new option. |
| cabal-testsuite/PackageTests/UserConfig/cabal.test.hs | Extends user-config update tests to include token-command serialization. |
| cabal-install/tests/IntegrationTests2.hs | Ensures generated config option comments include token-command. |
| cabal-install/src/Distribution/Client/Setup.hs | Adds uploadTokenCmd flag and CLI parser for --token-command. |
| cabal-install/src/Distribution/Client/Main.hs | Runs the command to obtain a token and passes it to upload/uploadDoc. |
| cabal-install/src/Distribution/Client/Config.hs | Ensures uploadTokenCmd is merged in SavedConfig Semigroup instance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! After quick skimming this looks ok except the failing test. In order to update the reference output of the test (the reason it fails currently) you have to build the test suite executable from the cabal-testsuite package and run it with the --accept flag as explained in that package's README. |
95ac8c0 to
ba776fe
Compare
|
Thanks for pointing me to the instructions. I was able to update the expectation. Self-note: I had to run the following commands: $ cabal build cabal-install
$ ./dist-newstyle/build/x86_64-linux/ghc-9.12.4/cabal-testsuite-3/build/cabal-tests/cabal-tests \
--accept \
--with-cabal=./dist-newstyle/build/x86_64-linux/ghc-9.12.4/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal \
-j 8 |
|
I'll review formally before the weekend |
ulysses4ever
left a comment
There was a problem hiding this comment.
Thanks!
It’d be nice if someone could try it out (a cabal binary from this patch should be available from CI). Manual QA notes (see the checklist in the PR template) could make it more probable , even if the notes are trivial in this case.
You can do it without hardcoding pathes: cabal build cabal-install:exe:cabal
cabal run cabal-testsuite:exe:cabal-tests -- --with-cabal=$(cabal list-bin cabal-install:exe:cabal) --accept -j8 |
I haven't forgotten about this, I just haven't found the time to do it yet |
|
@ulysses4ever I have updated the PR body with QA notes |
d5e8ff9 to
768fc8d
Compare
|
Oh my, it narrowly missed 3.18.10… the good news is: there’s 3.18.2.0 on the way! we need a second review! @Mikolaj @ffaf1 @philderbeast also, share if you have concerns regarding backporting it to 3.18 |
|
It’s a straightforward change, client only, but it’s not a bug fix, so technically… but it’s our fault that it slipped through the cracks during 3.18.1.0 release |
|
This is not a regression, but indeed it slipped through the cracks in I say this should land in |
|
Thanks! |
|
Note to self: this PR contains This does not make it suitable for a point release. |
Merge Queue Status
This pull request spent 2 hours 9 minutes 10 seconds in the queue, including 2 hours 6 minutes 46 seconds running CI. Required conditions to merge
|
* New token-command option for cabal upload * New token-command option for cabal upload * Fixup reference to configuration values
This patch addresses #12130 by adding a new option to
cabal upload,--token-command.significance: significantin the changelog file.QA notes
In order to test the following exactly, you need some form of secret management. I will use
1password, which is used asopon the command line.Calling
cabal upload --verbose --token-command=...should look like the following:In particular, the exposed
curlcall shows that the Hackage token (<OMITTED>above) is being pulled from thetoken-commandargument appropriately.Likewise, inserting the following line in the config file:
and running
gives the same exact results