Skip to content

Commit 7943044

Browse files
authored
Merge branch 'main' into doc/blog-introduction
2 parents 5d97de7 + a652d4e commit 7943044

File tree

367 files changed

+6228
-6512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+6228
-6512
lines changed

.github/workflows/continuous-integration.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
with:
2323
fetch-depth: 1
2424
ref: ${{ github.event.pull_request.head.ref }}
25+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2526

2627
- name: "Setup java"
2728
uses: actions/setup-java@v4
@@ -31,7 +32,7 @@ jobs:
3132
cache: 'maven'
3233

3334
- name: "REUSE Compliance Check"
34-
uses: fsfe/reuse-action@v4
35+
uses: fsfe/reuse-action@v5
3536

3637
- name: "Format code"
3738
run: |
@@ -71,7 +72,7 @@ jobs:
7172
7273
- name: "Slack Notification"
7374
if: ${{ github.ref == 'refs/heads/main' && failure() }}
74-
uses: slackapi/slack-github-action@v1.27.0
75+
uses: slackapi/slack-github-action@v2.0.0
7576
with:
7677
payload: |
7778
{
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Test SAP Cloud SDK Versions
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
8+
JAVA_VERSION: 17
9+
10+
jobs:
11+
fetch-dependency-versions:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
versions: ${{ steps.fetch-versions.outputs.VERSIONS }}
15+
16+
steps:
17+
- name: Fetch versions from Maven Central
18+
id: fetch-versions
19+
run: |
20+
# Specify the dependency coordinates
21+
GROUP_ID="com.sap.cloud.sdk"
22+
ARTIFACT_ID="sdk-bom"
23+
24+
# Fetch available versions from Maven Central API
25+
response=$(curl -s "https://search.maven.org/solrsearch/select?q=g:%22${GROUP_ID}%22+AND+a:%22${ARTIFACT_ID}%22&rows=15&core=gav&wt=json")
26+
27+
# Extract and filter versions (e.g., to exclude snapshots or specific versions)
28+
versions=$(echo "$response" | jq -r '.response.docs[].v' | grep -v -E 'SNAPSHOT|alpha|beta' | sort -V)
29+
30+
# Convert the versions to a JSON array
31+
json_versions=$(echo "$versions" | jq -R . | jq -s . | tr -d '\n')
32+
33+
echo "JSON Versions: $json_versions"
34+
35+
# Output the versions as a string that can be used in the matrix
36+
echo "VERSIONS=${json_versions}" >> $GITHUB_OUTPUT
37+
38+
setup-environment:
39+
runs-on: ubuntu-latest
40+
outputs:
41+
cache-key: ${{ steps.cache-build.outputs.cache-key }}
42+
steps:
43+
- name: "Checkout repository"
44+
uses: actions/checkout@v4
45+
46+
- name: "Setup java"
47+
uses: actions/setup-java@v4
48+
with:
49+
distribution: "temurin"
50+
java-version: ${{ env.JAVA_VERSION }}
51+
cache: 'maven'
52+
53+
- name: "Cache build"
54+
id: cache-build
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.m2/repository
59+
target
60+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
61+
restore-keys: |
62+
${{ runner.os }}-maven-
63+
64+
- name: "Build SDK"
65+
run: |
66+
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} clean install -DskipTests -DskipFormatting"
67+
mvn $MVN_ARGS
68+
69+
test-dependency-versions:
70+
needs: [ fetch-dependency-versions, setup-environment ]
71+
runs-on: ubuntu-latest
72+
strategy:
73+
max-parallel: 1
74+
fail-fast: false
75+
matrix:
76+
version: ${{ fromJson(needs.fetch-dependency-versions.outputs.versions) }}
77+
continue-on-error: true
78+
steps:
79+
- name: "Checkout repository"
80+
uses: actions/checkout@v4
81+
82+
- name: "Setup java"
83+
uses: actions/setup-java@v4
84+
with:
85+
distribution: "temurin"
86+
java-version: ${{ env.JAVA_VERSION }}
87+
cache: 'maven'
88+
89+
- name: "Restore build cache"
90+
uses: actions/cache@v4
91+
with:
92+
path: |
93+
~/.m2/repository
94+
target
95+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
96+
97+
- name: "Run tests with explicit version"
98+
run: |
99+
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} clean package -pl :spring-app -DskipTests=false -DskipFormatting -Dcloud-sdk.version=${{ matrix.version }} -Denforcer.skip=true -Dspotless.skip=true"
100+
mvn $MVN_ARGS
101+
env:
102+
# See "End-to-end test application instructions" on the README.md to update the secret
103+
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
104+
105+
- name: "Start Application Locally"
106+
run: |
107+
cd sample-code/spring-app
108+
mvn spring-boot:run &
109+
timeout=15
110+
while ! nc -z localhost 8080; do
111+
sleep 1
112+
timeout=$((timeout - 1))
113+
if [ $timeout -le 0 ]; then
114+
echo "Server did not start within 15 seconds."
115+
exit 1
116+
fi
117+
done
118+
env:
119+
# See "End-to-end test application instructions" on the README.md to update the secret
120+
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
121+
122+
- name: "Health Check"
123+
# print response body with headers to stdout. q:body only O:print -:stdout S:headers
124+
run: wget -qO- -S localhost:8080

