-
Notifications
You must be signed in to change notification settings - Fork 75
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
ETCM-[165, 166]: Publish the RLP and Crypto libraries to Sonatype. #933
Conversation
3b8eabd
to
cd00d63
Compare
@KonradStaniec can you add the required credentials to the build? I don't know the values. |
It would be nice if the |
Apparently we should try to get a Mantis specific Sonatype account and PGP key. |
9498ccb
to
036bbab
Compare
@dzajkowski @KonradStaniec this should be ready for approval now. |
315c36d
to
3c65f87
Compare
@KonradStaniec kindly reminded me that we'd need this published for Scala 2.13 as well as 2.12, which I completely forgot. |
2c8a991
to
6706024
Compare
ETCM-165: Accept SNAPSHOT in version number sent in Hello. ETCM-165: Wait for unit tests before publishing. ETCM-165: Check if the GPG key already exists. ETCM-165: Update GPG. ETCM-165: Try restarting the gpg agent.
6706024
to
c66af51
Compare
I wonder how nix likes cross building. In any case I noticed that my PR has a |
if [[ "$GPG_EXISTS" == "no" ]]; then | ||
echo "$GPG_KEY" | base64 --decode | gpg --batch --import | ||
fi | ||
# Local testing showed that without this the SBT plugin got "Bad passphrase". |
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 turns out it's because without this the --pinentry-mode loopback
doesn't work. When I removed that from the command the plugin printed, and tried it in the console, it worked with the --passphrase
flag, so it's not an issue of surrounding with '
or having a bad password.
|
||
function releaseAll { | ||
release 2.12.10 1.4.5 | ||
release 2.13.4 1.4.7 |
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 this duplication with build.sbt will come back to bite us....
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 shouldn't be too hard to move more of this logic into sbt.
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.
You'd think so, right! I spent hours trying to figure out with a code like this:
scapegoatVersion in ThisBuild := (scalaBinaryVersion.value match {
case "2.12" => "1.4.5"
case "2.13" => println("Still 2.13"); "1.4.7"
})
I start sbt
, type ++ 2.12.10
and see "Still 2.13" printed every time, then I type scalaBinaryVersion
and it says 2.12.10
, really frustrating.
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.
If you want to give it a go, you should be able to try wit sbt +compile
for example (or at least sbt +publishLocal
), the +
should trigger cross building, and then it fails because it tries to grab the 1.4.7 version for 2.12.10, even when I moved the scapegoatVersion
under node
.
If I removed in ThisBuild
then it wants to grab 1.0.0. No idea what I'm missing, this should work.
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.
Thanks for aligning with build changes!
Description
Add steps to the CI pipeline to publish the
mantis-rlp
andmantis-crypto
artifacts to Sonatype so they can be reused in other projects.On the
develop
branch, the version is expected to be-SNAPSHOT
, so it can overwrite previous versions.On the
master
branch the version is set to release by removing-SNAPSHOT
, so it can only be released once.After that it's expected that
develop
should have a bump in version, but that's currently not part of the automation.Proposed Solution
This is based of what we're currently doing in
scalanet
: instead of a version file I added aversion.sbt
file which could be used by sbt-release to bump and commit a new version, as described here, but currently it's just updated from thepublish.sh
script for the release, it's not committed and pushed back to Github. See the SBT guide for the Sonatype settings.Ended up using this plugin: https://github.com/olafurpg/sbt-ci-release
What needs to be published is set int the
publish.sh
script using environment variables used by the plugin.Its default assumption is that it will do a release if the build is tagged in git, and push a snapshot if it's just a normal commit. Tagging is faked in the publish script at the moment, but if the release strategy were to change, it would be easy to modify it that way.
To make it work we added the following environment variables to the build:
GPG_KEY
: GPG key used to sign the published artifacts, in Base64 format (see thesbt-ci-release
plugin for the command to produce it)GPG_KEY_ID
: ID of the GPG key, to tell the SBT plugin which key to useGPG_PASSPHRASE
: Pass phrase to import the GPG keyOSS_USERNAME
: Sonatype usernameOSS_PASSWORD
: Sonatype passwordImportant Changes Introduced
Added
-SNAPSHOT
to the version, which is stored inversion.sbt
.Testing
I temporarily left the name of this branch as a conditional, which resulted in the
SNAPSHOT
versions being published.See the logs on Buildkite.