-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching on GHES #452
Caching on GHES #452
Conversation
Hello everyone. Could you please take a look at this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking this PR 🙇 . I have left few comments
__tests__/cache-restore.test.ts
Outdated
@@ -102,6 +103,9 @@ describe('cache-restore', () => { | |||
|
|||
// cache-utils | |||
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change and L53 change is required? Because I think in restore restoreCache function we don't check isCacheActionAvailable
functions. This we are checking in main.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
__tests__/cache-save.test.ts
Outdated
@@ -70,6 +71,9 @@ describe('run', () => { | |||
|
|||
// utils | |||
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment. Is this change required here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
__tests__/cache-utils.test.ts
Outdated
@@ -51,7 +40,35 @@ describe('cache-utils', () => { | |||
}); | |||
}); | |||
|
|||
it('isCacheFeatureAvailable is false', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the description, Please add whether the scenario is of GHES or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
__tests__/cache-utils.test.ts
Outdated
); | ||
}); | ||
|
||
it('isCacheFeatureAvailable is false', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
src/cache-utils.ts
Outdated
export function isCacheFeatureAvailable(): boolean { | ||
if (!cache.isFeatureAvailable()) { | ||
if (isGhes()) { | ||
logWarning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer here to throw an error instead of a warning. Because this keeps it consistent with other setup-* actions https://github.com/actions/setup-java/pull/308/files#diff-3294a832ea2276e554177e0b3007cc2d401c082912c7fbde49fa09141bf1aed1R87-R103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
src/main.ts
Outdated
@@ -46,7 +46,7 @@ export async function run() { | |||
} | |||
|
|||
if (cache) { | |||
if (isGhes()) { | |||
if (!isCacheFeatureAvailable()) { | |||
throw new Error('Caching is not supported on GHES'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not throw the error here (if we can throw it from isCacheFeatureAvailable function ). We can return if the Cache feature is not available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
src/cache-utils.ts
Outdated
); | ||
} else { | ||
core.warning( | ||
'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitry-shibanov in actions/setup-python#363 we ended up changing this warning:
'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.' | |
'The runner was not able to contact the cache service. Caching will be skipped' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
Description:
In scope of this pull request we add support for caching on GHES.
Related issue:
#450
Check list: