-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore(ci): include common changes to cache version #433
Conversation
✅ Deploy Preview for api-clients-automation canceled.
|
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
Thanks for the review, but this is still in draft I have a few changes to make :) |
Yeah sorry I saw that it was still a draft afterwards :s . |
scripts/ci/setRunVariables.ts
Outdated
const hash = (await hashElement('.', check.hashOptions)).hash.replace( | ||
/[=/]/g, | ||
'' | ||
); |
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.
Does it default to base64? Can't we ask for hexadecimal so we don't have to handle it?
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.
ah good idea it can be hex
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.
Great addition!!
const VARIABLES_TO_CHECK: Array<{ | ||
name: string; | ||
path: string[]; | ||
needHash?: boolean; | ||
hashOptions?: HashElementOptions; | ||
}> = [ |
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.
Since it's not used elsewhere the inferred type is enough
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.
it not inferring the type of hashOptions
on it's own, this is needed to have autocompletion
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.
Oh :(
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.
gg!!!
jk the ci is broken again |
it looks like the CTS step restore cache is missing the |
.github/actions/cache/action.yml
Outdated
echo "CACHE_VERSION=$(< .github/.cache_version)" >> $GITHUB_ENV | ||
echo "CACHE_COMMON_HASH=${{ inputs.cache_hash }}" >> $GITHUB_ENV |
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.
what if we concatenate .cache_version and cash_hash and assign to CACHE_VERSION
?
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 tried that at first but CACHE_VERSION
only is needed for yarn
cache, because we need yarn to build CACHE_COMMON_HASH
.
Actually it could be in it's own variable, that would make more sense, but it still needs to be passed around everywhere
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.
Ah okay, it makes sense. Tough problem 😅
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.
it's much cleaner like that thank you :)
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.
Looks good to me as long as it passes all the CI checks.
🧭 What and Why
Include github actions hash and scripts hash in the cache version, to invalidate everything when those file changes and avoid bumping cache by hand.
The env is a bit quirky, it looks like it's only available to the job itself, not the workflow.
To fight this the
cache
action will reset the env on every job, making it available to who want's to use it.🧪 Test
CI