-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Simplify CI builds #3084
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
Simplify CI builds #3084
Conversation
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.
How does the publishing relate to groups? Will all tests run and then the publishing? Or will it be "in the group" in some way?
Otherwise LGTM, and happy to see the new drone functionality get in so we can throw away the matrix build
project/scripts/sbt
Outdated
SHOULD_RUN=true | ||
CMD="$1" | ||
|
||
if [ -z "$CMD" ]; 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.
Nitpick, this should be:
if [ -z ${CMD+x} ]; then
otherwise you can pass empty string here and it will accept it as valid input.
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.
My understanding is that it is the other way around:
> FOO=""; if test -z ${FOO+x}; then echo "Empty"; else echo "Full"; fi
Full
> FOO=""; if test -z "$FOO"; then echo "Empty"; else echo "Full"; fi
Empty
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.
Maybe I wasn't clear - you're testing if the variable FOO
is empty string - instead of testing if the variable is set at all. E.g. setting FOO=""
versus not setting it at all
:)
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.
But seriously though, nitpick 😛
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 want the script to exit if the variable is not set or if it is an empty string. An empty cmd should be reject IMO. With -z "$CMD"
, it rejects both cases.
project/scripts/sbtPublish
Outdated
# PGP Credentials: | ||
PGP_PW=$4 | ||
# Usage: | ||
# SONATYPE_USER=<sonatype user> SONATYPE_PW=<sonatype pw> PGP_PW=<pgp pw> ./sbtPublish <publish cmd> |
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.
👍
Unfortunately there seems to be a major issue. The builds in the same group run in parallel but they share the same workspace... So they fail 😭 |
Yeah, this was our original fear with the matrix builds as well - but turns out that the matrix build actually separates things 😂 |
0f93cae
to
e68fdde
Compare
The ivy cache does not seem to be used anymore with this PR, in http://dotty-ci.epfl.ch/lampepfl/dotty/103/1/test everything gets downloaded. |
@smarter Good catch. I was trying to understand the slow down, this might be the cause |
project/scripts/sbt
Outdated
fi | ||
|
||
if [ $SHOULD_RUN = true ]; then | ||
# get the ivy2 cache: | ||
ln -s /var/cache/drone/ivy2 "$HOME/.ivy2" || true |
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.
@felixmulder What was || true
for?
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 think this was just there to allow ln
to fail, having a cache is not the most important thing to this script. It could definitely be removed, but we then loose the ability to test without /var/cache/drone/ivy2
being present - not a big deal I guess.
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 had the ln
command run as an initial step before the tests but it was not persisted between the steps and the CI started re-downloading artifacts. So I added it in all the CI scripts
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.
We used to have a common
script that was sourced from the other scripts - if there's too much duplication, you could consider doing something similar eventually.
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.
Note that ln
also fails if "$HOME/.ivy2" already exists, so I think you might get spurious error messages in the log upon running the script the second time on the same container.
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, true! That's exactly why, I remember now!
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 ln
survive multiple steps? Because I tried to do it once before all the steps, but then the CI would redownload artifacts: http://dotty-ci.epfl.ch/lampepfl/dotty/102
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 will experiment
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 doesn't seem so 🤔
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 does, however, survive within a single command
section, IIRC
@felixmulder Can you review again. I managed to solve the issue of shared workspace by running each instance of |
project/scripts/genDocs
Outdated
echo "Working directory: $PWD" | ||
|
||
# get the ivy2 cache | ||
ln -s /var/cache/drone/ivy2 "$HOME/.ivy2" |
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 a thought that popped up - does it make sense to do the release builds without the cache?
cc: @smarter
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 make sense to do the release builds without the cache?
I don't see in what situation that could make a difference?
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.
Corrupt cache causing issues with jars - that's why we chose to have it static rather than using the dynamic caching plugin. Other than that - I've got nothing :)
.drone.yml
Outdated
group: test | ||
image: lampepfl/dotty:2017-09-05 | ||
commands: | ||
- cp -R . /tmp/0/ && cd /tmp/0/ |
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 see you went for the shortest possible name here 😄
.drone.yml
Outdated
|
||
publish_nightly: | ||
image: lampepfl/dotty:2017-09-05 | ||
environment: | ||
- NIGHTLYBUILD=yes | ||
commands: | ||
- ./project/scripts/sbt ";clean ;publishLocal" "${CI_PUBLISH}" |
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.
publish
does not publishLocal
anymore. What was the reason for publishing locally here?
cc: @smarter @felixmulder
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.
IIRC something to do with testing the SBT integrations, but I'll defer to @smarter
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 don't think publishLocal has been necessary for anything in a long time.
project/scripts/sbtPublish
Outdated
CMD=" ;set credentials in ThisBuild := Seq(Credentials(\"Sonatype Nexus Repository Manager\", \"oss.sonatype.org\", \"$2\", \"$3\"))" | ||
CMD="$CMD ;set pgpPassphrase := Some(\"\"\"$4\"\"\".toCharArray)" | ||
CMD="$CMD ;set pgpSecretRing := file(\"/keys/secring.asc\")" | ||
CMD="$CMD ;set pgpPublicRing := file(\"/keys/pubring.asc\")" | ||
CMD="$CMD $RELEASE_CMD" | ||
|
||
# run sbt with the supplied arg | ||
sbt -J-Xmx4096m \ |
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.
Would be nice if there was less duplication between sbt and sbtPublish
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.
Stuff is still being downloaded: http://dotty-ci.epfl.ch/lampepfl/dotty/115/1/test
Also probably unrelated to this PR but the CI logs used to be in color, what happened to that? |
@smarter This happened also before this PR: http://dotty-ci.epfl.ch/lampepfl/dotty/116/3/test |
I see colored logs. Maybe an issue with Firefox? |
project/scripts/genDocs
Outdated
sbt -J-Xmx4096m \ | ||
-J-XX:ReservedCodeCacheSize=512m \ | ||
-J-XX:MaxMetaspaceSize=1024m \ | ||
-Ddotty.drone.mem=4096m \ |
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.
@felixmulder What is this option for?
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.
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.
Is it different than setting -J-Xmx4096m
?
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.
Got it. One is for the JVM running sbt and the other for the forked JVM for the tests
d012eea
to
44ea37e
Compare
@smarter I removed the duplication in the scripts. If this looks good to you, I am merging it |
project/scripts/sbt
Outdated
# run sbt with the supplied arg | ||
sbt -J-Xmx4096m \ | ||
-J-XX:ReservedCodeCacheSize=512m \ | ||
-J-XX:MaxMetaspaceSize=1024m \ | ||
-Ddotty.drone.mem=4096m "$CMD" | ||
-Ddotty.drone.mem=4096m \ |
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.
So we still use that thing?
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.
From what I understood, -J-Xmx4096m
is an option passed to the VM that run sbt
and Ddotty.drone.mem=4096m
will be passed to the forked VMs
project/scripts/sbt
Outdated
# run sbt with the supplied arg | ||
sbt -J-Xmx4096m \ | ||
-J-XX:ReservedCodeCacheSize=512m \ | ||
-J-XX:MaxMetaspaceSize=1024m \ | ||
-Ddotty.drone.mem=4096m "$CMD" | ||
-Ddotty.drone.mem=4096m \ | ||
-ivy /var/cache/drone/ivy2 \ |
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 this doesn't do what you think it does. This way you still download all the dependence needed for sbt itself...
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 sure about that. If you look at the CI test logs (except for test_bootstrapped), I don't see any download.
Would be good to make sure there is no speed loss by comparing master CI time and this branch CI time when nothing else is running. |
This reverts commit f04a1b6.
Nice option that prints the command executed in a script but it leaks secrets...
No thorough benchmark but this PR took 12 min to build when nothing else was running. Looking at the history of the builds, build time is rarely under 12min. |
This reverts commit c53bcbc.
This reverts commit 851c3c2.
No description provided.