Skip to content

Conversation

@sugmanue
Copy link
Contributor

@sugmanue sugmanue commented Aug 15, 2023

Motivation and Context

After adding the new http-auth-aws dependency this is needed by almost all but one service, codecatalyst which uses an bearer auth scheme and thus does not need to depend on this package. To bootstrap new services that might also need to opt-out of pulling this dependency this change adds to the commands

  • software.amazon.awssdk.release.CreateNewServiceModuleMain
  • software.amazon.awssdk.release.NewServiceMain

New, multivalued switches that can be used to either remove default dependencies or to add unlisted ones.

  • include-internal-dependency
  • exclude-internal-dependency

Behavior

By default the default internal dependencies will be added:

 ./mvnw exec:java -pl :release-scripts -Dexec.mainClass="software.amazon.awssdk.release.CreateNewServiceModuleMain" \
     -Dexec.args="--maven-project-root '.' \
                  --maven-project-version 2.20.125-SNAPSHOT
                  --service-id 'FooBar' \
                  --service-module-name foobar
                  --service-protocol json"

Yields the following services/foobar/pom.xml (notice http-auth-aws is added by default)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    ⋯ <!-- skipped for brevity -->
    <dependencies>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>protocol-core</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>aws-json-protocol</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>http-auth-aws</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
    </dependencies>
</project>

Default internal dependencies can be excluded:

 ./mvnw exec:java -pl :release-scripts -Dexec.mainClass="software.amazon.awssdk.release.CreateNewServiceModuleMain" \
     -Dexec.args="--maven-project-root '.' \
                  --maven-project-version 2.20.125-SNAPSHOT
                  --service-id 'FooBar' \
                  --service-module-name foobar
                  --service-protocol json
                  --exclude-internal-dependency http-auth-aws"

Yields the following services/foobar/pom.xml (notice http-auth-aws is not added)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    ⋯ <!-- skipped for brevity -->
    <dependencies>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>protocol-core</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>aws-json-protocol</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
    </dependencies>
</project>

Other internal dependencies can be included:

 ./mvnw exec:java -pl :release-scripts -Dexec.mainClass="software.amazon.awssdk.release.CreateNewServiceModuleMain" \
     -Dexec.args="--maven-project-root '.' \
                  --maven-project-version 2.20.125-SNAPSHOT
                  --service-id 'FooBar' \
                  --service-module-name foobar
                  --service-protocol json
                  --include-internal-dependency http-auth-aws-crt"

Yields the following services/foobar/pom.xml (notice http-auth-aws is added and so is http-auth-aws-crt)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    ⋯ <!-- skipped for brevity -->
    <dependencies>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>protocol-core</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>aws-json-protocol</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>http-auth-aws</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>http-auth-aws-crt</artifactId>
            <version>${awsjavasdk.version}</version>
        </dependency>
    </dependencies>
</project>

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@sugmanue sugmanue requested a review from a team as a code owner August 15, 2023 21:10
@sugmanue sugmanue requested a review from zoewangg August 15, 2023 21:13
@sugmanue sugmanue mentioned this pull request Aug 15, 2023
12 tasks
@sugmanue sugmanue force-pushed the sugmanue/sra-ia-add-new-services-dependencies branch from 339c959 to 80d5400 Compare August 15, 2023 22:05
*/
public class CreateNewServiceModuleMain extends Cli {

private static final Set<String> DEFAULT_INTERNAL_DEPENDENCIES = toSet("http-auth-aws");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some Javadoc to mention this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@sugmanue sugmanue merged commit 198a9d3 into feature/master/sra-identity-auth Aug 16, 2023
@sugmanue sugmanue deleted the sugmanue/sra-ia-add-new-services-dependencies branch August 16, 2023 20:02
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 236 Code Smells

0.0% 0.0% Coverage
3.1% 3.1% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants