Skip to content

Commit 791ca20

Browse files
Merge branch 'develop' into custonActionError
2 parents 39bb0aa + 29b2e8d commit 791ca20

File tree

53 files changed

+5751
-1246
lines changed

Some content is hidden

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

53 files changed

+5751
-1246
lines changed

.github/scripts/review.js

Lines changed: 645 additions & 179 deletions
Large diffs are not rendered by default.

.github/workflows/cfdeploy.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
repository_id:
2121
description: 'Specify the Repository ID (leave blank if deploying to developcap)'
2222
required: false
23+
cds_services_version:
24+
description: 'Optional override for <cds.services.version> (e.g. 4.3.1). Leave blank to use existing value.'
25+
required: false
26+
default: ''
2327

2428
permissions:
2529
pull-requests: read
@@ -150,6 +154,24 @@ jobs:
150154
exit 1
151155
fi
152156
157+
- name: Override cds.services.version (runtime only)
158+
if: ${{ github.event.inputs.cds_services_version != '' }}
159+
env:
160+
TARGET_CDS_SERVICES_VERSION: ${{ github.event.inputs.cds_services_version }}
161+
run: |
162+
echo "Override requested: cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}"
163+
FILES=$(grep -Rl "<cds.services.version>" . | grep pom.xml || true)
164+
if [ -z "$FILES" ]; then
165+
echo "No pom.xml files with <cds.services.version> found" >&2; exit 1;
166+
fi
167+
echo "Updating files:"; echo "$FILES" | sed 's/^/ - /'
168+
for f in $FILES; do
169+
sed -i "s|<cds.services.version>[^<]*</cds.services.version>|<cds.services.version>${TARGET_CDS_SERVICES_VERSION}</cds.services.version>|" "$f"
170+
done
171+
echo "Post-update values:"; grep -R "<cds.services.version>" $FILES || true
172+
echo "(Not committing these changes)"
173+
shell: bash
174+
153175
- name: Deleting the sdm directory for fresh build ⚙️
154176
run: |
155177
echo "🔄 Deleting 'sdm' directory for fresh build..."

.github/workflows/gemini-pr-review.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
name: Gemini AI PR Reviewer
2-
32
on:
4-
pull_request:
5-
types: [opened, reopened, synchronize]
3+
# This triggers the bot only when a comment is created on an issue or pull request.
4+
issue_comment:
5+
types: [created]
66

