diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-06-10 10:14:28 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-06-10 10:33:50 +0200 |
commit | 4887894ffd637030a311ca8d60b78515b1a5cf35 (patch) | |
tree | a890edb80b54f5c5078a10b938b37f04ee12edca /org.eclipse.jgit.lfs.server | |
parent | 629fa260c03a54cac35836010df34b565d13fe85 (diff) | |
parent | 0ec6e4b3d5becf0025dcf83e8b843c9c34043ba0 (diff) | |
download | jgit-4887894ffd637030a311ca8d60b78515b1a5cf35.tar.gz jgit-4887894ffd637030a311ca8d60b78515b1a5cf35.zip |
Merge branch 'master' into next
* master:
SimpleMergeTest: Clean up code style
Prepare 5.8.1-SNAPSHOT builds
Handle Fragment-Host declaration when updating version
JGit v5.8.0.202006091008-r
Prepare 5.9.0-SNAPSHOT builds
Handle Fragment-Host declaration when updating version
Add benchmark for strategies how to move a file
Add getter for unpackErrorHandler in ReceivePack
Upgrade maven-project-info-reports-plugin to 3.1.0
Upgrade maven-shade-plugin to 3.2.4
ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
ObjectDirectoryInserter: Remove redundant 'throws' declarations
ObjectDirectory: Further clean up insertUnpackedObject
Add Git#shutdown for releasing resources held by JGit process
ApplyCommand: use context lines to determine hunk location
GPG: don't prompt for a passphrase for unprotected keys
Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST
Fix ProtectedMembersInFinalClass warning flagged by error prone
Use version range to define fragment host bundle version
ObjectDirectory: Explicitly handle NoSuchFileException
ObjectDirectory: Fail immediately when atomic move is not supported
Fix jgit packaging
Fix InvalidInlineTag error flagged by error prone
Fix BadComparable error flagged by error prone
Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash()
Update Orbit to R20200529191137 for final Eclipse release 2020-06
Organize manifest of org.eclipse.jgit.pgm
Do not include log4j implementation in jgit
Decouple JSch from JGit Core
Decouple BouncyCastle from JGit Core
Verify that the user home directory is valid
WindowCache: conditional JMX setup
RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace
Revert "PackBitmapIndex: Not buffer inflated bitmap in
BasePackBitmapIndex"
Update jetty to 9.4.28.v20200408
Add 4.16 staging target platform
In-memory SSH keys for the "no files" sshd tests
Builder API to configure SshdSessionFactories
TransportHttp: abort on time-out or on SocketException
Ignore core.eol if core.autocrlf=input
Attributes: fix handling of text=auto in combination with eol
Bazel: Remove superfluous dependencies flagged by unused_deps
Log stack trace if CachingKeyPairProvider hits unexpected exception
Update Orbit to S20200519202422 and ant to 1.10.8
Include full IssuerFingerprint in GPG signature
Bazel: Fix src_sha1 of bcpg-jdk15on
Suppress API error for new method
BitmapIndex.Bitmap#retrieveCompressed
Fix wrong @since tags added in dcb0265
PackBitmapIndex: Set distance threshold
PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex
PackBitmapIndex: Remove convertedBitmaps in the Remapper
PackBitmapIndex: Reduce memory usage in GC
PackBitmapIndex: Add AddToBitmapWithCacheFilter class
PackBitmapIndex: Add util methods and builder to BitmapCommit
PackBitmapIndex: Move BitmapCommit to a top-level class
Refactor: Make retriveCompressed an method of the Bitmap class
Fix downloading LFS Object fails behind proxy
Allow for using custom s3 host with lfs server
ReceivePack: adding IterativeConnectivityChecker
Moving transport/internal -> internal/transport
Fix error occurring during checkout
Change-Id: Ic11286e16ed6a72c6372297b310336dd040689d1
Diffstat (limited to 'org.eclipse.jgit.lfs.server')
4 files changed, 53 insertions, 4 deletions
diff --git a/org.eclipse.jgit.lfs.server/resources/org/eclipse/jgit/lfs/server/internal/LfsServerText.properties b/org.eclipse.jgit.lfs.server/resources/org/eclipse/jgit/lfs/server/internal/LfsServerText.properties index 659714528c..911cdcf125 100644 --- a/org.eclipse.jgit.lfs.server/resources/org/eclipse/jgit/lfs/server/internal/LfsServerText.properties +++ b/org.eclipse.jgit.lfs.server/resources/org/eclipse/jgit/lfs/server/internal/LfsServerText.properties @@ -4,6 +4,7 @@ objectNotFound=Object ''{0}'' not found undefinedS3AccessKey=S3 configuration: 'accessKey' is undefined undefinedS3Bucket=S3 configuration: 'bucket' is undefined undefinedS3Region=S3 configuration: 'region' is undefined +undefinedS3Hostname=S3 configuration: 'hostname' is undefined undefinedS3SecretKey=S3 configuration: 'secretKey' is undefined undefinedS3StorageClass=S3 configuration: 'storageClass' is undefined unparsableEndpoint=Unable to parse service endpoint: {0} diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/internal/LfsServerText.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/internal/LfsServerText.java index bed485f605..56d59bb540 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/internal/LfsServerText.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/internal/LfsServerText.java @@ -33,6 +33,7 @@ public class LfsServerText extends TranslationBundle { /***/ public String undefinedS3AccessKey; /***/ public String undefinedS3Bucket; /***/ public String undefinedS3Region; + /***/ public String undefinedS3Hostname; /***/ public String undefinedS3SecretKey; /***/ public String undefinedS3StorageClass; /***/ public String unparsableEndpoint; diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Config.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Config.java index f3dd2781c8..3942e22a8e 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Config.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Config.java @@ -16,6 +16,7 @@ package org.eclipse.jgit.lfs.server.s3; * @since 4.3 */ public class S3Config { + private final String hostname; private final String region; private final String bucket; private final String storageClass; @@ -25,8 +26,12 @@ public class S3Config { private final boolean disableSslVerify; /** - * <p>Constructor for S3Config.</p> + * <p> + * Constructor for S3Config. + * </p> * + * @param hostname + * S3 API host * @param region * AWS region * @param bucket @@ -43,10 +48,12 @@ public class S3Config { * @param disableSslVerify * if {@code true} disable Amazon server certificate and hostname * verification + * @since 5.8 */ - public S3Config(String region, String bucket, String storageClass, + public S3Config(String hostname, String region, String bucket, String storageClass, String accessKey, String secretKey, int expirationSeconds, boolean disableSslVerify) { + this.hostname = hostname; this.region = region; this.bucket = bucket; this.storageClass = storageClass; @@ -57,6 +64,44 @@ public class S3Config { } /** + * <p>Constructor for S3Config.</p> + * + * @param region + * AWS region + * @param bucket + * S3 storage bucket + * @param storageClass + * S3 storage class + * @param accessKey + * access key for authenticating to AWS + * @param secretKey + * secret key for authenticating to AWS + * @param expirationSeconds + * period in seconds after which requests signed for this bucket + * will expire + * @param disableSslVerify + * if {@code true} disable Amazon server certificate and hostname + * verification + */ + public S3Config(String region, String bucket, String storageClass, + String accessKey, String secretKey, int expirationSeconds, + boolean disableSslVerify) { + this(String.format("s3-%s.amazonaws.com", region), region, bucket, //$NON-NLS-1$ + storageClass, accessKey, secretKey, expirationSeconds, + disableSslVerify); + } + + /** + * Get the <code>hostname</code>. + * + * @return Get the S3 API host + * @since 5.8 + */ + public String getHostname() { + return hostname; + } + + /** * Get the <code>region</code>. * * @return Get name of AWS region this bucket resides in diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java index bd1705b827..c7c7a7146b 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java @@ -159,6 +159,8 @@ public class S3Repository implements LargeFileRepository { config.getBucket()); assertNotEmpty(LfsServerText.get().undefinedS3Region, config.getRegion()); + assertNotEmpty(LfsServerText.get().undefinedS3Hostname, + config.getHostname()); assertNotEmpty(LfsServerText.get().undefinedS3SecretKey, config.getSecretKey()); assertNotEmpty(LfsServerText.get().undefinedS3StorageClass, @@ -173,8 +175,8 @@ public class S3Repository implements LargeFileRepository { private URL getObjectUrl(AnyLongObjectId oid) { try { - return new URL(String.format("https://s3-%s.amazonaws.com/%s/%s", //$NON-NLS-1$ - s3Config.getRegion(), s3Config.getBucket(), + return new URL(String.format("https://%s/%s/%s", //$NON-NLS-1$ + s3Config.getHostname(), s3Config.getBucket(), getPath(oid))); } catch (MalformedURLException e) { throw new IllegalArgumentException(MessageFormat.format( |