-
Notifications
You must be signed in to change notification settings - Fork 215
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
build(agd): use timestamps again; hashes weren't necessary #9179
Conversation
2c39d9c
to
27ca21e
Compare
bin/agd
Outdated
fi | ||
diff -u "$stamp" "$stamp.new" || return 1 | ||
return 0 | ||
echo ${1+"$@"} 1>&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.
the indentation changed here. time for .editorconfig
?
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 thought shfmt -w
could do no wrong!
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 discovered recently it needs --indent 4
in our codebase. I just checked and it ignores .editorconfig
.
I can add a .sh format check to CI if you think it's worthwhile.
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.
A format check would be welcome, but of lower priority. I don't mind doing manual shfmt for a little while.
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.
please use the formatting of .sh
scripts. CI isn't checking it because the script doesn't end in .sh
. Consider renaming the file go agd-with-build.sh
or something like that and having bin/agd
symlink to it.
For the reformatting, please have the base reformat in a separate commit before your changes. I did that in https://github.com/Agoric/agoric-sdk/tree/ta-agd-build-fix if you want to use those
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.
a symlink might not be compatible with tooling in the cosmovisor ecosystem
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.
A symlink is not compatible, but a tiny redirecting shell script is, so I did that.
55d271f
to
721452d
Compare
721452d
to
2ab96b0
Compare
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 appreciate the simplification and trust CI exercises this. From this review, my knowledge of bash grew from “more than I would like” to “even more than I would like”.
bin/agd
Outdated
fi | ||
diff -u "$stamp" "$stamp.new" || return 1 | ||
return 0 | ||
echo ${1+"$@"} 1>&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.
What does this do?
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 echoes the fatal
arguments to stderr with proper escaping.
STAMPS=node_modules/.cache/agoric | ||
mkdir -p "$STAMPS" |
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.
glad to see CI less coupled to the agd script implementation.
can't we remove this too? The script already defines STAMPS
so it just needs mkdir. Did you avoid that due to cross-platform concerns? We only support Mac and Linux and I think mkdir -p
works in both. Then you can just have the script mkdir idempotently.
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.
Just some detritus... I've removed it.
bin/agd
Outdated
set -x | ||
case "${2-''}" in | ||
--force | -f) | ||
rm -rf "$thisdir/../$STAMPS" |
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.
this will remove all agoric cache. shouldn't it remove just the files in its purview?
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.
Now I've isolated the stamps in a subdirectory so that the whole cache isn't deleted.
bin/agd
Outdated
yarn "$@" | ||
} | ||
|
||
# Check if any package.json is newer than the installation stamp. |
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.
This is a really broad scope for agd
. I don't expect a tool that I run to do yarn install or yarn scripts. This also unnecessarily couples agd to a particular package manager.
Not a blocker but a discussion I'd like to start. Can we leave package management to the package manager? I just started #9209 to track
# Check if any package.json is newer than the installation stamp. | |
# Check if any package.json is newer than the installation stamp. | |
# If some package.json is newer than the last yarn install, run yarn install | |
# UNTIL https://github.com/Agoric/agoric-sdk/issues/9209 |
package.json
Outdated
"build": "yarn workspaces run build && mkdir -p node_modules/.cache/agoric && date >node_modules/.cache/agoric/yarn-built", | ||
"postinstall": "patch-package && mkdir -p node_modules/.cache/agoric && date >node_modules/.cache/agoric/yarn-installed", |
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.
this is quite a bit of boilerplate for package.json. please have a helper script.
"build": "yarn workspaces run build && mkdir -p node_modules/.cache/agoric && date >node_modules/.cache/agoric/yarn-built", | |
"postinstall": "patch-package && mkdir -p node_modules/.cache/agoric && date >node_modules/.cache/agoric/yarn-installed", | |
"build": "yarn workspaces run build && scripts/timestamp.sh yarn-built", | |
"postinstall": "patch-package && scripts/timestamp.sh yarn-installed", |
I wonder if there's a little npm package for reading and writing cached values or comparing timestamps with a cached value on disk.
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 adopted this in scripts/agd-builder.sh
.
2ab96b0
to
393cd47
Compare
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.
👍
scripts/agd-builder.sh
Outdated
# Run the built Cosmos daemon. | ||
# shellcheck disable=SC2031 | ||
export PATH="$thisdir/../packages/cosmic-swingset/bin:$PATH" | ||
exec "$thisdir/../$GOLANG_DAEMON" ${1+"$@"} |
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.
consider moving this to bin/agd
so this builder script's only job is to build
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, good idea!
393cd47
to
2a091ad
Compare
2a091ad
to
c0ce234
Compare
c0ce234
to
ff3b455
Compare
refs: #8715
(ostensibly) closes: #8996
Description
Recommendation: Best viewed with hide whitespace changes.
The build hashes introduced in #8715 didn't actually solve the
# endo-branch: XXX
problem that it was designed to, the more careful handling of the Endo-based packages and caches in #8715 did instead.The complexity introduced by trying to use build hashes is not worth the cost, so this PR both simplifies and makes the original timestamp-based builds more robust.
Security Considerations
n/a
Scaling Considerations
Simpler to understand and more efficient to execute
agoric-sdk/bin/agd
.As a drive-by, reuse longer
yarn install
timeouts, so that the QEMU arm64 Docker builds succeed consistently again. This is a temporary fix until Agoric-SDK uses a solution for faster multiplatform builds (like #9043).Documentation Considerations
n/a
Testing Considerations
Build process and CI tests should be adequate for this PR.
Upgrade Considerations
n/a