77
jobs:
88
review:
9+
# Ensure this job only runs if the comment was made on a Pull Request
10+
if: github.event.issue.pull_request
911
runs-on: ubuntu-latest
1012
permissions:
1113
contents: read
1214
pull-requests: write
1315
steps:
1416
- name: Checkout repository
1517
uses: actions/checkout@v4
16-
1718
- name: Set up Node.js
1819
uses: actions/setup-node@v4
1920
with:
2021
node-version: '20'
21-
2222
- name: Install dependencies
23+
# Assuming your dependencies are in package.json. If not, this is fine.
2324
run: npm install @actions/github @google/generative-ai @octokit/core
24-
2525
- name: Run Gemini PR Review Script
2626
env:
2727
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Gemini AI Issue Summarizer
2+
3+
on:
4+
# This workflow now triggers when a new issue is opened
5+
issues:
6+
types: [opened]
7+
8+
jobs:
9+
summarize:
10+
# Ensure the job only runs for new issues and not from the bot itself
11+
if: github.event.issue.author.login != 'github-actions[bot]'
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
issues: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
26+
- name: Install dependencies
27+
run: npm install @actions/github @google/generative-ai @octokit/core
28+
29+
- name: Run Gemini Issue Summarizer Script
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
33+
run: node .github/scripts/review.js
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Internal Artifactory snapshot deploy
2+
3+
env:
4+
JAVA_VERSION: '17'
5+
MAVEN_VERSION: '3.6.3'
6+
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
7+
8+
on:
9+
workflow_dispatch:
10+
jobs:
11+
build-and-deploy-artifactory:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Java ${{ env.JAVA_VERSION }}
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: ${{ env.JAVA_VERSION }}
23+
distribution: sapmachine
24+
cache: maven
25+
server-id: artifactory
26+
server-username: CAP_DEPLOYMENT_USER
27+
server-password: CAP_DEPLOYMENT_PASS
28+
env:
29+
CAP_DEPLOYMENT_USER: ${{ secrets.CAP_DEPLOYMENT_USER }}
30+
CAP_DEPLOYMENT_PASS: ${{ secrets.CAP_DEPLOYMENT_PASS }}
31+
32+
- name: Set up Maven ${{ env.MAVEN_VERSION }}
33+
uses: stCarolas/setup-maven@v5
34+
with:
35+
maven-version: ${{ env.MAVEN_VERSION }}
36+
37+
- name: Read current revision
38+
id: read-revision
39+
run: |
40+
current_version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
41+
echo "Current version: $current_version"
42+
echo "revision=$current_version" >> $GITHUB_OUTPUT
43+
echo "updated_version=$current_version" >> $GITHUB_OUTPUT
44+
- name: Bump version if needed
45+
id: bump-version
46+
# if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/jenkins' }}
47+
run: |
48+
current_version="${{ steps.read-revision.outputs.revision }}"
49+
if [[ $current_version != *-SNAPSHOT ]]; then
50+
echo "Version lacks -SNAPSHOT; incrementing patch."
51+
IFS='.' read -r major minor patch <<< "$(echo $current_version | tr '-' '.')"
52+
new_patch=$((patch + 1))
53+
new_version="${major}.${minor}.${new_patch}-SNAPSHOT"
54+
sed -i "s|<revision>.*</revision>|<revision>${new_version}</revision>|" pom.xml
55+
echo "Updated version to $new_version"
56+
git config user.name github-actions
57+
git config user.email [email protected]
58+
git add pom.xml
59+
branch_name="${GITHUB_REF#refs/heads/}"
60+
git commit -m "Increment version to ${new_version}" || echo "No changes to commit"
61+
git push origin HEAD:"${branch_name}"
62+
else
63+
echo "Already a -SNAPSHOT version; no bump performed."
64+
fi
65+
updated_version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
66+
echo "updated_version=$updated_version" >> $GITHUB_OUTPUT
67+
# Manual settings.xml generation removed; using setup-java injected server credentials.
68+
69+
- name: Deploy snapshot to Artifactory
70+
if: ${{ endsWith(steps.bump-version.outputs.updated_version || steps.read-revision.outputs.updated_version, '-SNAPSHOT') }}
71+
run: |
72+
final_version="${{ steps.bump-version.outputs.updated_version || steps.read-revision.outputs.updated_version }}"
73+
echo "Deploying ${final_version} to Artifactory"
74+
mvn -B -ntp -fae \
75+
-Dmaven.install.skip=true -Dmaven.test.skip=true -DdeployAtEnd=true \
76+
-DaltDeploymentRepository=artifactory::${{ env.ARTIFACTORY_URL }} deploy
77+
env:
78+
CAP_DEPLOYMENT_USER: ${{ secrets.CAP_DEPLOYMENT_USER }}
79+
CAP_DEPLOYMENT_PASS: ${{ secrets.CAP_DEPLOYMENT_PASS }}
80+
81+
- name: Verify artifact in Artifactory
82+
if: ${{ endsWith(steps.bump-version.outputs.updated_version || steps.read-revision.outputs.updated_version, '-SNAPSHOT') }}
83+
run: |
84+
group_path="com/sap/cds/sdm"
85+
version="${{ steps.bump-version.outputs.updated_version || steps.read-revision.outputs.updated_version }}"
86+
echo "Checking metadata for $version"
87+
curl -u "${{ secrets.CAP_DEPLOYMENT_USER }}:${{ secrets.CAP_DEPLOYMENT_PASS }}" -f -I \
88+
"$ARTIFACTORY_URL/$group_path/$version/maven-metadata.xml" || { echo "Metadata not found"; exit 1; }
89+
echo "Artifact metadata accessible for $version"
90+
- name: Summary
91+
run: |
92+
echo "Revision: ${{ steps.read-revision.outputs.revision }}"
93+
echo "Final version: ${{ steps.bump-version.outputs.updated_version || steps.read-revision.outputs.updated_version }}"
94+
echo "Deployment target: ${{ env.ARTIFACTORY_URL }}"

