Skip to content

Commit a93c938

Browse files
authored
Merge branch 'master' into fix-azure-low-priority-vm-deprecation
2 parents 9f9e8d5 + 9e9476f commit a93c938

File tree

5 files changed

+61
-54
lines changed

5 files changed

+61
-54
lines changed

docs/reference/config.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ The following settings are available:
428428
`azure.batch.pools.<name>.lowPriority`
429429
: Enable the use of low-priority VMs (default: `false`).
430430

431+
: :::{warning}
432+
As of September 30, 2025, Low Priority VMs will no longer be supported in Azure Batch accounts that use Batch Managed mode for pool allocation. You may continue to use this setting to configure Spot VMs in Batch accounts configured with User Subscription mode.
433+
:::
434+
431435
`azure.batch.pools.<name>.maxVmCount`
432436
: Specify the max of virtual machine when using auto scale option.
433437

plugins/nf-codecommit/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ dependencies {
3838
compileOnly 'org.pf4j:pf4j:3.12.0'
3939

4040
api ('javax.xml.bind:jaxb-api:2.4.0-b180830.0359')
41-
api ('com.amazonaws:aws-java-sdk-codecommit:1.12.777')
41+
api ('software.amazon.awssdk:codecommit:2.31.64')
42+
api ('software.amazon.awssdk:sso:2.31.64')
43+
api ('software.amazon.awssdk:ssooidc:2.31.64')
4244

4345
testImplementation(testFixtures(project(":nextflow")))
4446
testImplementation project(':nextflow')

plugins/nf-codecommit/src/main/nextflow/cloud/aws/codecommit/AwsCodeCommitCredentialProvider.groovy

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package nextflow.cloud.aws.codecommit
1818

19+
import software.amazon.awssdk.auth.credentials.AwsCredentials
20+
1921
import javax.crypto.Mac
2022

2123
/*
@@ -40,12 +42,11 @@ import java.security.MessageDigest
4042
import java.security.NoSuchAlgorithmException
4143
import java.text.SimpleDateFormat
4244

43-
import com.amazonaws.auth.AWSCredentials
44-
import com.amazonaws.auth.AWSCredentialsProvider
45-
import com.amazonaws.auth.AWSSessionCredentials
46-
import com.amazonaws.auth.AWSStaticCredentialsProvider
47-
import com.amazonaws.auth.BasicAWSCredentials
48-
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
45+
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
46+
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider
47+
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
48+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
49+
import software.amazon.awssdk.auth.credentials.AwsSessionCredentials
4950
import groovy.transform.CompileStatic
5051
import groovy.util.logging.Slf4j
5152
import nextflow.exception.AbortOperationException
@@ -201,23 +202,23 @@ final class AwsCodeCommitCredentialProvider extends CredentialsProvider {
201202
}
202203

203204
/**
204-
* Get the AWSCredentials. If an AWSCredentialProvider was specified, use that,
205-
* otherwise, create a new AWSCredentialsProvider. If the username and password are
206-
* provided, use those directly as AWSCredentials. Otherwise, use the
207-
* {@link DefaultAWSCredentialsProviderChain} as is standard with AWS applications.
205+
* Get the AWSCredentials. If an AwsCredentialProvider was specified, use that,
206+
* otherwise, create a new AwsCredentialsProvider. If the username and password are
207+
* provided, use those directly as AwsCredentials. Otherwise, use the
208+
* {@link DefaultCredentialsProvider} as is standard with AWS applications.
208209
* @return the AWS credentials.
209210
*/
210-
private AWSCredentials retrieveAwsCredentials() {
211-
AWSCredentialsProvider credsProvider
211+
private AwsCredentials retrieveAwsCredentials() {
212+
AwsCredentialsProvider credsProvider
212213
if ( username && password ) {
213214
log.debug "Creating a static AWS credentials provider"
214-
credsProvider = new AWSStaticCredentialsProvider( new BasicAWSCredentials( username, password ))
215+
credsProvider = StaticCredentialsProvider.create( AwsBasicCredentials.create(username,password) )
215216
}
216217
else {
217218
log.debug "Creating a default AWS credentials provider chain"
218-
credsProvider = new DefaultAWSCredentialsProviderChain()
219+
credsProvider = DefaultCredentialsProvider.builder().build()
219220
}
220-
return credsProvider.getCredentials()
221+
return credsProvider.resolveCredentials()
221222
}
222223

223224
/**
@@ -260,14 +261,14 @@ final class AwsCodeCommitCredentialProvider extends CredentialsProvider {
260261
String awsSecretKey
261262

262263
try {
263-
AWSCredentials awsCredentials = retrieveAwsCredentials()
264+
AwsCredentials awsCredentials = retrieveAwsCredentials()
264265
StringBuilder awsKey = new StringBuilder();
265-
awsKey.append(awsCredentials.getAWSAccessKeyId());
266-
awsSecretKey = awsCredentials.getAWSSecretKey();
267-
if (awsCredentials instanceof AWSSessionCredentials) {
268-
AWSSessionCredentials sessionCreds = (AWSSessionCredentials) awsCredentials;
269-
if ( sessionCreds.getSessionToken() ) {
270-
awsKey.append('%').append(sessionCreds.getSessionToken())
266+
awsKey.append(awsCredentials.accessKeyId());
267+
awsSecretKey = awsCredentials.secretAccessKey();
268+
if (awsCredentials instanceof AwsSessionCredentials) {
269+
AwsSessionCredentials sessionCreds = (AwsSessionCredentials) awsCredentials;
270+
if ( sessionCreds.sessionToken() ) {
271+
awsKey.append('%').append(sessionCreds.sessionToken())
271272
}
272273
}
273274
awsAccessKey = awsKey.toString()
@@ -322,7 +323,7 @@ final class AwsCodeCommitCredentialProvider extends CredentialsProvider {
322323
/**
323324
* @param awsCredentialProvider the awsCredentialProvider to set
324325
*/
325-
void setAwsCredentialsProvider(AWSCredentialsProvider awsCredentialsProvider) {
326+
void setAwsCredentialsProvider(AwsCredentialsProvider awsCredentialsProvider) {
326327
this.awsCredentialsProvider = awsCredentialsProvider
327328
}
328329

plugins/nf-codecommit/src/main/nextflow/cloud/aws/codecommit/AwsCodeCommitRepositoryProvider.groovy

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
package nextflow.cloud.aws.codecommit
1818

19-
import com.amazonaws.SdkClientException
20-
import com.amazonaws.auth.AWSStaticCredentialsProvider
21-
import com.amazonaws.auth.BasicAWSCredentials
22-
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
23-
import com.amazonaws.services.codecommit.AWSCodeCommit
24-
import com.amazonaws.services.codecommit.AWSCodeCommitClientBuilder
25-
import com.amazonaws.services.codecommit.model.AWSCodeCommitException
26-
import com.amazonaws.services.codecommit.model.GetFileRequest
27-
import com.amazonaws.services.codecommit.model.GetRepositoryRequest
28-
import com.amazonaws.services.codecommit.model.RepositoryMetadata
19+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
20+
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider
21+
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
22+
import software.amazon.awssdk.core.exception.SdkException
23+
import software.amazon.awssdk.regions.Region
24+
import software.amazon.awssdk.services.codecommit.CodeCommitClient
25+
import software.amazon.awssdk.services.codecommit.model.CodeCommitException
26+
import software.amazon.awssdk.services.codecommit.model.GetFileRequest
27+
import software.amazon.awssdk.services.codecommit.model.GetRepositoryRequest
28+
import software.amazon.awssdk.services.codecommit.model.RepositoryMetadata
2929
import groovy.transform.CompileStatic
3030
import groovy.transform.Memoized
3131
import groovy.util.logging.Slf4j
@@ -56,22 +56,21 @@ class AwsCodeCommitRepositoryProvider extends RepositoryProvider {
5656
}
5757

5858
private String region
59-
private AWSCodeCommit client
59+
private CodeCommitClient client
6060
private String repositoryName
6161

6262

63-
protected AWSCodeCommit createClient(AwsCodeCommitProviderConfig config) {
64-
final builder = AWSCodeCommitClientBuilder
65-
.standard()
66-
.withRegion(region)
63+
protected CodeCommitClient createClient(AwsCodeCommitProviderConfig config) {
64+
final builder = CodeCommitClient.builder()
65+
.region(Region.of(region))
6766
if( config.user && config.password ) {
68-
final creds = new BasicAWSCredentials(config.user, config.password)
67+
final creds = AwsBasicCredentials.create(config.user, config.password)
6968
log.debug "AWS CodeCommit using username=$config.user; password=${StringUtils.redact(config.password)}"
70-
builder.withCredentials( new AWSStaticCredentialsProvider(creds) )
69+
builder.credentialsProvider( StaticCredentialsProvider.create(creds) )
7170
}
7271
else {
7372
log.debug "AWS CodeCommit using default credentials chain"
74-
builder.withCredentials( new DefaultAWSCredentialsProviderChain() )
73+
builder.credentialsProvider( DefaultCredentialsProvider.builder().build() )
7574
}
7675
builder.build()
7776
}
@@ -84,12 +83,13 @@ class AwsCodeCommitRepositoryProvider extends RepositoryProvider {
8483
}
8584

8685
private RepositoryMetadata getRepositoryMetadata() {
87-
final request = new GetRepositoryRequest()
88-
.withRepositoryName(repositoryName)
86+
final request = GetRepositoryRequest.builder()
87+
.repositoryName(repositoryName)
88+
.build()
8989

9090
return client
9191
.getRepository(request)
92-
.getRepositoryMetadata()
92+
.repositoryMetadata()
9393
}
9494

9595
/** {@inheritDoc} **/
@@ -136,16 +136,16 @@ class AwsCodeCommitRepositoryProvider extends RepositoryProvider {
136136
@Override
137137
byte[] readBytes( String path ) {
138138

139-
final request = new GetFileRequest()
140-
.withRepositoryName(repositoryName)
141-
.withFilePath(path)
139+
final builder = GetFileRequest.builder()
140+
.repositoryName(repositoryName)
141+
.filePath(path)
142142
if( revision )
143-
request.withCommitSpecifier(revision)
143+
builder.commitSpecifier(revision)
144144

145145
try {
146146
return client
147-
.getFile( request )
148-
.getFileContent()?.array()
147+
.getFile( builder.build() )
148+
.fileContent()?.asByteArray()
149149
}
150150
catch (Exception e) {
151151
checkMissingCredsException(e)
@@ -160,9 +160,9 @@ class AwsCodeCommitRepositoryProvider extends RepositoryProvider {
160160
"Unable to load AWS credentials",
161161
"The security token included in the request is invalid",
162162
"The request signature we calculated does not match the signature you provided"]
163-
if( e !instanceof SdkClientException )
163+
if( e !instanceof SdkException )
164164
return
165-
if( e instanceof AWSCodeCommitException && e.message?.startsWith("Could not find path") ) {
165+
if( e instanceof CodeCommitException && e.message?.startsWith("Could not find path") ) {
166166
// it cannot find the request file
167167
return
168168
}

plugins/nf-codecommit/src/test/nextflow/cloud/aws/codecommit/AwsCodeCommitRepositoryProviderTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import spock.lang.Specification
2626
* @author Paolo Di Tommaso <[email protected]>
2727
*/
2828
@IgnoreIf({System.getenv('NXF_SMOKE')})
29-
@Requires({System.getenv('AWS_ACCESS_KEY_ID') && System.getenv('AWS_SECRET_ACCESS_KEY')})
29+
//@Requires({System.getenv('AWS_ACCESS_KEY_ID') && System.getenv('AWS_SECRET_ACCESS_KEY')})
3030
class AwsCodeCommitRepositoryProviderTest extends Specification {
3131

3232
def 'should get repo url' () {

0 commit comments

Comments
 (0)