.github/workflows/e2e-test.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ name: "End-to-end Tests"
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: 0 22 * * *
5+
- cron: 15 2 * * MON-FRI
66

77
env:
88
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
99
JAVA_VERSION: 17
1010

1111
jobs:
12-
1312
end-to-end-tests:
14-
# https://wiki.one.int.sap/wiki/display/DevFw/SUGAR
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
environment: [ canary, production ]
17+
exclude:
18+
- environment: production
19+
# secret-name: AI_CORE_PRODUCTION
20+
include:
21+
- environment: canary
22+
secret-name: AI_CORE_CANARY
1523
runs-on: ubuntu-latest
1624
steps:
1725

@@ -33,10 +41,10 @@ jobs:
3341
- name: "Run tests"
3442
run: |
3543
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} surefire:test -pl :spring-app -DskipTests=false"
36-
mvn $MVN_ARGS
44+
mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}"
3745
env:
3846
# See "End-to-end test application instructions" on the README.md to update the secret
39-
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
47+
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
4048

4149
- name: "Start Application Locally"
4250
run: |
@@ -53,15 +61,15 @@ jobs:
5361
done
5462
env:
5563
# See "End-to-end test application instructions" on the README.md to update the secret
56-
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
64+
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
5765

5866
- name: "Health Check"
5967
# print response body with headers to stdout. q:body only O:print -:stdout S:headers
6068
run: wget -qO- -S localhost:8080
6169

6270
- name: "Slack Notification"
6371
if: failure()
64-
uses: slackapi/slack-github-action@v1.27.0
72+
uses: slackapi/slack-github-action@v2.0.0
6573
with:
6674
payload: |
6775
{

.github/workflows/fosstars-report.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ name: "Fosstars (Security)"
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: "0 0 * * *" # every day at midnight
5+
- cron: '42 03 * * MON-FRI' # 03:42 on weekdays, a somewhat random time to avoid producing load spikes on the GH actions infrastructure
66

77
env:
88
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
99
JAVA_VERSION: 17
10+
CVE_CACHE_KEY: cve-db
11+
CVE_CACHE_DIR: ~/.m2/repository/org/owasp/dependency-check-data
12+
CVE_CACHE_REF: refs/heads/main
1013

1114
jobs:
1215
create_fosstars_report:
@@ -23,25 +26,49 @@ jobs:
2326
java-version: ${{ env.JAVA_VERSION }}
2427
cache: 'maven'
2528

29+
- name: Restore CVE Database
30+
uses: actions/cache/restore@v4
31+
with:
32+
path: ${{ env.CVE_CACHE_DIR }}
33+
key: ${{ env.CVE_CACHE_KEY }}
34+
# fail-on-cache-miss: true
35+
2636
- name: "Build SDK"
2737
run: |
2838
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} clean install -DskipTests -DskipFormatting"
2939
mvn $MVN_ARGS
3040
31-
- name: "OWASP Dependency check"
32-
run: mvn org.owasp:dependency-check-maven:10.0.4:check -DnvdApiKey=$NVD_API_KEY -DfailBuildOnCVSS=7 -DskipProvidedScope=true -DsuppressionFile=.pipeline/dependency-check-suppression.xml
33-
env:
34-
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
35-
36-
- name: "Fosstars rating"
41+
- name: "Fosstars Rating"
3742
3843
with:
3944
report-branch: fosstars-report
4045
token: ${{ secrets.GITHUB_TOKEN }}
4146