.github/workflows/multi tenancy_Integration.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ jobs:
5656
-u ${{ secrets.CF_USER }} \
5757
-p ${{ secrets.CF_PASSWORD }} \
5858
-o ${{ secrets.CF_ORG }} \
59-
-s ${{ secrets.CF_SPACE }}
60-
# -s ${{ steps.determine_space.outputs.space }}
59+
-s ${{ steps.determine_space.outputs.space }}
6160
6261
- name: Fetch and Escape Client Details for single tenant 🔍
6362
id: fetch_credentials
@@ -137,8 +136,8 @@ jobs:
137136
echo "🚀 Starting integration tests..."
138137
set -e
139138
PROPERTIES_FILE="sdm/src/test/resources/credentials.properties"
140-
appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com"
141-
appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com"
139+
appUrl="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com"
140+
appUrlMT="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com"
142141
authUrl="${{ secrets.CAPAUTH_URL }}"
143142
authUrlMT1="${{ secrets.AUTHURLMT1 }}"
144143
authUrlMT2="${{ secrets.AUTHURLMT2 }}"
@@ -195,4 +194,4 @@ jobs:
195194
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests
196195
mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
197196
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
198-
echo "✅ Integration tests completed!"
197+
echo "✅ Integration tests completed!"

.github/workflows/multiTenancyDeployLocal.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
required: true
99
default: 'developcap'
1010

11+
deploy_branch:
12+
description: 'Specify the branch to deploy'
13+
required: false
14+
15+
cds_services_version:
16+
description: 'Optional override for <cds.services.version> (e.g. 4.3.1). Leave blank to use existing value.'
17+
required: false
18+
default: ''
19+
1120
permissions:
1221
pull-requests: read
1322
packages: read # Added permission to read packages
@@ -20,6 +29,9 @@ jobs:
2029

2130
- name: Checkout this repository 📁
2231
uses: actions/checkout@v2
32+
with:
33+
ref: ${{ github.event.inputs.deploy_branch }}
34+
2335

2436
- name: Set up JDK 21 ☕
2537
uses: actions/setup-java@v3
@@ -49,6 +61,24 @@ jobs:
4961
echo "🔄 Cloning repository..."
5062
git clone --depth 1 --branch local_mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git
5163
echo "✅ Repository cloned!"
64+
65+
- name: Override cds.services.version (runtime only)
66+
if: ${{ github.event.inputs.cds_services_version != '' }}
67+
env:
68+
TARGET_CDS_SERVICES_VERSION: ${{ github.event.inputs.cds_services_version }}
69+
run: |
70+
echo "Override requested: cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}"
71+
FILES=$(grep -Rl "<cds.services.version>" . | grep pom.xml || true)
72+
if [ -z "$FILES" ]; then
73+
echo "No pom.xml files with <cds.services.version> found" >&2; exit 1;
74+
fi
75+
echo "Updating files:"; echo "$FILES" | sed 's/^/ - /'
76+
for f in $FILES; do
77+
sed -i "s|<cds.services.version>[^<]*</cds.services.version>|<cds.services.version>${TARGET_CDS_SERVICES_VERSION}</cds.services.version>|" "$f"
78+
done
79+
echo "Post-update values:"; grep -R "<cds.services.version>" $FILES || true
80+
echo "(Not committing these changes)"
81+
shell: bash
5282

5383
- name: Change directory to cloud-cap-samples-java 📂
5484
working-directory: cloud-cap-samples-java
@@ -82,7 +112,7 @@ jobs:
82112
83113
# Login to Cloud Foundry again to ensure session is active
84114
echo "🔑 Logging in to Cloud Foundry..."
85-
cf login -a ${ secrets.CF_API } -u ${ secrets.CF_USER } -p ${ secrets.CF_PASSWORD } -o ${ secrets.CF_ORG } -s -s ${{ steps.determine_space.outputs.space }}
115+
cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ github.event.inputs.cf_space }}
86116
echo "✅ Logged in successfully!"
87117
88118
# Deploy the application
@@ -91,4 +121,4 @@ jobs:
91121
ls -lrth
92122
echo "▶️ Running cf deploy..."
93123
cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f
94-
echo "✅ Deployment complete!"
124+
echo "✅ Deployment complete!"

0 commit comments

Comments
 (0)