Last active
June 29, 2019 23:21
-
-
Save mateor/b8875d36fa8190afef7056c3ce77ccd0 to your computer and use it in GitHub Desktop.
Pantsbuild: Configure Ivy to publish jars to s3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/build-support/ivy/publish.ivysettings.xml | |
+++ b/build-support/ivy/publish.ivysettings.xml | |
@@ -14,13 +14,22 @@ Licensed under the Apache License, Version 2.0 (see LICENSE). | |
<properties file="${user.home}/.gnupg/pgp.properties"/> | |
<settings defaultResolver="main" /> | |
+ <!-- | |
+ Custom s3resolver to allow pushing published artifacts directly to an s3 bucket | |
+ Credentials are loaded from default AWS location, ~/.aws/credentials. | |
+ --> | |
+ <typedef name="s3resolver" classname="co.actioniq.ivy.s3.S3URLResolver"/> | |
<resolvers> | |
+ <s3resolver | |
+ name="my.maven.repo" | |
+ root="s3://my.maven.repo/repositories/maven-s3" | |
+ signer="pgp"/> | |
+ /> | |
--- a/build-support/ivy/ivy.xml | |
+++ b/build-support/ivy/ivy.xml | |
@@ -18,9 +18,13 @@ Licensed under the Apache License, Version 2.0 (see LICENSE). | |
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.1"/> | |
+ <!-- enable custom ivy resolver that can read/write to s3 | |
+ --> | |
+ <dependency org="co.actioniq" name="s3-ivy-resolver" rev="0.5"/> | |
+ | |
<!-- support for the pgp signer --> | |
<dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45"/> | |
mateo-2:2 mateo$ git diff origin/master build-support/*xmln *ini | |
diff --git a/pants-internal.ini b/pants-internal.ini | |
index a5e6ba2cb2f..db3f9d9dcdd 100644 | |
--- a/pants.ini | |
+++ b/pants.ini | |
[ivy] | |
ivy_profile: %(pants_supportdir)s/ivy/ivy.xml | |
+ | |
[publish.jar] | |
ivy_settings: %(pants_supportdir)s/ivy/publish.ivysettings.xml | |
repos = { | |
+ 's3_maven_repo': { | |
+ 'resolver': 'my.maven.repo', | |
+ 'help': 'Credentials are read from ~/.aws/credentials', | |
+ }, | |
} | |
+ | |
--- a/register.py | |
+++ b/register.py | |
+s3_publish_root = "my.maven.repo") | |
+ | |
+s3_maven_repo = Repository( | |
+ name='s3_maven_repo', | |
+ url="https://{}/repositories/maven_s3".format(s3_publish_root), | |
+ push_db_basedir=PUSHDB_PATH, | |
+) | |
+ | |
def build_file_aliases(): | |
return BuildFileAliases( | |
@@ -89,6 +101,7 @@ def build_file_aliases(): | |
+ 's3_maven_repo': s3_maven_repo, | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A third party implemented the S3 ivy resolver library. The code is no longer on Github - but they did publish sources jars to Maven, which is how I stepped through the API:
https://repo1.maven.org/maven2/co/actioniq/s3-ivy-resolver/0.5/
Thanks y'all!