Add 'ldc-nightly' install target#282
Conversation
|
Thanks for your pull request and interest in making D better, @JohanEngelen! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
wilzbach
left a comment
There was a problem hiding this comment.
LGTM. I will add it to run.dlang.io once this is merged and deployed to dlang.org
| ldc-nightly) | ||
| local CIurl=https://github.com/ldc-developers/ldc/releases/tag/CI | ||
| logV "Finding latest ldc-nightly binary package (at $CIurl)." | ||
| local package="$(curl -s $CIurl | grep -o "ldc2-[0-9a-f]*-$OS-$ARCH-[0-9]*.tar.xz" | head -n 1)" |
There was a problem hiding this comment.
Shellcheck error:
In script/install.sh line 427:
local package="$(curl -s $CIurl | grep -o "ldc2-[0-9a-f]*-$OS-$ARCH-[0-9]*.tar.xz" | head -n 1)"
^-- SC2155: Declare and assign separately to avoid masking return values.
There was a problem hiding this comment.
There was a problem hiding this comment.
How do you want me to fix this?
local -r silences the warning; i don't particularly care about error codes, because we handle the error elsewhere. Still, it might be nice for the user to see the raw error.. ?
There was a problem hiding this comment.
I think both local -r and using a separate line for the definition work though the latter seems to be the more prevalent style in this script, so I would opt for that one.
And now Linux ;-) |
|
Thanks. As @MartinNowak is the author and "owner" of this install script, I would wait for his feedback/approval before merging. I can't deploy it anyways :/ |
PetarKirov
left a comment
There was a problem hiding this comment.
Thanks for the nice work @JohanEngelen, LGTM!
| local CIurl=https://github.com/ldc-developers/ldc/releases/tag/CI | ||
| logV "Finding latest ldc-nightly binary package (at $CIurl)." | ||
| local package | ||
| package="$(curl -s $CIurl | grep -o "ldc2-[0-9a-f]*-$OS-$ARCH-[0-9]*.tar.xz" | head -n 1)" |
There was a problem hiding this comment.
Hopefully we can replace this with a more robust way of getting the latest CI build, but we can live with it for now.
There was a problem hiding this comment.
The uploads are not sorted and old ones aren't deleted, so that results in a random artifact, not the latest one.
Who's updating the sha of the CI tag btw?
There was a problem hiding this comment.
(nice, you spotted the problem too)
|
Nit: can you squash the "Fix [..] warning" commit into the first one? (Once it passes the CI tests.) |
5de9ef5 to
63ffff6
Compare
| local CIurl=https://github.com/ldc-developers/ldc/releases/tag/CI | ||
| logV "Finding latest ldc-nightly binary package (at $CIurl)." | ||
| local package | ||
| package="$(curl -s $CIurl | grep -o "ldc2-[0-9a-f]*-$OS-$ARCH-[0-9]*.tar.xz" | head -n 1)" |
There was a problem hiding this comment.
Please use fetch instead of curl so there is some retry logic.
| COMPILER="ldc-$(fetch $url)" | ||
| ;; | ||
| ldc-nightly) | ||
| local CIurl=https://github.com/ldc-developers/ldc/releases/tag/CI |
There was a problem hiding this comment.
Weird variable name, how about url or ci_url instead?
| logV "Determining latest ldc-beta version ($url)." | ||
| COMPILER="ldc-$(fetch $url)" | ||
| ;; | ||
| ldc-nightly) |
There was a problem hiding this comment.
I'd say we should at least also resolve ldc-2017222 so it's possible to install a compiler from a specific date, quite useful for bisecting an issue.
I'm not sure whether you actually plan to archive your nightly builds.
There was a problem hiding this comment.
I also don't know whether we'll archive the nightlies.
This is a new feature though, so please just merge this.
There was a problem hiding this comment.
(they aren't "nightlies" btw, it's a new build after each git commit)
There was a problem hiding this comment.
Perhaps we should name it ldc-latest-ci-build?
There was a problem hiding this comment.
I don't like the term 'nightly' either. I guess for DMD they are indeed proper nightlies with no difference compared to regular builds. For us, they are the latest successful CI builds, which means a revision may not be available for all platforms (sporadic failures, timeouts...), not available at the same time (Windows x64/multilib and OSX packages taking quite a bit longer than the Linux x64 one), and particularly, they feature enabled LLVM+LDC assertions (well, currently not for Windows, due to AppVeyor slowness), increasing compile times over a normal release package.
63ffff6 to
e9061bc
Compare
|
Wait with merging, this does the wrong thing. Edit: I thought we only keep the latest nightly on that "CI" release page, but apparently new builds are appended. So we cannot just do a grep for the package name, because that would just get the package with the alphabetically first githash. So this PR needs a big rework. |
|
@JohanEngelen as mentioned in ldc-developers/ldc#1883 (comment), I think the best solution would be to make your CircleCI job push commits to https://github.com/ldc-developers/ldc-developers.github.io, updating a file like |
|
Looking at this you might want to add |
|
At best you keep the uploads for a week, so found issues can be reproduced. |
|
@JohanEngelen did you manage to write such a |
|
@wilzbach Haven't looked further into this. It's on the backburner... |
| local ci_url=https://github.com/ldc-developers/ldc/releases/tag/CI | ||
| logV "Finding latest ldc-nightly binary package (at $ci_url)." | ||
| local package | ||
| package="$(fetch $ci_url | grep -o "ldc2-[0-9a-f]*-$OS-$ARCH-[0-9]*.tar.xz" | head -n 1)" |
There was a problem hiding this comment.
Surely querying the GitHub API is not going to be any worse than scraping HTML...
Check if it's possible to formulate a GitHub API query for this. Even if parsing the result with just bash is infeasible, having a dependency on jq seems reasonable. |
|
The GitHub API is heavily rate-limited. Using it will lead to failures on heavily used CIs like Travis. |
|
Oh, because it will share limits with the IPs of CI services? That makes sense, but scraping HTML is still fragile. CI services generally allow adding secrets to the account, so an API authentication token can be used there. (Or, just move the logic elsewhere...) |
|
I have completely stopped working on this btw. Feel free to take over. |
|
I really don't know that much about LDC development. I could write a tiny web service that returns the needed information from the GitHub API, if it helps. But, I can only guarantee that its availability will be as good as e.g. forum.dlang.org, which is probably around only 99%. |
|
This would help a lot for this issue. |
|
Cool. Will you do the other part if I do that? |
|
@wilzbach @CyberShadow The date has been removed from the filename. See: https://github.com/ldc-developers/ldc/releases/tag/CI Edit: wait... how does Vlads script determine which is the newest....??? I sense I did something dumb here... |
The main difficulty is that we are talking about 6 artifacts, published by 5 independent jobs, from 3 different CI services. So it's a timing issue and a question of reliability, as some jobs time out not too seldomly or randomly fail, unfortunately. I guess there's no real way around querying the GitHub API and checking the timestamps of the files. Having a proxy do that (and cache it for some minutes or so) to bypass the rate limit would be nice, of course. Edit: Well we could theoretically have a |
Updated script to show only the hash.
The release ID apparently doesn't change when new files are uploaded, so the data is always at /repos/ldc-developers/ldc/releases/8840125.
GitHub does not count 301 replies against the rate limit, which means the script will always provide the latest data with no rate limit. |
|
Can you show the source of the script? I only see the result and wonder how it works. It's almost certain that the Linux package is available earlier than the OSX one, so if it just returns the hash of the latest Linux package, the according OSX package may not be available yet. It needs to be per-platform (something like |
@kinke That doesn't sound all that bad and would simplify things a lot I feel. |
|
Not for us, as 3 CI services need to be able to push to that repo, requiring a token to do so, which could even be abused by some malevolent PR etc. |
|
I changed it to just dump all URLs, so that you can grep it as needed. Does that help? |
|
@CyberShadow Look at the CI release page now. The problem is getting the URL belonging to the latest packages. (getting the urls is not the problem). |
|
The GitHub server is replying with a "304 Not Modified" to a request with an "If-Modified-Since" of "Tue, 04 Dec 2018 22:50:54 GMT", for a resource that very obviously has been modified within the past week. Looks like a bug in their API. Edit: sent a support request. |
|
Caching issue was fixed (switched to ETag-based caching at GitHub support's suggestion). What next, should I filter the assets to bin them by the hash and only show the last one per hash?
Yes, sorry, here it is: Library used is https://github.com/milo/github-api + milo/github-api#24. |
I'd say only show the last one per arch. |
|
Oops, right. How's this? |
|
Looks good to me :) |
|
Yeah, thx a lot, seems to work fine. |
Tested on mac and linux. (x86_64)
|
OK, I've fixed the script. It now works on my mac and on a Ubuntu server too! |
|
rename |
|
@wilzbach @kinke @CyberShadow I'm happy with it, it works well for me. Good to merge? |
|
Yep, lgtm now. |
PetarKirov
left a comment
There was a problem hiding this comment.
Looks good to me, nice work everyone!
|
The script needs manual deployment as it needs to be signed, but I just did so. d: ldc-latest-ci |
|
Also, I forgot to say thanks to everyone involved in this effort! @JohanEngelen @kinke you might want to open a thread in the NG, s.t. people know about this and actually enable it in their CIs. |
This PR installs ldc-nightly in e.g. "ldc-8c0abd52-20171222"
(DMD installs nightlies in e.g. "dmd-master-2017-12-27")
LDC does not have a LATEST_NIGHTLY file online, so I opted for just downloading the nightlies release page and grepping for what the binary package name should look like.
Tested on OSX.