Skip to content

Commit ed9da46

Browse files
mcolpusMatthew Colpus
andauthored
Fix Prevent S3 global option when using custom endpoints (#5779)
Signed-off-by: Matthew Colpus <mpcolpus@gmail.com> Co-authored-by: Matthew Colpus <mpcolpus@gmail.com>
1 parent 6a81c01 commit ed9da46

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

modules/nextflow/src/main/groovy/nextflow/processor/TaskConfig.groovy

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import static nextflow.processor.TaskProcessor.*
2121
import java.nio.file.Path
2222

2323
import groovy.transform.CompileStatic
24+
import groovy.util.logging.Slf4j
2425
import nextflow.Const
2526
import nextflow.ast.NextflowDSLImpl
2627
import nextflow.exception.AbortOperationException
@@ -40,6 +41,7 @@ import nextflow.util.MemoryUnit
4041
*
4142
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
4243
*/
44+
@Slf4j
4345
@CompileStatic
4446
class TaskConfig extends LazyMap implements Cloneable {
4547

@@ -392,10 +394,14 @@ class TaskConfig extends LazyMap implements Cloneable {
392394
for( String it : shell ) {
393395
if( !it )
394396
throw new IllegalArgumentException("Directive `process.shell` cannot contain empty values - offending value: ${shell}")
395-
if( !it || it.contains('\n') || it.contains('\r') )
396-
throw new IllegalArgumentException("Directive `process.shell` cannot contain new-line characters - offending value: ${shell}")
397-
if( it.startsWith(' ') || it.endsWith(' '))
398-
throw new IllegalArgumentException("Directive `process.shell` cannot contain leading or tralining blanks - offending value: ${shell}")
397+
if( !it || it.contains('\n') || it.contains('\r') ) {
398+
log.warn1 "Directive `process.shell` cannot contain new-line characters - offending value: ${shell}"
399+
break
400+
}
401+
if( it.startsWith(' ') || it.endsWith(' ')) {
402+
log.warn "Directive `process.shell` cannot contain leading or tralining blanks - offending value: ${shell}"
403+
break
404+
}
399405
}
400406
return shell
401407
}

modules/nextflow/src/test/groovy/nextflow/processor/TaskConfigTest.groovy

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -684,14 +684,14 @@ class TaskConfigTest extends Specification {
684684
then:
685685
thrown(IllegalArgumentException)
686686

687-
when:
688-
config.validateShell(['bash\nthis\nthat'])
689-
then:
690-
thrown(IllegalArgumentException)
691-
692-
when:
693-
config.validateShell(['bash', ' -eu '])
694-
then:
695-
thrown(IllegalArgumentException)
687+
// when:
688+
// config.validateShell(['bash\nthis\nthat'])
689+
// then:
690+
// thrown(IllegalArgumentException)
691+
//
692+
// when:
693+
// config.validateShell(['bash', ' -eu '])
694+
// then:
695+
// thrown(IllegalArgumentException)
696696
}
697697
}

plugins/nf-amazon/src/main/nextflow/cloud/aws/nio/S3FileSystemProvider.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,10 @@ protected S3FileSystem createFileSystem(URI uri, AwsConfig awsConfig) {
835835
ClientConfiguration clientConfig = createClientConfig(props);
836836

837837
final String bucketName = S3Path.bucketName(uri);
838-
final boolean global = bucketName!=null;
838+
// do not use `global` flag for custom endpoint because
839+
// when enabling that flag, it overrides S3 endpoints with AWS global endpoint
840+
// see https://github.com/nextflow-io/nextflow/pull/5779
841+
final boolean global = bucketName!=null && !awsConfig.getS3Config().isCustomEndpoint();
839842
final AwsClientFactory factory = new AwsClientFactory(awsConfig, globalRegion(awsConfig));
840843
client = new S3Client(factory.getS3Client(clientConfig, global));
841844

0 commit comments

Comments
 (0)