feat(setup-pack): add pack-version-file input and verify download checksum - #428
Conversation
|
This sounds great! A couple of notes/questions:
This sounds backwards to me. As I read this, my understanding is that
|
|
Thanks for the review! On the checksum (2): it already covers both paths. The download and sha256 verification are in the shared "Install pack CLI" step that runs after version resolution, so the same archive is fetched and checked the same way whether the version came from pack-version or pack-version-file. On precedence (1): you're right that inline-wins is the usual convention. I had the file win because pack-version carries a default (0.40.6, kept current by the update-pack-version workflow's sed on the default: line). Unlike setup-go's go-version, pack-version is never empty, so a composite action can't distinguish "user set 0.40.6" from "defaulted", and inline-always-wins would make pack-version-file unreachable. If you're open to it I can match setup-go: drop the input default, resolve pack-version then pack-version-file then a fallback baked into the resolve step, and point the update-pack-version sed at that fallback line so the auto-bump still works. Or I keep file-as-override and just document it. Which do you prefer? |
jjbustamante
left a comment
There was a problem hiding this comment.
@somaz94 , @dmikusa . @edmorley
The checksum validation in this PR is valuable and backward-compatible on its own, so I'd suggest we land it and handle the pack-version vs pack-version-file precedence question as a follow-up? For reference, here's the trade-off we'd revisit:
| Scenario | PR as-is (file wins) | setup-go semantics (inline wins) |
|---|---|---|
| User sets nothing | default 0.40.6 |
needs a fallback baked into the resolve step |
User sets pack-version only |
that version | that version |
User sets pack-version-file only |
file version | file version |
| User sets both | file wins (non-standard) | inline wins (standard) |
update-pack-version auto-bump |
keeps working (default line untouched) | breaks unless the sed is re-pointed |
| Convention match | surprising | familiar |
Based on that, I agree with @somaz94 approach to drop the default and add the fallback but we need to be careful with the automation for update-pack-version we have in place right now.
|
Thanks both. I went with the inline-wins redesign you endorsed rather than splitting, since it's contained to this PR:
Behavior stays backward compatible: with nothing set, the fallback equals the previous default. Validated locally — precedence (both / file-only / neither / leading- |
edmorley
left a comment
There was a problem hiding this comment.
Thank you for the PR! Couple of comments but other than that looks good to go :-)
|
Could you also rebase on |
9c39ac9 to
89c8f6d
Compare
|
Rebased onto
|
|
Done — I've rebased onto the latest |
edmorley
left a comment
There was a problem hiding this comment.
Thank you for the changes!
A few unrelated changes snuck in since the last review (LLM?) - left some comments on those to revert in some cases (eg the "default" -> "fallback" change)
|
Thanks @edmorley — all six review comments are addressed in the pushed commits: inline trailing-comment stripping in the plain-file parser ( |
8e0b877 to
d9a5d68
Compare
…cksum Signed-off-by: somaz <genius5711@gmail.com>
…sion-file Signed-off-by: somaz <genius5711@gmail.com>
Signed-off-by: somaz <genius5711@gmail.com>
Signed-off-by: somaz <genius5711@gmail.com>
Signed-off-by: somaz <genius5711@gmail.com>
d9a5d68 to
70387cc
Compare
|
Rebased on The unrelated changes you flagged were all reverted in the earlier round:
Ready for another look whenever you have a moment — thanks! |
Signed-off-by: Ed Morley <emorley@salesforce.com>
For some reason the GitHub merge conflict UI ignored my actual edits and committed the conflict markers. Signed-off-by: Ed Morley <emorley@salesforce.com>
edmorley
left a comment
There was a problem hiding this comment.
Thank you for the PR! (And sorry for the delay in reviewing)
|
Released in v6.0.0: |
|
Example of the new version working in CI (using the pinned default version): |
The
setup-packaction only accepted an explicitpack-version, and it piped the downloaded archive straight intotarwith no integrity check. This adds two things:pack-version-fileinput that reads the version from a.tool-versionsfile (thepackentry) or a plain version file like.pack-version. Version resolution is nowpack-version→pack-version-file→ a pinned default, so an explicitpack-versionalways wins even whenpack-version-fileis also set — matching thesetup-gogo-version/go-version-fileconvention.<asset>.sha256, so the action now downloads the archive to a temp file, verifies it against that checksum, and only then extracts. If the checksum cannot be fetched it warns and proceeds, so mirror / air-gapped setups are not broken.To make the precedence above work, the
pack-versioninput default was removed.setup-gocan treat an emptygo-versionas "unset", butpack-versionalways carried a default, so a composite action could not tell "user asked for the default" from "defaulted" — which madepack-version-fileunreachable whenever a default was present. The default is now aDEFAULT_PACK_VERSIONin the stepenv:block, used only when neither input is set, and theupdate-pack-versionworkflow'ssedis re-pointed at that line so the auto-bump keeps working.Runtime behavior is unchanged for existing users (with nothing set, the pinned default is unchanged). But removing the input default is an API change, so this should land as a major version bump.
Validation
Done locally (the repo has no composite-action test harness, only the Go unit tests):
.tool-versionswith apackentry (tab separated + trailing comment), plain version file (leadingv, blank/comment lines, and inline trailing comment like0.40.6 # pinned), and missing-file error.tarmember extraction still yields thepackbinary.update-pack-versionsedre-verified against the newDEFAULT_PACK_VERSION:env line.shellcheckclean on both inline scripts.