Skip to content

Commit b5135c9

Browse files
authored
chore: update v2 (#1409)
1 parent 50e7b56 commit b5135c9

File tree

39 files changed

+1161
-285
lines changed

39 files changed

+1161
-285
lines changed

.github/workflows/auto-merge.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
runs-on: ubuntu-latest
1818
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' && github.actor == 'dependabot[bot]'
1919
steps:
20-
- uses: actions/checkout@v3
21-
- uses: ahmadnassri/action-workflow-run-wait@v1
20+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
- uses: ahmadnassri/action-workflow-run-wait@2aa3d9e1a12ecaaa9908e368eaf2123bb084323e # v1.4.4
2222
with:
2323
timeout: 300000
2424
- name: 'Download artifact'
25-
uses: actions/[email protected]
25+
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # v3.1.0
2626
with:
2727
script: |
2828
var artifacts = await github.actions.listWorkflowRunArtifacts({
@@ -43,7 +43,7 @@ jobs:
4343
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
4444
- run: unzip pr.zip
4545
- name: Create review
46-
uses: actions/github-script@v3
46+
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # v3.1.0
4747
with:
4848
script: |
4949
var fs = require('fs');

.github/workflows/build-docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
docs:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
2626
- name: Set up Python
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
2828
with:
2929
python-version: "3.8"
3030
- name: Capture branch and tag

.github/workflows/build.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,22 @@ jobs:
5454
JAVA: ${{ matrix.java }}
5555
AWS_REGION: eu-west-1
5656
steps:
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
5858
- name: Setup java
59-
uses: actions/setup-java@v3
59+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
6060
with:
6161
distribution: 'corretto'
6262
java-version: ${{ matrix.java }}
6363
cache: 'maven'
6464
- name: Build with Maven
6565
run: mvn -B install --file pom.xml
66+
- name: Build Gradle Example
67+
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
68+
run: |
69+
cd examples/powertools-examples-core-utilities/gradle
70+
./gradlew build
6671
- name: Upload coverage to Codecov
67-
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # 3.1.1
72+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
6873
if: ${{ matrix.java == '11' }} # publish results once
6974
with:
7075
files: ./powertools-cloudformation/target/site/jacoco/jacoco.xml,./powertools-core/target/site/jacoco/jacoco.xml,./powertools-idempotency/target/site/jacoco/jacoco.xml,./powertools-logging/target/site/jacoco/jacoco.xml,./powertools-metrics/target/site/jacoco/jacoco.xml,./powertools-parameters/target/site/jacoco/jacoco.xml,./powertools-serialization/target/site/jacoco/jacoco.xml,./powertools-sqs/target/site/jacoco/jacoco.xml,./powertools-tracing/target/site/jacoco/jacoco.xml,./powertools-validation/target/site/jacoco/jacoco.xml
@@ -78,7 +83,7 @@ jobs:
7883
mkdir -p ./pr
7984
echo ${{ github.event.number }}
8085
echo ${{ github.event.number }} > ./pr/NR
81-
- uses: actions/upload-artifact@v2
86+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
8287
name: Upload artifact
8388
with:
8489
name: pr

.github/workflows/dispatch_analytics.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
environment: analytics
3030
steps:
3131
- name: Configure AWS credentials
32-
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
32+
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
3333
with:
3434
aws-region: eu-central-1
3535
role-to-assume: ${{ secrets.AWS_ANALYTICS_ROLE_ARN }}

.github/workflows/docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
runs-on: ubuntu-latest
1717
environment: Docs
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
2020
- name: Set up Python
21-
uses: actions/setup-python@v4
21+
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
2222
with:
2323
python-version: "3.8"
2424
- name: Capture branch and tag

.github/workflows/publish.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1212
- name: Set up Maven Central Repository
13-
uses: actions/setup-java@v2
13+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
1414
with:
15-
distribution: 'zulu'
15+
distribution: 'corretto'
1616
java-version: 8
1717
server-id: ossrh
1818
server-username: MAVEN_USERNAME
1919
server-password: MAVEN_PASSWORD
20+
# TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
2021
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
2122
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
2223
- name: Set release notes tag
@@ -30,7 +31,7 @@ jobs:
3031
MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
3132
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3233
- name: Close issues related to this release
33-
uses: actions/github-script@v5
34+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
3435
with:
3536
script: |
3637
const post_release = require('.github/workflows/post_release.js')

.github/workflows/release-drafter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
update_release_draft:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: release-drafter/release-drafter@v5
13+
- uses: release-drafter/release-drafter@569eb7ee3a85817ab916c8f8ff03a5bd96c9c83e # v5.23.0
1414
env:
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-prep.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1414
- name: Get current date
1515
id: date
1616
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
1717
- name: Set current release version env variable
1818
run: |
1919
echo "CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
2020
- name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in mkdocs.yml
21-
uses: jacobtomlinson/gha-find-replace@v2
21+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
2222
with:
2323
find: 'version: ${{ env.CURRENT_VERSION }}'
2424
replace: 'version: ${{ github.event.inputs.targetRelease }}'
2525
regex: false
2626
include: "mkdocs.yml"
2727
- name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in main pom.xml
28-
uses: jacobtomlinson/gha-find-replace@v2
28+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
2929
with:
3030
find: ${{ env.CURRENT_VERSION }}
3131
replace: ${{ github.event.inputs.targetRelease }}
3232
regex: false
3333
include: "pom.xml"
3434
- name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in modules pom.xml
35-
uses: jacobtomlinson/gha-find-replace@v2
35+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
3636
with:
3737
find: ${{ env.CURRENT_VERSION }}
3838
replace: ${{ github.event.inputs.targetRelease }}
3939
regex: false
4040
include: "**/*pom.xml"
4141
- name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in build.gradle
42-
uses: jacobtomlinson/gha-find-replace@v2
42+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
4343
with:
4444
find: ${{ env.CURRENT_VERSION }}
4545
replace: ${{ github.event.inputs.targetRelease }}
4646
regex: false
4747
include: "**/*build.gradle"
4848
- name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in README.md
49-
uses: jacobtomlinson/gha-find-replace@v2
49+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
5050
with:
5151
find: ${{ env.CURRENT_VERSION }}
5252
replace: ${{ github.event.inputs.targetRelease }}
5353
regex: false
5454
include: "README.md"
5555
- name: Create changelog placeholder for ${{ github.event.inputs.targetRelease }}
56-
uses: jacobtomlinson/gha-find-replace@v2
56+
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3 # v2.0.0
5757
with:
5858
find: '## [Unreleased]'
5959
replace: |
@@ -66,7 +66,7 @@ jobs:
6666
regex: false
6767
include: CHANGELOG.md
6868
- name: Create Release Pull Request
69-
uses: peter-evans/create-pull-request@v3
69+
uses: peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672 # v3.14.0
7070
with:
7171
commit-message: chore:prep release ${{ github.event.inputs.targetRelease }}
7272
token: ${{ secrets.RELEASE }}

.github/workflows/run-e2e-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ jobs:
4141
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
4242
contents: read
4343
steps:
44-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
4545
- name: Setup java
46-
uses: actions/setup-java@v3
46+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
4747
with:
4848
distribution: 'corretto'
4949
java-version: ${{ matrix.java }}
5050
cache: maven
5151
- name: Setup AWS credentials
52-
uses: aws-actions/configure-aws-credentials@v1.6.1
52+
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
5353
with:
5454
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
5555
aws-region: ${{ env.AWS_DEFAULT_REGION }}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lockdown untrusted workflows
2+
3+
# PROCESS
4+
#
5+
# 1. Scans for any external GitHub Action being used without version pinning (@<commit-sha> vs @v3)
6+
# 2. Scans for insecure practices for inline bash scripts (shellcheck)
7+
# 3. Fail CI and prevent PRs to be merged if any malpractice is found
8+
9+
# USAGE
10+
#
11+
# Always triggered on new PR, PR changes and PR merge.
12+
13+
14+
on:
15+
push:
16+
paths:
17+
- ".github/workflows/**"
18+
pull_request:
19+
paths:
20+
- ".github/workflows/**"
21+
22+
jobs:
23+
enforce_pinned_workflows:
24+
name: Harden Security
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read # checkout code and subsequently GitHub action workflows
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
31+
- name: Ensure 3rd party workflows have SHA pinned
32+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@555a30da2656b4a7cf47b107800bef097723363e # v2.1.3

.github/workflows/spotbugs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
codecheck:
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
2727
- name: Setup java JDK 1.8
28-
uses: actions/setup-java@v2
28+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
2929
with:
30-
distribution: 'zulu'
30+
distribution: 'corretto'
3131
java-version: 8
3232
# https://github.com/jwgmeligmeyling/spotbugs-github-action/issues/6
3333
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ example/HelloWorldFunction/.gradle
107107
example/HelloWorldFunction/build
108108
/example/.gradle/
109109
/example/.java-version
110+
.gradle
111+
build/

README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,18 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
132132
<summary><b>Gradle - Java 11+</b></summary>
133133

134134
```groovy
135+
135136
plugins {
136137
id 'java'
137-
id 'io.freefair.aspectj.post-compile-weaving' version '8.1.0'
138+
id 'io.freefair.aspectj.post-compile-weaving' version '8.2.2'
138139
}
139140
141+
// the freefair aspect plugins targets gradle 8.2.1
142+
// https://docs.freefair.io/gradle-plugins/8.2.2/reference/
143+
wrapper {
144+
gradleVersion = "8.2.1"
145+
}
146+
140147
repositories {
141148
mavenCentral()
142149
}
@@ -145,6 +152,7 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
145152
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
146153
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
147154
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
155+
implementation "org.aspectj:aspectjrt:1.9.8.RC3"
148156
}
149157
150158
sourceCompatibility = 11
@@ -161,6 +169,12 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
161169
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
162170
}
163171
172+
// the freefair aspect plugins targets gradle 7.6.1
173+
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
174+
wrapper {
175+
gradleVersion = "7.6.1"
176+
}
177+
164178
repositories {
165179
mavenCentral()
166180
}
@@ -178,7 +192,7 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
178192

179193
## Examples
180194

181-
See the **[examples](examples)** directory for example projects showcasing usage of different utilities.
195+
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.17.0/examples)** for example projects showcasing usage of different utilities.
182196

183197
Have a demo project to contribute which showcase usage of different utilities from powertools? We are happy to accept it [here](CONTRIBUTING.md#security-issue-notifications).
184198

docs/index.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,17 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
211211
=== "Gradle Java 11+"
212212

213213
```groovy
214+
214215
plugins {
215216
id 'java'
216-
id 'io.freefair.aspectj.post-compile-weaving' version '8.1.0'
217+
id 'io.freefair.aspectj.post-compile-weaving' version '8.2.2'
217218
}
219+
220+
// the freefair aspect plugins targets gradle 8.2.1
221+
// https://docs.freefair.io/gradle-plugins/8.2.2/reference/
222+
wrapper {
223+
gradleVersion = "8.2.1"
224+
}
218225
219226
repositories {
220227
mavenCentral()
@@ -233,10 +240,18 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
233240
=== "Gradle Java 1.8"
234241

235242
```groovy
243+
236244
plugins {
237245
id 'java'
238246
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
239247
}
248+
249+
// the freefair aspect plugins targets gradle 7.6.1
250+
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
251+
wrapper {
252+
gradleVersion = "7.6.1"
253+
}
254+
240255
241256
repositories {
242257
mavenCentral()

examples/pom.xml

+12-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,17 @@
4040
<module>powertools-examples-cloudformation</module>
4141
</modules>
4242

43-
<!-- Don't deploy the examples -->
44-
<properties>
45-
<maven.deploy.skip>true</maven.deploy.skip>
46-
</properties>
43+
<build>
44+
<plugins>
45+
<!-- Don't deploy the examples -->
46+
<plugin>
47+
<groupId>org.apache.maven.plugins</groupId>
48+
<artifactId>maven-deploy-plugin</artifactId>
49+
<configuration>
50+
<skip>true</skip>
51+
</configuration>
52+
</plugin>
53+
</plugins>
54+
</build>
4755

4856
</project>

0 commit comments

Comments
 (0)