-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
#4163 | Speed-up CI by using published UI artifacts #4251
#4163 | Speed-up CI by using published UI artifacts #4251
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #4251 +/- ##
==========================================
+ Coverage 97.08% 97.10% +0.02%
==========================================
Files 302 302
Lines 17685 17685
==========================================
+ Hits 17169 17173 +4
+ Misses 415 412 -3
+ Partials 101 100 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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 explain how the change was tested
Makefile
Outdated
cd jaeger-ui && yarn install --frozen-lockfile && cd packages/jaeger-ui && yarn build | ||
cd jaeger-ui | ||
|
||
if git describe --exact-match --tags $(git rev-parse HEAD) >/dev/null 2>&1; then |
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.
Makefiles don't work with such multi-line scripts, unless you escape them. It may be easier to move all logic into scripts/rebuild-ui.sh
Makefile
Outdated
if curl --output /dev/null --silent --head --fail "$release_url"; then | ||
# Download the file and unzip it into packages/build/ | ||
|
||
curl -L -o assets.tar.gz "$release_url" |
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 we use a temp file
tmpfile=$(mktemp)
trap rm tmpfile EXIT
@yurishkuro This is still WIP and I need to rework on this. I'll take your suggestions and make the necessary changes. |
@yurishkuro I have made some commits on this. I am not exactly sure how to get the version of the head commit. The command $ (git describe --exact-match --tags $(git rev-parse HEAD)) gives me the Hash associated with the latest commit but not the version. Can you look into the commit once? |
This seems to work: # when on release tag
$ cd jaeger-ui
$ git describe --exact-match --tags
v1.27.3
# when on a commit without release tag
$ git checkout HEAD^1
$ git describe --exact-match --tags
fatal: no tag exactly matches '9b1ee69fa04482fa6e31e186f0ec790f21f28322'
# above also returns with an error code |
scripts/rebuild-ui.sh
Outdated
|
||
cd ../jaeger-ui | ||
|
||
if git describe --exact-match --tags $(git rev-parse HEAD) >/dev/null 2>&1; then |
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.
don't think you need $(git rev-parse HEAD)
, by default it gives you current commit
scripts/rebuild-ui.sh
Outdated
if git describe --exact-match --tags $(git rev-parse HEAD) >/dev/null 2>&1; then | ||
|
||
# Get the release version from the tag | ||
release_version = $(git describe --exact-match --tags $(git rev-parse HEAD)) |
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.
no reason to run the same git command twice, read it into a var once
scripts/rebuild-ui.sh
Outdated
|
||
|
||
# Check if the corresponding UI release has the assets.tar.gz file uploaded | ||
release_url="https://github.com/jaegertracing/jaeger-ui/releases/download/${release_version}/assets.tar.gz" |
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 wouldn't recommend using the output from git directly like that. Instead, match it against the release tag patter (vN.M.m) and only then use in the URL
scripts/rebuild-ui.sh
Outdated
if curl --output /dev/null --silent --head --fail "$release_url"; then | ||
curl --location --output "$temp_file" "$release_url" | ||
tar -zxvf "$temp_file" -C packages/jaeger_ui/build/ | ||
rm -f "$temp_file" |
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 safer to use a trap right after you defined the var
scripts/rebuild-ui.sh
Outdated
|
||
# Download the file to the temporary file and extract it into packages/build/ | ||
if curl --output /dev/null --silent --head --fail "$release_url"; then | ||
curl --location --output "$temp_file" "$release_url" |
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.
Why do you need to check for --head
first instead of trying to download right away? I assume it would still return an error exit code if the URL is invalid.
scripts/rebuild-ui.sh
Outdated
tar -zxvf "$temp_file" -C packages/jaeger_ui/build/ | ||
rm -f "$temp_file" | ||
|
||
else |
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.
rather than having two duplicate else
, just call exit 0
here. Something like:
tag=$(git describe ...)
if tag matches pattern; then
temp_file=$(mktemp)
trap "rm -f ${temp_file}" EXIT
if curl ... ; then
untar
exit 0
fi
fi
# do a regular full build
yarn install --frozen-lockfile && cd packages/jaeger-ui && yarn build
I have added more commits. 1)Currently the $(git describe --exact-match --tags) command returns v1.27.3. Then it matches it with release tag patter(vN.M.m) and then tries the download it right away. As the assets file does not exist for this version, it fails with an exit code 0 and stops the execution. Do I need to make a change such that if it fails we perform a full build?
Is this only because the current backend version is not compatible with the assets file that was downloaded or are there more changes required? |
you can bump your local Jaeger repo to v1.27.4 of the UI: $ pwd
.../dev/jaegertracing/jaeger
$ cd jaeger-ui
$ git checkout v1.27.4 to restore it back $ pwd
.../dev/jaegertracing/jaeger
$ git submodule update |
The error seems to suggest that your build did not place the assets in the right place where they could be picked up by the UI build. |
Makefile
Outdated
@@ -214,7 +214,9 @@ jaeger-ui/packages/jaeger-ui/build/index.html: | |||
|
|||
.PHONY: rebuild-ui | |||
rebuild-ui: | |||
cd jaeger-ui && yarn install --frozen-lockfile && cd packages/jaeger-ui && yarn build | |||
cd scripts && ./rebuild-ui.sh |
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.
cd scripts && ./rebuild-ui.sh | |
./scripts/rebuild-ui.sh |
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.
Yeah -C flag was creating packages/jaeger-ui/build/ again. Have fixed this with the latest commit
The build succeeds after we bump the UI version to v1.27.4. But fails for the version v1.27.3 as it tries to download right away and does not find the assets file and it exits after that. @yurishkuro Do I need to change this? The tests that have failed are because this issue. |
7c8666b
to
64592e1
Compare
64592e1
to
1d3bc1d
Compare
Signed-off-by: shubbham1215 <[email protected]>
Signed-off-by: shubbham1215 <[email protected]>
Makefile
Outdated
chmod u+x scripts/rebuild-ui.sh && ./scripts/rebuild-ui.sh | ||
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 call it with bash
chmod u+x scripts/rebuild-ui.sh && ./scripts/rebuild-ui.sh | |
bash ./scripts/rebuild-ui.sh | |
I am going to merge #4282 soon so that v1.27.4 becomes the current version on |
scripts/rebuild-ui.sh
Outdated
trap "rm -f ${temp_file}" EXIT | ||
release_url="https://github.com/jaegertracing/jaeger-ui/releases/download/${tag}/assets.tar.gz" | ||
|
||
if curl -O "$release_url"; then |
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.
when I ran this, I got assets.tar.gz
in the local dir. Why do you need to call curl twice?
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 guess it was part of some earlier commit wherein I was first checking if the file exists instead of downloading right away. I have fixed this.
Signed-off-by: shubbham1215 <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Thank you! |
Which problem is this PR solving? Resolves #4163 Short description of the changes Issues raised by the previous pull request at #4251 --------- Signed-off-by: shubbham1215 <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
This broke our internal build where we have some patches for jaeger-ui applied. Perhaps we should check for a clean git tree before downloading the jaeger-ui archive from GitHub. |
The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * jaegertracing#4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes.
I made #4553 to rectify this. |
The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * jaegertracing#4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes. Signed-off-by: Ivan Babrou <[email protected]>
The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * jaegertracing#4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes. Signed-off-by: Ivan Babrou <[email protected]>
The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * #4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes. Signed-off-by: Ivan Babrou <[email protected]>
…racing#4553) The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * jaegertracing#4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes. Signed-off-by: Ivan Babrou <[email protected]> Signed-off-by: KevinSchneider <[email protected]>
…racing#4553) The previous behavior resulted in the prebuild upstream package being downloaded, even if the local tree has any changes, whether they are commited or not. This broke our internal build that has some patches applied. See: * jaegertracing#4251 (comment) Let's use a more strict approach and only use the prebuild package if the tag is exact and does not contain any extra changes. Signed-off-by: Ivan Babrou <[email protected]> Signed-off-by: Afzal Ansari <[email protected]>
Which problem is this PR solving?
Resolves #4163
Short description of the changes