GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix save-always/post-if with an output by bearfriend · Pull Request #1325 · actions/cache Conversation
|
| main: 'dist/restore/index.js' | ||
| post: 'dist/save/index.js' | ||
| post-if: "success() || github.event.inputs.save-always" | ||
| post-if: "success() || (contains(steps.*.outputs.save-always-d18d746b9, 'true') && !contains(steps.*.outputs.save-always-d18d746b9, 'false'))" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can't know the step id, so check all steps for our unique output, and make sure it has at least one 'true' value and no 'false' values.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| outputs: | ||
| cache-hit: | ||
| description: 'A boolean value to indicate an exact match was found for the primary key' | ||
| save-always-d18d746b9: |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Give the new output a unique name to eliminate accidental conflicts when checked in post-if.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ): Promise<string | undefined> { | ||
| core.setOutput( | ||
| Outputs.SaveAlways, | ||
| core.getInput(Inputs.SaveAlways) || "false" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Always fall back to setting an explicit "false" value to prevent hijacking.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d96e0a6 to
3e72a6e
Compare
|
cc @to-s @bethanyj28 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bump. At least CI should be run here? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
bump |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
bump. Please review this. The feature that the breaking change v4.0 was made for does not work. This purports to fix it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@bethanyj28 Do you have any idea why we're ok with this feature sitting broken for so long? Can we either get some movement on this PR or just close it? Is there someone else I can reach out to? Thanks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@bearfriend , I couldn't get 3e72a6e to work. Must this be merged for action version namespace pinning to take effect? - name: Cache overlay id: cache-overlay uses: actions/cache@3e72a6ebe141e2d806ccb28d2696f2680fd84c32 with: save-always: true path: tmp key: ${{ github.ref }} |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It needs to go through the build process. This branch has done that and should be usable, though I haven't checked in a while: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bump |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bump. Please review. What's the issue holding this up? Does this action or the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've opened a community discussion to understand why this is getting no attention https://github.com/orgs/community/discussions/121811 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@joshmgross , this PR could use some love. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
Would you be up for adding an integration test in a workflow to validate that save-always is working? That would ensure this feature gets fixed and doesn't break in the future.
I'm thinking something along the lines of the actions/github-script integration tests that reference the action with ./ to validate the current branch's version.
https://github.com/actions/github-script/blob/main/.github/workflows/integration.yml
Let me know if you want any help setting that up.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yeah I can look into that. Looks fairly straightforward. I'll let you know if I run into any issues. Thanks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
34664da to
3e8104d
Compare
There was an error while loading. Please reload this page.
|
@joshmgross Looks like there were already a similar set of tests in
Never mind! I had been assuming |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
cdb74e5 to
ed49aa2
Compare
| # End to end with save-always | ||
| test-save-always: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to do something like a post hook to check that failure occurred and mark as passing? It does seem prone to confusion to have CI marked intentionally as failing
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yep, completely agree.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm a little unclear on how this will ultimately look throughout the github UI. The status of the workflow in the Actions tab is is passing, but the indicator above for checks on the commit show failing. Maybe that's technically accurate, but still feels a little weird. Either way that's a bigger issue than this bug or this repo.
I don't think there is a way to force the step conclusions to pass that doesn't also give the post step success, which defeats the purpose of the test. Perhaps Josh knows more, though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's confusing - I don't think we support anyway to hide these. If you wanted a step to fail but not fail the job itself, you can add continue-on-error to the step but that wouldn't allow us to test the post-if case where success() is false.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| main: 'dist/restore/index.js' | ||
| post: 'dist/save/index.js' | ||
| post-if: "success() || github.event.inputs.save-always" | ||
| post-if: "success() || (contains(steps.*.outputs.save-always-d18d746b9, 'true') && !contains(steps.*.outputs.save-always-d18d746b9, 'false'))" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
First of all, I want to say thank you for your contributions, patience, and responsiveness to feedback.
As far as I can tell, we only officially support accessing the runner context in post-if as that's what's currently in our documentation:
post: 'cleanup.js' post-if: runner.os == 'linux'
I've chatted a bit internally with some engineers who work in on the Actions runner and other contexts aren't intentionally supported:
"post-if": "non-empty-string"
non-empty-string effectively means that the schema is only ensuring that the value provided to post-if is not empty, it doesn't specific any contexts.
The use of a designated output and reading all step outputs in the current job does not feel sustainable and it's relying on undefined behavior, so I'm reluctant to depend on it for this feature. If this breaks in the future due to changes in the runner, we won't have any official alternatives and users will have already begun relying on this feature.
I'm going to start a discussion in #1315 to gather feedback on next steps. For full transparency, I'm leaning towards removing save-always and recommending users switch to using the dedicated actions/cache/save actions with an if: always() to support these scenarios.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We use actions/cache in a composite action, where we rely on actions/cache injecting the post step after the user's code. Moving to require an explicit actions/cache/save I believe would not be possible with a composite action, requiring the user to change their workflows, which wouldn't be compatible with our needs.
Here is our PR that's lined up for this feature working https://github.com/julia-actions/cache/pull/107/files
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
use actions/cache in a composite action, where we rely on actions/cache injecting the post step
@IanButterworth , I had the same goal, but we may have other issues in common as well:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
v4.0 save always not working
There was an error while loading. Please reload this page.