47+
- name: "CVE Scan"
48+
env:
49+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
50+
run: |
51+
mvn -T1 --no-transfer-progress dependency-check:check
52+
53+
- name: Delete Old CVE Cache
54+
run: |
55+
CACHE_IDS=$(gh cache list --key "${{ env.CVE_CACHE_KEY }}" --ref "${{ env.CVE_CACHE_REF }}" --json id | jq -r '.[] | .id')
56+
for CACHE_ID in $CACHE_IDS; do
57+
echo "Deleting cache with ID: $CACHE_ID"
58+
gh cache delete "${CACHE_ID}"
59+
done
60+
env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Create Updated CVE Cache
64+
uses: actions/cache/save@v4
65+
with:
66+
path: ${{ env.CVE_CACHE_DIR }}
67+
key: ${{ env.CVE_CACHE_KEY }}
68+
4269
- name: "Slack Notification"
4370
if: failure()
44-
uses: slackapi/slack-github-action@v1.27.0
71+
uses: slackapi/slack-github-action@v2.0.0
4572
with:
4673
payload: |
4774
{

.github/workflows/perform-release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ jobs:
8888
with:
8989
distribution: "sapmachine"
9090
java-version: ${{ env.JAVA_VERSION }}
91-
server-id: ossrh
92-
server-username: MAVEN_CENTRAL_USER # env variable for username in deploy
93-
server-password: MAVEN_CENTRAL_PASSWORD # env variable for token in deploy
9491

9592
- name: "Download Release Asset"
9693
id: download-asset
@@ -113,8 +110,8 @@ jobs:
113110
114111
- name: "Deploy"
115112
run: |
116-
MVN_ARGS="${{ env.MVN_CLI_ARGS }} deploy -Drelease -s settings.xml"
117-
mvn $MVN_ARGS
113+
MVN_ARGS="${{ env.MVN_CLI_ARGS }} -Drelease -s settings.xml"
114+
mvn deploy $MVN_ARGS
118115
env:
119116
MAVEN_GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
120117

.github/workflows/prepare-release.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ jobs:
5959
git add .
6060
git commit -m "Update to version ${{ steps.determine-versions.outputs.RELEASE_VERSION }}"
6161
62+
# Create release notes
63+
python .pipeline/scripts/release_notes_automation.py --version ${{ steps.determine-versions.outputs.RELEASE_VERSION }} --folder "docs/release-notes"
64+
git add .
65+
git commit -m "Add new release notes"
66+
6267
# We need to get the commit id, and push the branch so the release tag will point at the right commit afterwards
6368
RELEASE_COMMIT_ID=$(git log -1 --pretty=format:"%H")
6469
echo "RELEASE_COMMIT_ID=$RELEASE_COMMIT_ID" >> $GITHUB_OUTPUT
@@ -135,11 +140,16 @@ jobs:
135140
git config --global user.email "[email protected]"
136141
git config --global user.name "SAP Cloud SDK Bot"
137142
138-
- name: "Set New Version"
143+
- name: "Set New Version and Reset Release Notes"
139144
run: |
140145
python .pipeline/scripts/set-release-versions.py --version ${{ needs.bump-version.outputs.new-version }}
141146
git add .
142147
git commit -m "Update to version ${{ needs.bump-version.outputs.new-version }}"
148+
149+
# Reset release notes for next version
150+
cp .pipeline/scripts/release_notes_template.md docs/release-notes/release_notes.md
151+
git add docs/release-notes/release_notes.md
152+
git commit -m "Reset release notes"
143153
git push
144154
145155
- name: "Create Code PR"
@@ -148,7 +158,6 @@ jobs:
148158
149159
PR_URL=$(gh pr create --title "Release ${{ needs.bump-version.outputs.release-version }}" --body "## TODOs
150160
- [ ] Review the changes in [the release commit]($COMMIT_URL)
151-
- [ ] Update the Release notes
152161
- [ ] Review the [Draft Release](${{ needs.create-release.outputs.release-url }})
153162
- [ ] Review **and approve** this PR
154163
- [ ] Trigger the [Perform Release Workflow](${{ github.event.repository.html_url }}/actions/workflows/perform-release.yml)

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@
2626
.java-version
2727

2828
### Environment ###
29-
*.env
29+
*.env
30+
31+
.openapi-generator

.pipeline/checkstyle-suppressions.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<suppressions>
88
<!-- Suppress generated clients -->
99
<suppress files="[/\\]core[/\\]client[/\\]" checks=".*"/>
10-
<suppress files="[/\\]orchestration[/\\]client[/\\]" checks=".*"/>
10+
<suppress files="[/\\]core[/\\]model[/\\]" checks=".*"/>
11+
<suppress files="[/\\]orchestration[/\\]model[/\\]" checks=".*"/>
1112
<!-- Suppress TODOs -->
1213
<suppress files="OpenAiChatCompletionParameters.java" checks="TodoComment" lines="95" />
1314
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="255,271" />

0 commit comments

Comments
 (0)