GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix save-always/post-if with an output by ruffsl · Pull Request #6 · runs-on/cache

Conversation

@ruffsl

@ruffsl ruffsl commented May 13, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Fixes:

  • v4.0 save always not working #5

Cherry-picked from:

  • Fix save-always/post-if with an output actions/cache#1325

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ruffsl

ruffsl commented May 13, 2024

Copy link
Copy Markdown
Author

Shoot, cherry-picking over the orginal PR didn't work (as compared to when applied to github/cache):

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruffsl
ruffsl force-pushed the save-always-output branch from 737fccf to 399e3b6 Compare May 13, 2024 17:34
@ruffsl
ruffsl changed the base branch from main to v4 May 13, 2024 17:35
@ruffsl

ruffsl commented May 13, 2024

Copy link
Copy Markdown
Author

Just noticed the main branch is 10 commits behind v4?! Guess I don't understand the branching strategy here.

main...runs-on:cache:v4

However is also looks like the v4 branch itself is 13 commits behind v4.0.2 tag from upstream:

v4...actions:cache:v4.0.2

@crohr , any interest in updating v4 branch to track the prerequisite patches from upstream, E.g:

  • Fix fail-on-cache-miss not working actions/cache#1327
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crohr

crohr commented May 13, 2024

Copy link
Copy Markdown

V4 branch has more commits (mine) for handling s3 backend. I will pick the changes from upstream, most likely this week or next!

ruffsl reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crohr

crohr commented May 21, 2024

Copy link
Copy Markdown

@ruffsl I'd like the changes to merged upstream before proceeding, so that I do not diverge from upstream.

Is your issue not solvable through the use of the dedicated save / restore actions?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruffsl

ruffsl commented May 21, 2024

Copy link
Copy Markdown
Author

Is your issue not solvable through the use of the dedicated save / restore actions?

Eh, sort of. We have a lot of separate cache calls, so this would effectively double all those steps.

I'd like the changes to merged upstream before proceeding, so that I do not diverge from upstream.

No prob. But could we still at least pull in the current head of main branch from upstream? At least then the final patch would be simpler to apply and track from our own fork while we wait for upstream to merge in the fix. Upstream maintainers for actions/cache are missing in action at the moment (pun intended):

  • Fix save-always/post-if with an output actions/cache#1325 (comment)
  • https://github.com/orgs/community/discussions/121811
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crohr crohr mentioned this pull request May 21, 2024
Update from upstream #10
Merged
@crohr

crohr commented May 21, 2024

Copy link
Copy Markdown

@ruffsl v4 has been updated with the latest fixes from upstream.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bearfriend added 3 commits May 22, 2024 11:37
@bearfriend @ruffsl
Fix save-always/post-if with an output
4857203
@bearfriend @ruffsl
Always output explicit "false" to prevent hijacking
6afde47
@bearfriend @ruffsl
Add save-always inpute/output test
5168c70
@ruffsl
ruffsl force-pushed the save-always-output branch from 399e3b6 to 5168c70 Compare May 22, 2024 17:10
@ruffsl

ruffsl commented May 22, 2024

Copy link
Copy Markdown
Author

Dang. I rebased from the head of v4 on this repo, then rebuilt the patch, but can't get the same fix working.

It's odd in that the diff of the npm build look the same, but perhaps this fork has affected the control flow?

  • bearfriend@3a22487
    • working patch applied to actions/cache
  • botsandus@98f0c46
    • not yet working applied to runs-on/cache
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruffsl

ruffsl commented May 30, 2024

Copy link
Copy Markdown
Author

Once such local change I can readily spot between the two diffs is this:

--- https://raw.githubusercontent.com/bearfriend/cache/3a22487daddcfa2ebf7238869de052504cc6dc4b/dist/restore/index.js
+++ https://raw.githubusercontent.com/botsandus/cache/98f0c46be05ee2b67a1c04787e1448b4537ac39b/dist/restore/index.js
@@ -1,4 +1,4 @@
-function restoreImpl(stateProvider) {
+function restoreImpl(stateProvider, earlyExit) {
     return __awaiter(this, void 0, void 0, function* () {
         core.setOutput(constants_1.Outputs.SaveAlways, core.getInput(constants_1.Inputs.SaveAlways) || "false");
         try {
@@ -20,7 +20,14 @@
             const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
             const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss);
             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
-            const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
+            let cacheKey;
+            if (canSaveToS3) {
+                core.info("The cache action detected a local S3 bucket cache. Using it.");
+                cacheKey = yield custom.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly });
+            }
+            else {
+                cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
+            }
             if (!cacheKey) {
                 if (failOnCacheMiss) {
                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
@@ -45,6 +52,9 @@
         }
         catch (error) {
             core.setFailed(error.message);
+            if (earlyExit) {
+                process.exit(1);
+            }
         }
     });
 }

@crohr , any suggestions?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruffsl

ruffsl commented Jun 18, 2024

Copy link
Copy Markdown
Author

Looks like this'll be a wontfix from upstream:

  • v4.0 save always not working actions/cache#1315 (comment)

solvable through the use of the dedicated save / restore actions?

@crohr , I've now indeed gone back to that approach using if: always() via an explicit save step.
The only bummer being that it nurfs the utility of caching in a composite action with ordered post steps:

  • Fix save-always/post-if with an output actions/cache#1325 (comment)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruffsl ruffsl closed this Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ruffsl @crohr @bearfriend
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.