From 43e1784bfc75e8924b622e0d383a942208748c48 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 14 Jun 2024 08:57:20 +0200 Subject: [PATCH 01/16] Initial commit --- .github/workflows/publish-v2-snapshot.yml | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/publish-v2-snapshot.yml diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml new file mode 100644 index 000000000..d3c86c3f3 --- /dev/null +++ b/.github/workflows/publish-v2-snapshot.yml @@ -0,0 +1,32 @@ +name: Publish v2 snapshots to the Maven Central repository. Runs on merge to v2. +on: + pull_request: + branches: + - v2 + push: + branches: + - v2 + - + workflow_dispatch: {} +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Set up Maven Central Repository + uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0 + with: + distribution: 'corretto' + java-version: 11 + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + # TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment + gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import + gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase + - name: Publish package + run: mvn -Prelease clean deploy -DskipTests + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} + MAVEN_PASSWORD: fail_because_this_is_wrong + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} From 79a6ee871e5bd2bdcf995408ceceddbaa9a9ce77 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 14 Jun 2024 09:38:11 +0200 Subject: [PATCH 02/16] Add distributionManagement back --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index b24608f06..dd6741272 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,13 @@ ${maven.multiModuleProjectDirectory} + + + ossrh + https://aws.oss.sonatype.org/content/repositories/snapshots + + + From 127ed82fcce71aa8b80c86e6cf8e34fef6f1434d Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 14 Jun 2024 10:43:10 +0200 Subject: [PATCH 03/16] Switch to environment variables --- .github/workflows/publish-v2-snapshot.yml | 1 + .github/workflows/publish.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index d3c86c3f3..246c6477f 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -11,6 +11,7 @@ on: jobs: publish: runs-on: ubuntu-latest + environment: snapshot steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up Maven Central Repository diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 03f04e0f4..d2d47b308 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,8 +27,8 @@ jobs: - name: Publish package run: mvn -Prelease clean deploy -DskipTests env: - MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.SNAPSHOT_PUBLISH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_PUBLISH_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - name: Close issues related to this release uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 From 2780ab0ae040e471018eb5fed46845c0b7a9399a Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 12:44:11 +0200 Subject: [PATCH 04/16] Enforcer should work --- .github/workflows/publish-v2-snapshot.yml | 4 +- pom.xml | 38 +++++++++++++++---- .../dynamodb-local-metadata.json | 1 + 3 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 powertools-idempotency/powertools-idempotency-dynamodb/dynamodb-local-metadata.json diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index 246c6477f..32b198790 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -20,13 +20,11 @@ jobs: distribution: 'corretto' java-version: 11 server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD # TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Publish package - run: mvn -Prelease clean deploy -DskipTests + run: mvn -Prelease clean validate deploy -DskipTests # We use validate here to run maven enforcer, to make sure we are only publishing SNAPSHOT builds env: MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} MAVEN_PASSWORD: fail_because_this_is_wrong diff --git a/pom.xml b/pom.xml index dd6741272..2a80203fc 100644 --- a/pom.xml +++ b/pom.xml @@ -466,23 +466,45 @@ org.apache.maven.plugins - maven-gpg-plugin + maven-enforcer-plugin + 3.5.0 - sign-artifacts - verify + enforce-snapshot-versions + validate - sign + enforce - - --pinentry-mode - loopback - + + + Release build should not have snapshot dependencies! + + + true + + + + + + + + + + + + + + + + + + + org.apache.maven.plugins maven-source-plugin diff --git a/powertools-idempotency/powertools-idempotency-dynamodb/dynamodb-local-metadata.json b/powertools-idempotency/powertools-idempotency-dynamodb/dynamodb-local-metadata.json new file mode 100644 index 000000000..c76c2c76d --- /dev/null +++ b/powertools-idempotency/powertools-idempotency-dynamodb/dynamodb-local-metadata.json @@ -0,0 +1 @@ +{"installationId":"e43b8515-8484-485c-8315-bead4568972b","telemetryEnabled":"true"} \ No newline at end of file From 5990f73f0eba2399cbd650fd60660a17042581a4 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 12:49:56 +0200 Subject: [PATCH 05/16] Re-enable GPG --- pom.xml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 2a80203fc..26d846198 100644 --- a/pom.xml +++ b/pom.xml @@ -486,25 +486,25 @@ - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + org.apache.maven.plugins maven-source-plugin From 7ea6f147258d447920a2442fd2916f6df7cc3a4e Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 12:56:57 +0200 Subject: [PATCH 06/16] Change user/password for publish --- .github/workflows/publish-v2-snapshot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index 32b198790..ef21fbfe0 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -26,6 +26,6 @@ jobs: - name: Publish package run: mvn -Prelease clean validate deploy -DskipTests # We use validate here to run maven enforcer, to make sure we are only publishing SNAPSHOT builds env: - MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} - MAVEN_PASSWORD: fail_because_this_is_wrong + MAVEN_USERNAME: ${{ secrets.SNAPSHOT_PUBLISH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_PUBLISH_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} From b707ca4ecfab4070fa86a56f5e75f9e7be491793 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 13:34:15 +0200 Subject: [PATCH 07/16] Missing config? --- .github/workflows/publish-v2-snapshot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index ef21fbfe0..8c2d92253 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -20,6 +20,8 @@ jobs: distribution: 'corretto' java-version: 11 server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD # TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase From b36e724190e2301b439c25d21437519d8b466f98 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 13:38:29 +0200 Subject: [PATCH 08/16] Skip SAM example for deploy --- examples/powertools-examples-core-utilities/sam/pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/powertools-examples-core-utilities/sam/pom.xml b/examples/powertools-examples-core-utilities/sam/pom.xml index 75821f851..86fa52425 100644 --- a/examples/powertools-examples-core-utilities/sam/pom.xml +++ b/examples/powertools-examples-core-utilities/sam/pom.xml @@ -113,6 +113,15 @@ + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.2 + + true + + From d55f4e73e14022cc684eb0673082749291ed70c0 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 13:41:57 +0200 Subject: [PATCH 09/16] Another missing one --- .../serverless/pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/powertools-examples-core-utilities/serverless/pom.xml b/examples/powertools-examples-core-utilities/serverless/pom.xml index a83050b0a..0b5b06152 100644 --- a/examples/powertools-examples-core-utilities/serverless/pom.xml +++ b/examples/powertools-examples-core-utilities/serverless/pom.xml @@ -114,6 +114,15 @@ + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.2 + + true + + From b5a95b75a5d38b1ca01dda69227a80496f1422be Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 18 Jun 2024 14:07:51 +0200 Subject: [PATCH 10/16] Publish preview docs --- .github/workflows/docs-v2-snapshot.yml | 43 +++++++++++++++++++++++ .github/workflows/publish-v2-snapshot.yml | 1 - 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs-v2-snapshot.yml diff --git a/.github/workflows/docs-v2-snapshot.yml b/.github/workflows/docs-v2-snapshot.yml new file mode 100644 index 000000000..a985d9e3e --- /dev/null +++ b/.github/workflows/docs-v2-snapshot.yml @@ -0,0 +1,43 @@ +name: Docs +on: + pull_request: + branches: + - v2 + push: + branches: + - v2 + workflow_dispatch: {} + +permissions: + id-token: write + contents: write + pages: write + +jobs: + docs: + runs-on: ubuntu-latest + environment: Docs + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Set up Python + uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1 + with: + python-version: "3.8" + - name: Capture branch and tag + id: branch_name + run: | + echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Build docs website + run: | + make build-docs-website + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }} + - name: Deploy Docs + run: | + aws s3 sync \ + dist \ + s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-java/preview/ diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index 8c2d92253..539313d09 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -6,7 +6,6 @@ on: push: branches: - v2 - - workflow_dispatch: {} jobs: publish: From 60a3fecf89571854e1746e503daeadd5aae54f90 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Thu, 20 Jun 2024 08:58:08 +0200 Subject: [PATCH 11/16] Update docs accordingly --- .github/workflows/publish-v2-snapshot.yml | 2 +- docs/index.md | 8 +++++++- mkdocs.yml | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index 539313d09..98fdfa5c6 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -1,4 +1,4 @@ -name: Publish v2 snapshots to the Maven Central repository. Runs on merge to v2. +name: Publish v2 on: pull_request: branches: diff --git a/docs/index.md b/docs/index.md index 06c9beb6d..1c5dfac85 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,7 +3,13 @@ title: Homepage description: Powertools for AWS Lambda (Java) --- -![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900) ![Build status](https://github.com/aws-powertools/powertools-lambda-java/actions/workflows/build.yml/badge.svg) ![Maven Central](https://img.shields.io/maven-central/v/software.amazon.lambda/powertools-parent) +![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900) ![Build status](https://github.com/aws-powertools/powertools-lambda-java/actions/workflows/publish-v2-snapshot.yml/badge.svg) ![Maven Central](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Faws.oss.sonatype.org%2Fcontent%2Frepositories%2Fsnapshots%2Fsoftware%2Famazon%2Flambda%2Fpowertools-parent%2Fmaven-metadata.xml +) + +???+ warning + You are browsing the documentation for Powertools for AWS Lambda (Java) - v2. This is a snapshot release and not stable! + Check out our stable [v1](https://docs.powertools.aws.dev/lambda/java/) documentation if this is not what you wanted. + The v2 maven snapshot repository can be found [here](https://aws.oss.sonatype.org/content/repositories/snapshots/software/amazon/lambda/) . Powertools for AWS Lambda (Java) is a suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier. diff --git a/mkdocs.yml b/mkdocs.yml index b7f793e18..aa7b0e314 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ -site_name: Powertools for AWS Lambda (Java) -site_description: Powertools for AWS Lambda (Java) +site_name: Powertools for AWS Lambda (Java) Preview +site_description: Powertools for AWS Lambda (Java) Preview site_author: Amazon Web Services site_url: https://docs.powertools.aws.dev/lambda-java/ nav: @@ -85,7 +85,7 @@ extra_javascript: extra: powertools: - version: 2.0.0 # to update after each release (we do not want snapshot version here) + version: 2.0.0-SNAPSHOT repo_url: https://github.com/aws-powertools/powertools-lambda-java edit_uri: edit/main/docs From 1c99c337c5bd486bc08c9967f6910855d1502f3b Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Thu, 20 Jun 2024 09:07:23 +0200 Subject: [PATCH 12/16] Exclude intentional constructor throw from spotbugs --- spotbugs-exclude.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index a4eb3756f..58b22e141 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -8,6 +8,12 @@ https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html --> + + + + + + From 0505a81fef03d7d50a317ffb40e2db1b6772030a Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Thu, 20 Jun 2024 09:11:43 +0200 Subject: [PATCH 13/16] More new spotbugs? --- spotbugs-exclude.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 58b22e141..9cb5bab54 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -12,6 +12,13 @@ + + + + + + + From 776d7ce5297059f11257711651ed2066a309de2d Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Thu, 20 Jun 2024 09:20:56 +0200 Subject: [PATCH 14/16] Block new spotbugs rules --- spotbugs-exclude.xml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 9cb5bab54..ee44f7b4d 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -8,19 +8,22 @@ https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html --> + - - - - - - - + + + + + + + + From 8658d709491976c1e1ce553da73baab3c0a9e948 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Mon, 24 Jun 2024 09:25:31 +0200 Subject: [PATCH 15/16] Remove PR push triggers --- .github/workflows/docs-v2-snapshot.yml | 3 --- .github/workflows/publish-v2-snapshot.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/docs-v2-snapshot.yml b/.github/workflows/docs-v2-snapshot.yml index a985d9e3e..02e1fcf63 100644 --- a/.github/workflows/docs-v2-snapshot.yml +++ b/.github/workflows/docs-v2-snapshot.yml @@ -3,9 +3,6 @@ on: pull_request: branches: - v2 - push: - branches: - - v2 workflow_dispatch: {} permissions: diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index 98fdfa5c6..be77a2f77 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -3,9 +3,6 @@ on: pull_request: branches: - v2 - push: - branches: - - v2 workflow_dispatch: {} jobs: publish: From 1ce10834c8f41fa069055279a274eda884554cd7 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Mon, 24 Jun 2024 09:27:43 +0200 Subject: [PATCH 16/16] Again but properly --- .github/workflows/docs-v2-snapshot.yml | 2 +- .github/workflows/publish-v2-snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-v2-snapshot.yml b/.github/workflows/docs-v2-snapshot.yml index 02e1fcf63..55803c737 100644 --- a/.github/workflows/docs-v2-snapshot.yml +++ b/.github/workflows/docs-v2-snapshot.yml @@ -1,6 +1,6 @@ name: Docs on: - pull_request: + push: branches: - v2 workflow_dispatch: {} diff --git a/.github/workflows/publish-v2-snapshot.yml b/.github/workflows/publish-v2-snapshot.yml index be77a2f77..d5a683261 100644 --- a/.github/workflows/publish-v2-snapshot.yml +++ b/.github/workflows/publish-v2-snapshot.yml @@ -1,6 +1,6 @@ name: Publish v2 on: - pull_request: + push: branches: - v2 workflow_dispatch: {}