-
Notifications
You must be signed in to change notification settings - Fork 166
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
promote: add check_r2_assets tool #3977
Conversation
8727a29
to
cc8c87e
Compare
relative_srcdir=${srcdir/$staging_rootdir/"$site/"} | ||
relative_dstdir=${dstdir/$dist_rootdir/"$site/"} | ||
|
||
node --no-warnings /home/staging/tools/promote/check_r2_assets.mjs $staging_bucket/$relative_srcdir/$2 $prod_bucket/$relative_dstdir/$2 |
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.
@targos FYI I have deployed this PR onto www and am fairly confident it should work (without doing an actual release). If this does interfere with nodejs/node#56119 then commenting out these additional lines should restore the old behaviour (i.e. check the DO droplet only).
To illustrate the difference: $ node --no-warnings /home/staging/tools/promote/check_assets.js /home/staging/nodejs/release/v22.12.0 /home/dist/nodejs/release/v22.12.0
... Checking assets
... Expecting a total of 47 assets for v22.x
... 0 assets waiting in staging
... 47 assets already promoted
✓ Complete set of expected assets in place for v22.x
$ Equivalent check on R2: $ node --no-warnings /home/staging/tools/promote/check_r2_assets.mjs r2:dist-staging/nodejs/release/v22.12.0 r2:dist-prod/nodejs/release/v22.12.0
... Checking R2 assets
... Expecting a total of 47 assets for v22.x
... 47 assets waiting in R2 staging
⚠ 47 assets already promoted in R2 will be overwritten, is this OK?
✓ Complete set of expected assets in place for v22.x
Promote if you are certain this is the the correct course of action
$ |
bda6f57
to
1f52a06
Compare
Add tool and tests for checking if assets on R2 look ready for promotion. Relies on `rclone` being available -- there's a test for the case where it is not. The new tool is based on existing `check_assets.js` but: - Written in ESM. - Uses built-in Set objects instead of emulating sets with Arrays. - Always assumes an asset file exists. `check_assets.js` has some fallback logic, but it's not straightforward and nowadays we can consider a missing asset file to be a process failure. - Reflects that `.done` files are not used for R2 (basically they don't exist so no handling logic). Also note that for R2, promotion is a copy and not a move so after a partial promotion subsequent checks will result in overwrite warnings for files previously promoted. - `SHASUMS256.txt` can end up in the staging directory. Ignore for the staging directory as `check_assets.js` does for dist. (The shasums are generated by later parts of the release process.)
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'm not very used to node:test
but generally LGTM. Thanks!
console.log('... Checking R2 assets'); | ||
// No expected asset list available for this line | ||
if (expectedAssets.size === 0) { | ||
console.log(` \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m No expected asset list is available for ${line}, does one need to be created?`); |
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.
Feel free to ignore, but these could be simplified with util.styleText
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.
SGTM, but let's do that in a follow up. The same applies to check_assets.js
.
Neither am I 🙂. |
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.
LGTM
Add tool and tests for checking if assets on R2 look ready for promotion. Relies on
rclone
being available -- there's a test for the case where it is not.The new tool is based on existing
check_assets.js
but:check_assets.js
has some fallback logic, but it's not straightforward and nowadays we can consider a missing asset file to be a process failure..done
files are not used for R2 (basically they don't exist so no handling logic). Also note that for R2, promotion is a copy and not a move so after a partial promotion subsequent checks will result in overwrite warnings for files previously promoted.SHASUMS256.txt
can end up in the staging directory. Ignore for the staging directory ascheck_assets.js
does for dist. (The shasums are generated by later parts of the release process.)Fixes: #3958
FYI @nodejs/releasers