From 2d7c7d2f51f1dfaf27398405a94e9b49b84bc3f8 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:31:36 +0530 Subject: [PATCH 01/19] Update cfdeploy.yml --- .github/workflows/cfdeploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/cfdeploy.yml b/.github/workflows/cfdeploy.yml index b27dc8d2..4dd2527d 100644 --- a/.github/workflows/cfdeploy.yml +++ b/.github/workflows/cfdeploy.yml @@ -20,6 +20,10 @@ on: repository_id: description: 'Specify the Repository ID (leave blank if deploying to developcap)' required: false + cds_services_version: + description: 'Optional override for (e.g. 4.3.1). Leave blank to use existing value.' + required: false + default: '' permissions: pull-requests: read @@ -150,6 +154,24 @@ jobs: exit 1 fi + - name: Override cds.services.version (runtime only) + if: ${{ github.event.inputs.cds_services_version != '' }} + env: + TARGET_CDS_SERVICES_VERSION: ${{ github.event.inputs.cds_services_version }} + run: | + echo "Override requested: cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" + FILES=$(grep -Rl "" . | grep pom.xml || true) + if [ -z "$FILES" ]; then + echo "No pom.xml files with found" >&2; exit 1; + fi + echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + for f in $FILES; do + sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" + done + echo "Post-update values:"; grep -R "" $FILES || true + echo "(Not committing these changes)" + shell: bash + - name: Deleting the sdm directory for fresh build βš™οΈ run: | echo "πŸ”„ Deleting 'sdm' directory for fresh build..." From 07e1885ee11a3dc5e41adbc81dbd3b57479b9ce2 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:57:05 +0530 Subject: [PATCH 02/19] Update multiTenant_deploy_and_Integration_test.yml --- ...ultiTenant_deploy_and_Integration_test.yml | 459 +++++++++--------- 1 file changed, 238 insertions(+), 221 deletions(-) diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test.yml b/.github/workflows/multiTenant_deploy_and_Integration_test.yml index 364cda92..a0f908aa 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test.yml @@ -13,7 +13,7 @@ permissions: jobs: deploy: - if: github.event.pull_request.merged == true + if: github.event.pull_request.merged == false runs-on: ubuntu-latest steps: @@ -55,225 +55,242 @@ jobs: git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git echo "βœ… Repository cloned!" - - name: Change directory to cloud-cap-samples-java πŸ“‚ - working-directory: cloud-cap-samples-java - run: | - pwd - echo "βœ”οΈ Directory changed!" - - - name: Run mbt build πŸ”¨ - working-directory: cloud-cap-samples-java - run: | - echo "πŸš€ Running MBT build..." - echo "java version:" - java --version - mbt build - echo "βœ… MBT build completed!" - - - name: Deploy to Cloud Foundry ☁️ - working-directory: cloud-cap-samples-java - run: | - echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." - echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." - - # Install cf CLI plugin - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt update - sudo apt install cf-cli - - cf install-plugin multiapps -f - echo "βœ… Cloud Foundry CLI setup complete!" - - # Login to Cloud Foundry again to ensure session is active - echo "πŸ”‘ Logging in to Cloud Foundry..." - cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - echo "βœ… Logged in successfully!" - - # Deploy the application - echo "πŸ“‚ Current directory.." - pwd - ls -lrth - echo "▢️ Running cf deploy..." - cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f - echo "βœ… Deployment complete!" - - integration-test: - needs: deploy - runs-on: ubuntu-latest - - steps: - - name: Checkout repository βœ… - uses: actions/checkout@v2 - - - name: Set up Java 17 β˜• - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - - - name: Install Cloud Foundry CLI and jq πŸ“¦ - run: | - echo "πŸ”§ Installing Cloud Foundry CLI and jq..." - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli jq - - - name: Determine Cloud Foundry Space 🌌 - id: determine_space - run: | - if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then - space="${{ secrets.CF_SPACE }}" - else - space="${{ github.event.inputs.cf_space }}" - fi - echo "🌍 Space determined: $space" - echo "::set-output name=space::$space" - - - name: Login to Cloud Foundry πŸ”‘ - run: | - echo "πŸ”„ Logging in to Cloud Foundry using space: ${{ steps.determine_space.outputs.space }}" - cf login -a ${{ secrets.CF_API }} \ - -u ${{ secrets.CF_USER }} \ - -p ${{ secrets.CF_PASSWORD }} \ - -o ${{ secrets.CF_ORG }} \ - -s ${{ secrets.CF_SPACE }} - - - name: Fetch and Escape Client Details for single tenant πŸ” - id: fetch_credentials - run: | - echo "Fetching client details for single tenant..." - service_instance_guid=$(cf service demoappjava-public-uaa --guid) - if [ -z "$service_instance_guid" ]; then - echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - fi - - bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - if [ -z "$binding_guid" ]; then - echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - fi - - binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - echo "❌ Error: clientSecret is not set or is null"; exit 1; - fi - escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - echo "::add-mask::$escapedClientSecret" - - clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') - if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then - echo "❌ Error: clientID is not set or is null"; exit 1; - fi - echo "::add-mask::$clientID" - - echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - echo "::set-output name=CLIENT_ID::$clientID" - echo "βœ… Client details fetched successfully!" - - - name: Fetch and Escape Client Details for multi tenant πŸ” - id: fetch_credentials_mt - run: | - echo "Fetching client details for multi tenant..." - service_instance_guid=$(cf service bookshop-mt-uaa --guid) - if [ -z "$service_instance_guid" ]; then - echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - fi - - bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - if [ -z "$binding_guid" ]; then - echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - fi - - binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then - echo "❌ Error: clientSecret_mt is not set or is null"; exit 1; - fi - escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g') - echo "::add-mask::$escapedClientSecret_mt" - - clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid') - if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then - echo "❌ Error: clientID_mt is not set or is null"; exit 1; - fi - echo "::add-mask::$clientID_mt" - - echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt" - echo "::set-output name=CLIENT_ID_MT::$clientID_mt" - echo "βœ… Multi-tenant client details fetched successfully!" - - - name: Run integration tests 🎯 + - name: Override cds.services.version to 4.3.1 (runtime only) env: - CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} - CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} - CLIENT_SECRET_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }} - CLIENT_ID_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }} + TARGET_CDS_SERVICES_VERSION: 4.3.1 run: | - echo "πŸš€ Starting integration tests..." - set -e - PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" - authUrl="${{ secrets.CAPAUTH_URL }}" - authUrlMT1="${{ secrets.AUTHURLMT1 }}" - authUrlMT2="${{ secrets.AUTHURLMT2 }}" - clientID="${{ env.CLIENT_ID }}" - clientSecret="${{ env.CLIENT_SECRET }}" - clientIDMT="${{ env.CLIENT_ID_MT }}" - clientSecretMT="${{ env.CLIENT_SECRET_MT }}" - username="${{ secrets.CF_USER }}" - password="${{ secrets.CF_PASSWORD }}" - noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - - echo "::add-mask::$clientSecret" - echo "::add-mask::$clientID" - echo "::add-mask::$clientSecretMT" - echo "::add-mask::$clientIDMT" - echo "::add-mask::$username" - echo "::add-mask::$password" - echo "::add-mask::$noSDMRoleUsername" - echo "::add-mask::$noSDMRoleUserPassword" - - if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi - if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi - if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi - if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi - if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi - if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi - if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi - if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi - if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi - if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi - if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi - if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi - if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi - - cat > "$PROPERTIES_FILE" < ${TARGET_CDS_SERVICES_VERSION}" + FILES=$(grep -Rl "" . | grep pom.xml || true) + if [ -z "$FILES" ]; then + echo "No pom.xml files with found" >&2; exit 1; + fi + echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + for f in $FILES; do + sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" + done + echo "Post-update values:"; grep -R "" $FILES + echo "NOTE: Not committing these changes; runtime only." + shell: bash + + # - name: Change directory to cloud-cap-samples-java πŸ“‚ + # working-directory: cloud-cap-samples-java + # run: | + # pwd + # echo "βœ”οΈ Directory changed!" + + # - name: Run mbt build πŸ”¨ + # working-directory: cloud-cap-samples-java + # run: | + # echo "πŸš€ Running MBT build..." + # echo "java version:" + # java --version + # mbt build + # echo "βœ… MBT build completed!" + + # - name: Deploy to Cloud Foundry ☁️ + # working-directory: cloud-cap-samples-java + # run: | + # echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." + # echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." + + # # Install cf CLI plugin + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt update + # sudo apt install cf-cli + + # cf install-plugin multiapps -f + # echo "βœ… Cloud Foundry CLI setup complete!" + + # # Login to Cloud Foundry again to ensure session is active + # echo "πŸ”‘ Logging in to Cloud Foundry..." + # cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} + # echo "βœ… Logged in successfully!" + + # # Deploy the application + # echo "πŸ“‚ Current directory.." + # pwd + # ls -lrth + # echo "▢️ Running cf deploy..." + # cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f + # echo "βœ… Deployment complete!" + + # integration-test: + # needs: deploy + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout repository βœ… + # uses: actions/checkout@v2 + + # - name: Set up Java 17 β˜• + # uses: actions/setup-java@v3 + # with: + # java-version: 17 + # distribution: 'temurin' + + # - name: Install Cloud Foundry CLI and jq πŸ“¦ + # run: | + # echo "πŸ”§ Installing Cloud Foundry CLI and jq..." + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - + # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt-get update + # sudo apt-get install cf8-cli jq + + # - name: Determine Cloud Foundry Space 🌌 + # id: determine_space + # run: | + # if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then + # space="${{ secrets.CF_SPACE }}" + # else + # space="${{ github.event.inputs.cf_space }}" + # fi + # echo "🌍 Space determined: $space" + # echo "::set-output name=space::$space" + + # - name: Login to Cloud Foundry πŸ”‘ + # run: | + # echo "πŸ”„ Logging in to Cloud Foundry using space: ${{ steps.determine_space.outputs.space }}" + # cf login -a ${{ secrets.CF_API }} \ + # -u ${{ secrets.CF_USER }} \ + # -p ${{ secrets.CF_PASSWORD }} \ + # -o ${{ secrets.CF_ORG }} \ + # -s ${{ secrets.CF_SPACE }} + + # - name: Fetch and Escape Client Details for single tenant πŸ” + # id: fetch_credentials + # run: | + # echo "Fetching client details for single tenant..." + # service_instance_guid=$(cf service demoappjava-public-uaa --guid) + # if [ -z "$service_instance_guid" ]; then + # echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; + # fi + + # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + # binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') + # if [ -z "$binding_guid" ]; then + # echo "❌ Error: Unable to retrieve binding GUID"; exit 1; + # fi + + # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + + # clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + # if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then + # echo "❌ Error: clientSecret is not set or is null"; exit 1; + # fi + # escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') + # echo "::add-mask::$escapedClientSecret" + + # clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') + # if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then + # echo "❌ Error: clientID is not set or is null"; exit 1; + # fi + # echo "::add-mask::$clientID" + + # echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" + # echo "::set-output name=CLIENT_ID::$clientID" + # echo "βœ… Client details fetched successfully!" + + # - name: Fetch and Escape Client Details for multi tenant πŸ” + # id: fetch_credentials_mt + # run: | + # echo "Fetching client details for multi tenant..." + # service_instance_guid=$(cf service bookshop-mt-uaa --guid) + # if [ -z "$service_instance_guid" ]; then + # echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; + # fi + + # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + # binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') + # if [ -z "$binding_guid" ]; then + # echo "❌ Error: Unable to retrieve binding GUID"; exit 1; + # fi + + # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + + # clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + # if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then + # echo "❌ Error: clientSecret_mt is not set or is null"; exit 1; + # fi + # escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g') + # echo "::add-mask::$escapedClientSecret_mt" + + # clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid') + # if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then + # echo "❌ Error: clientID_mt is not set or is null"; exit 1; + # fi + # echo "::add-mask::$clientID_mt" + + # echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt" + # echo "::set-output name=CLIENT_ID_MT::$clientID_mt" + # echo "βœ… Multi-tenant client details fetched successfully!" + + # - name: Run integration tests 🎯 + # env: + # CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} + # CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} + # CLIENT_SECRET_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }} + # CLIENT_ID_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }} + # run: | + # echo "πŸš€ Starting integration tests..." + # set -e + # PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" + # appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + # appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" + # authUrl="${{ secrets.CAPAUTH_URL }}" + # authUrlMT1="${{ secrets.AUTHURLMT1 }}" + # authUrlMT2="${{ secrets.AUTHURLMT2 }}" + # clientID="${{ env.CLIENT_ID }}" + # clientSecret="${{ env.CLIENT_SECRET }}" + # clientIDMT="${{ env.CLIENT_ID_MT }}" + # clientSecretMT="${{ env.CLIENT_SECRET_MT }}" + # username="${{ secrets.CF_USER }}" + # password="${{ secrets.CF_PASSWORD }}" + # noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" + # noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" + + # echo "::add-mask::$clientSecret" + # echo "::add-mask::$clientID" + # echo "::add-mask::$clientSecretMT" + # echo "::add-mask::$clientIDMT" + # echo "::add-mask::$username" + # echo "::add-mask::$password" + # echo "::add-mask::$noSDMRoleUsername" + # echo "::add-mask::$noSDMRoleUserPassword" + + # if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi + # if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi + # if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi + # if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi + # if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi + # if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi + # if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi + # if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi + # if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi + # if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi + # if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi + # if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi + # if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi + + # cat > "$PROPERTIES_FILE" < Date: Wed, 8 Oct 2025 19:09:55 +0530 Subject: [PATCH 03/19] Create singleTenant_deploy_and_Integration_test_LatestVersion.yml Created a new workflow file which will run only when Single Tenant Deploy & Integration test job (This job has used long time support version while deploying) completes. --- ...loy_and_Integration_test_LatestVersion.yml | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 .github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml b/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml new file mode 100644 index 00000000..a2747ee6 --- /dev/null +++ b/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml @@ -0,0 +1,240 @@ +name: Single Tenant Deploy and Integration Test LatestVersion + +# This workflow now runs ONLY after the main "Single Tenant Deploy and Integration Test" workflow +# (deploy_and_Integration_test.yml) has completed successfully. It can still be +# triggered manually via workflow_dispatch if needed. +on: + workflow_run: + workflows: ["Single Tenant Deploy and Integration Test"] + types: [completed] + workflow_dispatch: + +permissions: + pull-requests: read + packages: read # Added permission to read packages + +jobs: + deploy: + # Run only if the triggering workflow concluded successfully + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + + - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. + run: sleep 300 + + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: develop + + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + + - name: Verify and Checkout Deploy Branch + run: | + git fetch origin + if git rev-parse --verify origin/develop_deploy; then + git checkout develop_deploy + else + echo "Branch 'develop_deploy' not found. Please verify the branch name." + exit 1 + fi + + - name: Deleting the sdm directory for fresh build + run: | + pwd + cd + rm -rf .m2/repository/com/sap/cds + + - name: Configure Maven for GitHub Packages + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml < + + + github-snapshot + ${{ github.actor }} + ${{ secrets.GITHUB_TOKEN }} + + + + EOF + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Dry Run Validation (cds.services.version 4.3.1) + env: + TARGET_CDS_SERVICES_VERSION: 4.3.1 + run: | + set -e + echo "== Dry Run Validation Start ==" + ROOT_VAL=$(grep -m1 -oP '(?<=)[^<]+' pom.xml || true) + if [ "$ROOT_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then + echo "Root pom mismatch: $ROOT_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi + echo "Root pom.xml OK: $ROOT_VAL" + echo "Evaluating via mvn help:evaluate..." + MVN_VAL=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + if [ "$MVN_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then + echo "help:evaluate mismatch: $MVN_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi + echo "Property resolution OK ($MVN_VAL)" + echo "Downloading dependencies (go-offline)..." + mvn -B -U -DskipTests dependency:go-offline + echo "Compiling (skip tests) ..." + mvn -B -q -DskipTests -DskipITs=true -DskipIntegrationTests=true -DskipUnitTests=true -pl sdm -am compile + echo "== Dry Run Validation Success ==" + shell: bash + + # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) + # run: | + # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + + - name: Prepare and Deploy to Cloud Foundry + run: | + echo "Current Branch......" + git branch + pwd + cd /home/runner/work/sdm/sdm/cap-notebook/demoapp + # Removing node_modules & package-lock.json + cd app + rm -rf node_modules package-lock.json + + npm i + + cd .. + + # Replace placeholder with actual REPOSITORY_ID value + sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml + + wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + sudo mv mbt /usr/local/bin/ + + mbt build + + # Install cf & login + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ + | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + echo "deb https://packages.cloudfoundry.org/debian stable main" \ + | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt update + sudo apt install cf-cli + + # Install cf CLI plugin + cf install-plugin multiapps -f + + # Login to Cloud Foundry again to ensure session is active + cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} + + # Deploy the application + echo "Running cf deploy" + cf deploy mta_archives/demoappjava_1.0.0.mtar -f + + integration-test: + needs: deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + + - name: Install Cloud Foundry CLI and jq + run: | + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - + echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt-get update + sudo apt-get install cf8-cli jq + - name: Login to Cloud Foundry + run: | + cf login -a ${{ secrets.CF_API }} \ + -u ${{ secrets.CF_USER }} \ + -p ${{ secrets.CF_PASSWORD }} \ + -o ${{ secrets.CF_ORG }} \ + -s ${{ secrets.CF_SPACE }} + - name: Fetch and Escape Client Secret + id: fetch_secret + run: | + # Fetch the service instance GUID + service_instance_guid=$(cf service demoappjava-public-uaa --guid) + if [ -z "$service_instance_guid" ]; then + echo "Error: Unable to retrieve service instance GUID"; exit 1; + fi + # Fetch the binding GUID + bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + + binding_guid=$(echo $bindings_response | jq -r '.resources[0].guid') + if [ -z "$binding_guid" ]; then + echo "Error: Unable to retrieve binding GUID"; exit 1; + fi + + # Fetch the clientSecret + binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then + echo "Error: clientSecret is not set or is null"; exit 1; + fi + + # Escape any $ characters in the clientSecret + escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') + echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" + - name: Run integration tests + env: + CLIENT_SECRET: ${{ steps.fetch_secret.outputs.CLIENT_SECRET }} + run: | + set -e # Enable error checking + PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" + # Gather secrets and other values + appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + authUrl="${{ secrets.CAPAUTH_URL }}" + clientID="${{ secrets.CAPSDM_CLIENT_ID }}" + clientSecret="${{ env.CLIENT_SECRET }}" + username="${{ secrets.CF_USER }}" + password="${{ secrets.CF_PASSWORD }}" + noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" + noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" + # Ensure all required variables are set + if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi + if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi + if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi + if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi + if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi + if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi + if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi + if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi + # Function to partially mask sensitive information for logging + mask() { + local value="$1" + if [ ${#value} -gt 6 ]; then + echo "${value:0:3}*****${value: -3}" + else + echo "${value:0:2}*****" + fi + } + # Update properties file with real values + cat > "$PROPERTIES_FILE" < Date: Wed, 8 Oct 2025 19:19:45 +0530 Subject: [PATCH 04/19] Create multiTenant_deploy_and_Integration_test_LatestVersion.yml Created a workflow file which will deploy the multi tenant application with the latest version & run the integration test . It'll run only when Multi Tenancy Deploy & Integration Test completes successfully. --- ...loy_and_Integration_test_LatestVersion.yml | 299 ++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 .github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml new file mode 100644 index 00000000..118171ef --- /dev/null +++ b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml @@ -0,0 +1,299 @@ +name: Multi Tenancy Deploy & Integration Test LatestVersionπŸš€ + +# This workflow now runs ONLY after the main "Multi Tenancy Deploy & Integration Test" workflow +# (multiTenant_deploy_and_Integration_test.yml) has completed successfully. It can still be +# triggered manually via workflow_dispatch if needed. +on: + workflow_run: + workflows: ["Multi Tenancy Deploy & Integration TestπŸš€"] + types: [completed] + workflow_dispatch: + +permissions: + pull-requests: read + packages: read # Added permission to read packages + +jobs: + deploy: + #Run only if the triggering workflow concluded successfully + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + + - name: Wait for 2 minutes ⏳ + run: | + sleep 120 + echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." + + - name: Checkout this repository πŸ“ + uses: actions/checkout@v2 + + - name: Set up JDK 21 β˜• + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + + - name: Build and package πŸ“¦ + run: | + echo "πŸ”¨ Building and packaging..." + mvn clean install -P unit-tests -DskipIntegrationTests + echo "βœ… Build completed successfully!" + + - name: Setup Node.js 🟒 + uses: actions/setup-node@v3 + with: + node-version: '18' # Ensure to use at least version 18 + + - name: Install MBT βš™οΈ + run: | + echo "πŸ”§ Installing MBT..." + npm install -g mbt + echo "βœ… MBT installation complete!" + + - name: Clone the cloud-cap-samples-java repo 🌐 + run: | + echo "πŸ”„ Cloning repository..." + git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git + echo "βœ… Repository cloned!" + + - name: Override cds.services.version to 4.3.1 (runtime only) + env: + TARGET_CDS_SERVICES_VERSION: 4.3.1 + run: | + echo "Overriding cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" + FILES=$(grep -Rl "" . | grep pom.xml || true) + if [ -z "$FILES" ]; then + echo "No pom.xml files with found" >&2; exit 1; + fi + echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + for f in $FILES; do + sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" + done + echo "Post-update values:"; grep -R "" $FILES + echo "NOTE: Not committing these changes; runtime only." + shell: bash + + - name: Change directory to cloud-cap-samples-java πŸ“‚ + working-directory: cloud-cap-samples-java + run: | + pwd + echo "βœ”οΈ Directory changed!" + + - name: Run mbt build πŸ”¨ + working-directory: cloud-cap-samples-java + run: | + echo "πŸš€ Running MBT build..." + echo "java version:" + java --version + mbt build + echo "βœ… MBT build completed!" + + - name: Deploy to Cloud Foundry ☁️ + working-directory: cloud-cap-samples-java + run: | + echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." + echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." + + # Install cf CLI plugin + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt update + sudo apt install cf-cli + + cf install-plugin multiapps -f + echo "βœ… Cloud Foundry CLI setup complete!" + + # Login to Cloud Foundry again to ensure session is active + echo "πŸ”‘ Logging in to Cloud Foundry..." + cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} + echo "βœ… Logged in successfully!" + + # Deploy the application + echo "πŸ“‚ Current directory.." + pwd + ls -lrth + echo "▢️ Running cf deploy..." + cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f + echo "βœ… Deployment complete!" + + integration-test: + needs: deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout repository βœ… + uses: actions/checkout@v2 + + - name: Set up Java 17 β˜• + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + + - name: Install Cloud Foundry CLI and jq πŸ“¦ + run: | + echo "πŸ”§ Installing Cloud Foundry CLI and jq..." + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - + echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt-get update + sudo apt-get install cf8-cli jq + + - name: Determine Cloud Foundry Space 🌌 + id: determine_space + run: | + if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then + space="${{ secrets.CF_SPACE }}" + else + space="${{ github.event.inputs.cf_space }}" + fi + echo "🌍 Space determined: $space" + echo "::set-output name=space::$space" + + - name: Login to Cloud Foundry πŸ”‘ + run: | + echo "πŸ”„ Logging in to Cloud Foundry using space: ${{ steps.determine_space.outputs.space }}" + cf login -a ${{ secrets.CF_API }} \ + -u ${{ secrets.CF_USER }} \ + -p ${{ secrets.CF_PASSWORD }} \ + -o ${{ secrets.CF_ORG }} \ + -s ${{ secrets.CF_SPACE }} + + - name: Fetch and Escape Client Details for single tenant πŸ” + id: fetch_credentials + run: | + echo "Fetching client details for single tenant..." + service_instance_guid=$(cf service demoappjava-public-uaa --guid) + if [ -z "$service_instance_guid" ]; then + echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; + fi + + bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') + if [ -z "$binding_guid" ]; then + echo "❌ Error: Unable to retrieve binding GUID"; exit 1; + fi + + binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + + clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then + echo "❌ Error: clientSecret is not set or is null"; exit 1; + fi + escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') + echo "::add-mask::$escapedClientSecret" + + clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') + if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then + echo "❌ Error: clientID is not set or is null"; exit 1; + fi + echo "::add-mask::$clientID" + + echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" + echo "::set-output name=CLIENT_ID::$clientID" + echo "βœ… Client details fetched successfully!" + + - name: Fetch and Escape Client Details for multi tenant πŸ” + id: fetch_credentials_mt + run: | + echo "Fetching client details for multi tenant..." + service_instance_guid=$(cf service bookshop-mt-uaa --guid) + if [ -z "$service_instance_guid" ]; then + echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; + fi + + bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') + if [ -z "$binding_guid" ]; then + echo "❌ Error: Unable to retrieve binding GUID"; exit 1; + fi + + binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + + clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then + echo "❌ Error: clientSecret_mt is not set or is null"; exit 1; + fi + escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g') + echo "::add-mask::$escapedClientSecret_mt" + + clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid') + if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then + echo "❌ Error: clientID_mt is not set or is null"; exit 1; + fi + echo "::add-mask::$clientID_mt" + + echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt" + echo "::set-output name=CLIENT_ID_MT::$clientID_mt" + echo "βœ… Multi-tenant client details fetched successfully!" + + - name: Run integration tests 🎯 + env: + CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} + CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} + CLIENT_SECRET_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }} + CLIENT_ID_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }} + run: | + echo "πŸš€ Starting integration tests..." + set -e + PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" + appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" + authUrl="${{ secrets.CAPAUTH_URL }}" + authUrlMT1="${{ secrets.AUTHURLMT1 }}" + authUrlMT2="${{ secrets.AUTHURLMT2 }}" + clientID="${{ env.CLIENT_ID }}" + clientSecret="${{ env.CLIENT_SECRET }}" + clientIDMT="${{ env.CLIENT_ID_MT }}" + clientSecretMT="${{ env.CLIENT_SECRET_MT }}" + username="${{ secrets.CF_USER }}" + password="${{ secrets.CF_PASSWORD }}" + noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" + noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" + + echo "::add-mask::$clientSecret" + echo "::add-mask::$clientID" + echo "::add-mask::$clientSecretMT" + echo "::add-mask::$clientIDMT" + echo "::add-mask::$username" + echo "::add-mask::$password" + echo "::add-mask::$noSDMRoleUsername" + echo "::add-mask::$noSDMRoleUserPassword" + + if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi + if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi + if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi + if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi + if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi + if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi + if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi + if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi + if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi + if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi + if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi + if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi + if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi + + cat > "$PROPERTIES_FILE" < Date: Wed, 8 Oct 2025 19:21:08 +0530 Subject: [PATCH 05/19] Update multiTenant_deploy_and_Integration_test.yml --- ...ultiTenant_deploy_and_Integration_test.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test.yml b/.github/workflows/multiTenant_deploy_and_Integration_test.yml index a0f908aa..425baaed 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test.yml @@ -18,10 +18,10 @@ jobs: steps: - - name: Wait for 5 minutes ⏳ - run: | - sleep 300 - echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." + # - name: Wait for 5 minutes ⏳ + # run: | + # sleep 300 + # echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." - name: Checkout this repository πŸ“ uses: actions/checkout@v2 @@ -32,22 +32,22 @@ jobs: distribution: 'temurin' java-version: '21' - - name: Build and package πŸ“¦ - run: | - echo "πŸ”¨ Building and packaging..." - mvn clean install -P unit-tests -DskipIntegrationTests - echo "βœ… Build completed successfully!" + # - name: Build and package πŸ“¦ + # run: | + # echo "πŸ”¨ Building and packaging..." + # mvn clean install -P unit-tests -DskipIntegrationTests + # echo "βœ… Build completed successfully!" - name: Setup Node.js 🟒 uses: actions/setup-node@v3 with: node-version: '18' # Ensure to use at least version 18 - - name: Install MBT βš™οΈ - run: | - echo "πŸ”§ Installing MBT..." - npm install -g mbt - echo "βœ… MBT installation complete!" + # - name: Install MBT βš™οΈ + # run: | + # echo "πŸ”§ Installing MBT..." + # npm install -g mbt + # echo "βœ… MBT installation complete!" - name: Clone the cloud-cap-samples-java repo 🌐 run: | From 89c74378aa1e6b20be45eec47e26eda33592069c Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Wed, 8 Oct 2025 19:21:51 +0530 Subject: [PATCH 06/19] Update multiTenant_deploy_and_Integration_test_LatestVersion.yml --- ...loy_and_Integration_test_LatestVersion.yml | 470 +++++++++--------- 1 file changed, 235 insertions(+), 235 deletions(-) diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml index 118171ef..4fadf652 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml @@ -21,10 +21,10 @@ jobs: steps: - - name: Wait for 2 minutes ⏳ - run: | - sleep 120 - echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." + # - name: Wait for 2 minutes ⏳ + # run: | + # sleep 120 + # echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." - name: Checkout this repository πŸ“ uses: actions/checkout@v2 @@ -35,22 +35,22 @@ jobs: distribution: 'temurin' java-version: '21' - - name: Build and package πŸ“¦ - run: | - echo "πŸ”¨ Building and packaging..." - mvn clean install -P unit-tests -DskipIntegrationTests - echo "βœ… Build completed successfully!" + # - name: Build and package πŸ“¦ + # run: | + # echo "πŸ”¨ Building and packaging..." + # mvn clean install -P unit-tests -DskipIntegrationTests + # echo "βœ… Build completed successfully!" - name: Setup Node.js 🟒 uses: actions/setup-node@v3 with: node-version: '18' # Ensure to use at least version 18 - - name: Install MBT βš™οΈ - run: | - echo "πŸ”§ Installing MBT..." - npm install -g mbt - echo "βœ… MBT installation complete!" + # - name: Install MBT βš™οΈ + # run: | + # echo "πŸ”§ Installing MBT..." + # npm install -g mbt + # echo "βœ… MBT installation complete!" - name: Clone the cloud-cap-samples-java repo 🌐 run: | @@ -75,225 +75,225 @@ jobs: echo "NOTE: Not committing these changes; runtime only." shell: bash - - name: Change directory to cloud-cap-samples-java πŸ“‚ - working-directory: cloud-cap-samples-java - run: | - pwd - echo "βœ”οΈ Directory changed!" - - - name: Run mbt build πŸ”¨ - working-directory: cloud-cap-samples-java - run: | - echo "πŸš€ Running MBT build..." - echo "java version:" - java --version - mbt build - echo "βœ… MBT build completed!" - - - name: Deploy to Cloud Foundry ☁️ - working-directory: cloud-cap-samples-java - run: | - echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." - echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." - - # Install cf CLI plugin - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt update - sudo apt install cf-cli + # - name: Change directory to cloud-cap-samples-java πŸ“‚ + # working-directory: cloud-cap-samples-java + # run: | + # pwd + # echo "βœ”οΈ Directory changed!" + + # - name: Run mbt build πŸ”¨ + # working-directory: cloud-cap-samples-java + # run: | + # echo "πŸš€ Running MBT build..." + # echo "java version:" + # java --version + # mbt build + # echo "βœ… MBT build completed!" + + # - name: Deploy to Cloud Foundry ☁️ + # working-directory: cloud-cap-samples-java + # run: | + # echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." + # echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." + + # # Install cf CLI plugin + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt update + # sudo apt install cf-cli - cf install-plugin multiapps -f - echo "βœ… Cloud Foundry CLI setup complete!" - - # Login to Cloud Foundry again to ensure session is active - echo "πŸ”‘ Logging in to Cloud Foundry..." - cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - echo "βœ… Logged in successfully!" - - # Deploy the application - echo "πŸ“‚ Current directory.." - pwd - ls -lrth - echo "▢️ Running cf deploy..." - cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f - echo "βœ… Deployment complete!" - - integration-test: - needs: deploy - runs-on: ubuntu-latest - - steps: - - name: Checkout repository βœ… - uses: actions/checkout@v2 - - - name: Set up Java 17 β˜• - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - - - name: Install Cloud Foundry CLI and jq πŸ“¦ - run: | - echo "πŸ”§ Installing Cloud Foundry CLI and jq..." - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli jq - - - name: Determine Cloud Foundry Space 🌌 - id: determine_space - run: | - if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then - space="${{ secrets.CF_SPACE }}" - else - space="${{ github.event.inputs.cf_space }}" - fi - echo "🌍 Space determined: $space" - echo "::set-output name=space::$space" - - - name: Login to Cloud Foundry πŸ”‘ - run: | - echo "πŸ”„ Logging in to Cloud Foundry using space: ${{ steps.determine_space.outputs.space }}" - cf login -a ${{ secrets.CF_API }} \ - -u ${{ secrets.CF_USER }} \ - -p ${{ secrets.CF_PASSWORD }} \ - -o ${{ secrets.CF_ORG }} \ - -s ${{ secrets.CF_SPACE }} - - - name: Fetch and Escape Client Details for single tenant πŸ” - id: fetch_credentials - run: | - echo "Fetching client details for single tenant..." - service_instance_guid=$(cf service demoappjava-public-uaa --guid) - if [ -z "$service_instance_guid" ]; then - echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - fi - - bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - if [ -z "$binding_guid" ]; then - echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - fi - - binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - echo "❌ Error: clientSecret is not set or is null"; exit 1; - fi - escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - echo "::add-mask::$escapedClientSecret" - - clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') - if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then - echo "❌ Error: clientID is not set or is null"; exit 1; - fi - echo "::add-mask::$clientID" - - echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - echo "::set-output name=CLIENT_ID::$clientID" - echo "βœ… Client details fetched successfully!" - - - name: Fetch and Escape Client Details for multi tenant πŸ” - id: fetch_credentials_mt - run: | - echo "Fetching client details for multi tenant..." - service_instance_guid=$(cf service bookshop-mt-uaa --guid) - if [ -z "$service_instance_guid" ]; then - echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - fi - - bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - if [ -z "$binding_guid" ]; then - echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - fi - - binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then - echo "❌ Error: clientSecret_mt is not set or is null"; exit 1; - fi - escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g') - echo "::add-mask::$escapedClientSecret_mt" - - clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid') - if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then - echo "❌ Error: clientID_mt is not set or is null"; exit 1; - fi - echo "::add-mask::$clientID_mt" - - echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt" - echo "::set-output name=CLIENT_ID_MT::$clientID_mt" - echo "βœ… Multi-tenant client details fetched successfully!" - - - name: Run integration tests 🎯 - env: - CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} - CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} - CLIENT_SECRET_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }} - CLIENT_ID_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }} - run: | - echo "πŸš€ Starting integration tests..." - set -e - PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" - authUrl="${{ secrets.CAPAUTH_URL }}" - authUrlMT1="${{ secrets.AUTHURLMT1 }}" - authUrlMT2="${{ secrets.AUTHURLMT2 }}" - clientID="${{ env.CLIENT_ID }}" - clientSecret="${{ env.CLIENT_SECRET }}" - clientIDMT="${{ env.CLIENT_ID_MT }}" - clientSecretMT="${{ env.CLIENT_SECRET_MT }}" - username="${{ secrets.CF_USER }}" - password="${{ secrets.CF_PASSWORD }}" - noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - - echo "::add-mask::$clientSecret" - echo "::add-mask::$clientID" - echo "::add-mask::$clientSecretMT" - echo "::add-mask::$clientIDMT" - echo "::add-mask::$username" - echo "::add-mask::$password" - echo "::add-mask::$noSDMRoleUsername" - echo "::add-mask::$noSDMRoleUserPassword" - - if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi - if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi - if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi - if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi - if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi - if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi - if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi - if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi - if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi - if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi - if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi - if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi - if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi - - cat > "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < Date: Fri, 10 Oct 2025 09:57:24 +0530 Subject: [PATCH 07/19] Update new_wokflow_test.yml --- .github/workflows/new_wokflow_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/new_wokflow_test.yml b/.github/workflows/new_wokflow_test.yml index 38466427..7666526a 100644 --- a/.github/workflows/new_wokflow_test.yml +++ b/.github/workflows/new_wokflow_test.yml @@ -1,6 +1,9 @@ name: Check Release Branch Names on: + push: + branches: + - ltsversion workflow_dispatch: # Allows manual triggering of the workflow jobs: From 5c20afc4e43aa4a0fc67709a0f158278de1c6b51 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:44:08 +0530 Subject: [PATCH 08/19] Update new_wokflow_test.yml --- .github/workflows/new_wokflow_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/new_wokflow_test.yml b/.github/workflows/new_wokflow_test.yml index 7666526a..ddf106c2 100644 --- a/.github/workflows/new_wokflow_test.yml +++ b/.github/workflows/new_wokflow_test.yml @@ -17,7 +17,7 @@ jobs: - name: List Release branches run: | # Fetch all branches - branches=$(git branch -r | grep 'origin/Release') + branches=$(git branch -r | grep 'Release') # Check if any branches were found if [ -n "$branches" ]; then From 1c2732918943b8278c7ceac9c3aea33f4150d5d5 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:50:59 +0530 Subject: [PATCH 09/19] Updated the workflow file for testing --- .github/workflows/new_wokflow_test.yml | 253 +++++++++++-- ...ngleTenant_deploy_and_Integration_test.yml | 332 +++++++++--------- 2 files changed, 399 insertions(+), 186 deletions(-) diff --git a/.github/workflows/new_wokflow_test.yml b/.github/workflows/new_wokflow_test.yml index ddf106c2..c4acb953 100644 --- a/.github/workflows/new_wokflow_test.yml +++ b/.github/workflows/new_wokflow_test.yml @@ -1,28 +1,241 @@ -name: Check Release Branch Names +name: Single Tenant Deploy and Integration Test LatestVersion +# This workflow now runs ONLY after the main "Single Tenant Deploy and Integration Test" workflow +# (deploy_and_Integration_test.yml) has completed successfully. It can still be +# triggered manually via workflow_dispatch if needed. on: - push: - branches: - - ltsversion - workflow_dispatch: # Allows manual triggering of the workflow + workflow_run: + workflows: ["Single Tenant Deploy and Integration Test"] + types: [completed] + workflow_dispatch: + +permissions: + pull-requests: read + packages: read # Added permission to read packages jobs: - check_release_branches: + deploy: + # Run only if the triggering workflow concluded successfully + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: List Release branches - run: | - # Fetch all branches - branches=$(git branch -r | grep 'Release') + + - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. + run: sleep 300 - # Check if any branches were found - if [ -n "$branches" ]; then - echo "Branches starting with 'Release':" - echo "$branches" - else - echo "No branches starting with 'Release' found." - fi + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: develop + + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + + - name: Verify and Checkout Deploy Branch + run: | + git fetch origin + if git rev-parse --verify origin/develop_deploy; then + git checkout develop_deploy + else + echo "Branch 'develop_deploy' not found. Please verify the branch name." + exit 1 + fi + + - name: Dry Run Validation (cds.services.version 4.3.1) + env: + TARGET_CDS_SERVICES_VERSION: 4.3.1 + run: | + set -e + echo "== Dry Run Validation Start ==" + ROOT_VAL=$(grep -m1 -oP '(?<=)[^<]+' pom.xml || true) + if [ "$ROOT_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then + echo "Root pom mismatch: $ROOT_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi + echo "Root pom.xml OK: $ROOT_VAL" + echo "Evaluating via mvn help:evaluate..." + MVN_VAL=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + if [ "$MVN_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then + echo "help:evaluate mismatch: $MVN_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi + echo "Property resolution OK ($MVN_VAL)" + echo "Downloading dependencies (go-offline)..." + mvn -B -U -DskipTests dependency:go-offline + echo "Compiling (skip tests) ..." + mvn -B -q -DskipTests -DskipITs=true -DskipIntegrationTests=true -DskipUnitTests=true -pl sdm -am compile + echo "== Dry Run Validation Success ==" + shell: bash + + # - name: Deleting the sdm directory for fresh build + # run: | + # pwd + # cd + # rm -rf .m2/repository/com/sap/cds + + # - name: Configure Maven for GitHub Packages + # run: | + # mkdir -p ~/.m2 + # cat > ~/.m2/settings.xml < + # + # + # github-snapshot + # ${{ github.actor }} + # ${{ secrets.GITHUB_TOKEN }} + # + # + # + # EOF + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + # # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) + # # run: | + # # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + # # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + + # - name: Prepare and Deploy to Cloud Foundry + # run: | + # echo "Current Branch......" + # git branch + # pwd + # cd /home/runner/work/sdm/sdm/cap-notebook/demoapp + # # Removing node_modules & package-lock.json + # cd app + # rm -rf node_modules package-lock.json + + # npm i + + # cd .. + + # # Replace placeholder with actual REPOSITORY_ID value + # sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml + + # wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + # tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + # sudo mv mbt /usr/local/bin/ + + # mbt build + + # # Install cf & login + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ + # | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + # echo "deb https://packages.cloudfoundry.org/debian stable main" \ + # | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt update + # sudo apt install cf-cli + + # # Install cf CLI plugin + # cf install-plugin multiapps -f + + # # Login to Cloud Foundry again to ensure session is active + # cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} + + # # Deploy the application + # echo "Running cf deploy" + # cf deploy mta_archives/demoappjava_1.0.0.mtar -f + + # integration-test: + # needs: deploy + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout repository + # uses: actions/checkout@v2 + + # - name: Set up Java 17 + # uses: actions/setup-java@v3 + # with: + # java-version: 17 + # distribution: 'temurin' + + # - name: Install Cloud Foundry CLI and jq + # run: | + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - + # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt-get update + # sudo apt-get install cf8-cli jq + # - name: Login to Cloud Foundry + # run: | + # cf login -a ${{ secrets.CF_API }} \ + # -u ${{ secrets.CF_USER }} \ + # -p ${{ secrets.CF_PASSWORD }} \ + # -o ${{ secrets.CF_ORG }} \ + # -s ${{ secrets.CF_SPACE }} + # - name: Fetch and Escape Client Secret + # id: fetch_secret + # run: | + # # Fetch the service instance GUID + # service_instance_guid=$(cf service demoappjava-public-uaa --guid) + # if [ -z "$service_instance_guid" ]; then + # echo "Error: Unable to retrieve service instance GUID"; exit 1; + # fi + # # Fetch the binding GUID + # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") + + # binding_guid=$(echo $bindings_response | jq -r '.resources[0].guid') + # if [ -z "$binding_guid" ]; then + # echo "Error: Unable to retrieve binding GUID"; exit 1; + # fi + + # # Fetch the clientSecret + # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") + # clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') + # if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then + # echo "Error: clientSecret is not set or is null"; exit 1; + # fi + + # # Escape any $ characters in the clientSecret + # escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') + # echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" + # - name: Run integration tests + # env: + # CLIENT_SECRET: ${{ steps.fetch_secret.outputs.CLIENT_SECRET }} + # run: | + # set -e # Enable error checking + # PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" + # # Gather secrets and other values + # appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + # authUrl="${{ secrets.CAPAUTH_URL }}" + # clientID="${{ secrets.CAPSDM_CLIENT_ID }}" + # clientSecret="${{ env.CLIENT_SECRET }}" + # username="${{ secrets.CF_USER }}" + # password="${{ secrets.CF_PASSWORD }}" + # noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" + # noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" + # # Ensure all required variables are set + # if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi + # if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi + # if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi + # if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi + # if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi + # if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi + # if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi + # if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi + # # Function to partially mask sensitive information for logging + # mask() { + # local value="$1" + # if [ ${#value} -gt 6 ]; then + # echo "${value:0:3}*****${value: -3}" + # else + # echo "${value:0:2}*****" + # fi + # } + # # Update properties file with real values + # cat > "$PROPERTIES_FILE" < ~/.m2/settings.xml < - - - github-snapshot - ${{ github.actor }} - ${{ secrets.GITHUB_TOKEN }} - - - - EOF - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) - # run: | - # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - - - name: Prepare and Deploy to Cloud Foundry - run: | - echo "Current Branch......" - git branch - pwd - cd /home/runner/work/sdm/sdm/cap-notebook/demoapp - # Removing node_modules & package-lock.json - cd app - rm -rf node_modules package-lock.json - - npm i - - cd .. + # - name: Deleting the sdm directory for fresh build + # run: | + # pwd + # cd + # rm -rf .m2/repository/com/sap/cds + + # - name: Configure Maven for GitHub Packages + # run: | + # mkdir -p ~/.m2 + # cat > ~/.m2/settings.xml < + # + # + # github-snapshot + # ${{ github.actor }} + # ${{ secrets.GITHUB_TOKEN }} + # + # + # + # EOF + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) + # # run: | + # # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + # # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + + # - name: Prepare and Deploy to Cloud Foundry + # run: | + # echo "Current Branch......" + # git branch + # pwd + # cd /home/runner/work/sdm/sdm/cap-notebook/demoapp + # # Removing node_modules & package-lock.json + # cd app + # rm -rf node_modules package-lock.json + + # npm i + + # cd .. - # Replace placeholder with actual REPOSITORY_ID value - sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml + # # Replace placeholder with actual REPOSITORY_ID value + # sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml - wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - sudo mv mbt /usr/local/bin/ + # wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + # tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + # sudo mv mbt /usr/local/bin/ - mbt build + # mbt build - # Install cf & login - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ - | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - echo "deb https://packages.cloudfoundry.org/debian stable main" \ - | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt update - sudo apt install cf-cli + # # Install cf & login + # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ + # | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + # echo "deb https://packages.cloudfoundry.org/debian stable main" \ + # | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + # sudo apt update + # sudo apt install cf-cli - # Install cf CLI plugin - cf install-plugin multiapps -f - - # Login to Cloud Foundry again to ensure session is active - cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - - # Deploy the application - echo "Running cf deploy" - cf deploy mta_archives/demoappjava_1.0.0.mtar -f - - integration-test: - needs: deploy - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - - - name: Install Cloud Foundry CLI and jq - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli jq - - name: Login to Cloud Foundry - run: | - cf login -a ${{ secrets.CF_API }} \ - -u ${{ secrets.CF_USER }} \ - -p ${{ secrets.CF_PASSWORD }} \ - -o ${{ secrets.CF_ORG }} \ - -s ${{ secrets.CF_SPACE }} - - name: Fetch and Escape Client Details for single tenant πŸ” - id: fetch_credentials - run: | - echo "Fetching client details for single tenant..." - service_instance_guid=$(cf service demoappjava-public-uaa --guid) - if [ -z "$service_instance_guid" ]; then - echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - fi - bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - if [ -z "$binding_guid" ]; then - echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - fi - binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - echo "❌ Error: clientSecret is not set or is null"; exit 1; - fi - escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - echo "::add-mask::$escapedClientSecret" - clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') - if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then - echo "❌ Error: clientID is not set or is null"; exit 1; - fi - echo "::add-mask::$clientID" - echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - echo "::set-output name=CLIENT_ID::$clientID" - echo "βœ… Client details fetched successfully!" - - name: Run integration tests 🎯 - env: - CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} - CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} - run: | - echo "πŸš€ Starting integration tests..." - set -e - PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - authUrl="${{ secrets.CAPAUTH_URL }}" - clientID="${{ env.CLIENT_ID }}" - clientSecret="${{ env.CLIENT_SECRET }}" - username="${{ secrets.CF_USER }}" - password="${{ secrets.CF_PASSWORD }}" - noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - echo "::add-mask::$clientSecret" - echo "::add-mask::$clientID" - echo "::add-mask::$username" - echo "::add-mask::$password" - echo "::add-mask::$noSDMRoleUsername" - echo "::add-mask::$noSDMRoleUserPassword" - if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi - if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi - if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi - if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi - if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi - if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi - if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi - if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi - cat > "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < Date: Fri, 10 Oct 2025 16:53:18 +0530 Subject: [PATCH 10/19] Update singleTenant_deploy_and_Integration_test.yml --- .github/workflows/singleTenant_deploy_and_Integration_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 87245f89..8c8a4175 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -13,7 +13,7 @@ permissions: jobs: deploy: - if: github.event.pull_request.merged == true + if: github.event.pull_request.merged == false runs-on: ubuntu-latest steps: From df06700b3254483cfb31654322070680fb34f76c Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:55:36 +0530 Subject: [PATCH 11/19] Update singleTenant_deploy_and_Integration_test.yml --- .github/workflows/singleTenant_deploy_and_Integration_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 8c8a4175..643423e3 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. - run: sleep 300 + run: sleep 30 - name: Checkout repository uses: actions/checkout@v2 From bb471498101578d25acc16ef9c4eb60219daac74 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:43:38 +0530 Subject: [PATCH 12/19] updated deploy & integration workflow files --- ...ultiTenant_deploy_and_Integration_test.yml | 485 +++++++++--------- ...loy_and_Integration_test_LatestVersion.yml | 471 ++++++++--------- ...ngleTenant_deploy_and_Integration_test.yml | 21 +- ...loy_and_Integration_test_LatestVersion.yml | 40 +- 4 files changed, 507 insertions(+), 510 deletions(-) diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test.yml b/.github/workflows/multiTenant_deploy_and_Integration_test.yml index 425baaed..5b75b3fb 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test.yml @@ -18,10 +18,10 @@ jobs: steps: - # - name: Wait for 5 minutes ⏳ - # run: | - # sleep 300 - # echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." + - name: Wait for 5 minutes ⏳ + run: | + sleep 300 + echo "⏳ Waiting for snapshot deployment... Initiating deployment in 5 minutes." - name: Checkout this repository πŸ“ uses: actions/checkout@v2 @@ -32,22 +32,22 @@ jobs: distribution: 'temurin' java-version: '21' - # - name: Build and package πŸ“¦ - # run: | - # echo "πŸ”¨ Building and packaging..." - # mvn clean install -P unit-tests -DskipIntegrationTests - # echo "βœ… Build completed successfully!" + - name: Build and package πŸ“¦ + run: | + echo "πŸ”¨ Building and packaging..." + mvn clean install -P unit-tests -DskipIntegrationTests + echo "βœ… Build completed successfully!" - name: Setup Node.js 🟒 uses: actions/setup-node@v3 with: node-version: '18' # Ensure to use at least version 18 - # - name: Install MBT βš™οΈ - # run: | - # echo "πŸ”§ Installing MBT..." - # npm install -g mbt - # echo "βœ… MBT installation complete!" + - name: Install MBT βš™οΈ + run: | + echo "πŸ”§ Installing MBT..." + npm install -g mbt + echo "βœ… MBT installation complete!" - name: Clone the cloud-cap-samples-java repo 🌐 run: | @@ -55,242 +55,225 @@ jobs: git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git echo "βœ… Repository cloned!" - - name: Override cds.services.version to 4.3.1 (runtime only) - env: - TARGET_CDS_SERVICES_VERSION: 4.3.1 + - name: Change directory to cloud-cap-samples-java πŸ“‚ + working-directory: cloud-cap-samples-java run: | - echo "Overriding cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" - FILES=$(grep -Rl "" . | grep pom.xml || true) - if [ -z "$FILES" ]; then - echo "No pom.xml files with found" >&2; exit 1; - fi - echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' - for f in $FILES; do - sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" - done - echo "Post-update values:"; grep -R "" $FILES - echo "NOTE: Not committing these changes; runtime only." - shell: bash - - # - name: Change directory to cloud-cap-samples-java πŸ“‚ - # working-directory: cloud-cap-samples-java - # run: | - # pwd - # echo "βœ”οΈ Directory changed!" - - # - name: Run mbt build πŸ”¨ - # working-directory: cloud-cap-samples-java - # run: | - # echo "πŸš€ Running MBT build..." - # echo "java version:" - # java --version - # mbt build - # echo "βœ… MBT build completed!" - - # - name: Deploy to Cloud Foundry ☁️ - # working-directory: cloud-cap-samples-java - # run: | - # echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." - # echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." - - # # Install cf CLI plugin - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt update - # sudo apt install cf-cli + pwd + echo "βœ”οΈ Directory changed!" + + - name: Run mbt build πŸ”¨ + working-directory: cloud-cap-samples-java + run: | + echo "πŸš€ Running MBT build..." + echo "java version:" + java --version + mbt build + echo "βœ… MBT build completed!" + + - name: Deploy to Cloud Foundry ☁️ + working-directory: cloud-cap-samples-java + run: | + echo "πŸš€ Deploying to ${{ secrets.CF_SPACE }}..." + echo "πŸ”§ Installing Cloud Foundry CLI and plugins..." + + # Install cf CLI plugin + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt update + sudo apt install cf-cli - # cf install-plugin multiapps -f - # echo "βœ… Cloud Foundry CLI setup complete!" - - # # Login to Cloud Foundry again to ensure session is active - # echo "πŸ”‘ Logging in to Cloud Foundry..." - # cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - # echo "βœ… Logged in successfully!" - - # # Deploy the application - # echo "πŸ“‚ Current directory.." - # pwd - # ls -lrth - # echo "▢️ Running cf deploy..." - # cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f - # echo "βœ… Deployment complete!" - - # integration-test: - # needs: deploy - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout repository βœ… - # uses: actions/checkout@v2 - - # - name: Set up Java 17 β˜• - # uses: actions/setup-java@v3 - # with: - # java-version: 17 - # distribution: 'temurin' - - # - name: Install Cloud Foundry CLI and jq πŸ“¦ - # run: | - # echo "πŸ”§ Installing Cloud Foundry CLI and jq..." - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt-get update - # sudo apt-get install cf8-cli jq - - # - name: Determine Cloud Foundry Space 🌌 - # id: determine_space - # run: | - # if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then - # space="${{ secrets.CF_SPACE }}" - # else - # space="${{ github.event.inputs.cf_space }}" - # fi - # echo "🌍 Space determined: $space" - # echo "::set-output name=space::$space" - - # - name: Login to Cloud Foundry πŸ”‘ - # run: | - # echo "πŸ”„ Logging in to Cloud Foundry using space: ${{ steps.determine_space.outputs.space }}" - # cf login -a ${{ secrets.CF_API }} \ - # -u ${{ secrets.CF_USER }} \ - # -p ${{ secrets.CF_PASSWORD }} \ - # -o ${{ secrets.CF_ORG }} \ - # -s ${{ secrets.CF_SPACE }} - - # - name: Fetch and Escape Client Details for single tenant πŸ” - # id: fetch_credentials - # run: | - # echo "Fetching client details for single tenant..." - # service_instance_guid=$(cf service demoappjava-public-uaa --guid) - # if [ -z "$service_instance_guid" ]; then - # echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - # fi - - # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - # binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - # if [ -z "$binding_guid" ]; then - # echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - # fi - - # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - # clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - # if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - # echo "❌ Error: clientSecret is not set or is null"; exit 1; - # fi - # escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - # echo "::add-mask::$escapedClientSecret" - - # clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') - # if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then - # echo "❌ Error: clientID is not set or is null"; exit 1; - # fi - # echo "::add-mask::$clientID" - - # echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - # echo "::set-output name=CLIENT_ID::$clientID" - # echo "βœ… Client details fetched successfully!" - - # - name: Fetch and Escape Client Details for multi tenant πŸ” - # id: fetch_credentials_mt - # run: | - # echo "Fetching client details for multi tenant..." - # service_instance_guid=$(cf service bookshop-mt-uaa --guid) - # if [ -z "$service_instance_guid" ]; then - # echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - # fi - - # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - # binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - # if [ -z "$binding_guid" ]; then - # echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - # fi - - # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - - # clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - # if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then - # echo "❌ Error: clientSecret_mt is not set or is null"; exit 1; - # fi - # escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g') - # echo "::add-mask::$escapedClientSecret_mt" - - # clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid') - # if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then - # echo "❌ Error: clientID_mt is not set or is null"; exit 1; - # fi - # echo "::add-mask::$clientID_mt" - - # echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt" - # echo "::set-output name=CLIENT_ID_MT::$clientID_mt" - # echo "βœ… Multi-tenant client details fetched successfully!" - - # - name: Run integration tests 🎯 - # env: - # CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} - # CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} - # CLIENT_SECRET_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }} - # CLIENT_ID_MT: ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }} - # run: | - # echo "πŸš€ Starting integration tests..." - # set -e - # PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - # appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - # appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" - # authUrl="${{ secrets.CAPAUTH_URL }}" - # authUrlMT1="${{ secrets.AUTHURLMT1 }}" - # authUrlMT2="${{ secrets.AUTHURLMT2 }}" - # clientID="${{ env.CLIENT_ID }}" - # clientSecret="${{ env.CLIENT_SECRET }}" - # clientIDMT="${{ env.CLIENT_ID_MT }}" - # clientSecretMT="${{ env.CLIENT_SECRET_MT }}" - # username="${{ secrets.CF_USER }}" - # password="${{ secrets.CF_PASSWORD }}" - # noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - # noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - - # echo "::add-mask::$clientSecret" - # echo "::add-mask::$clientID" - # echo "::add-mask::$clientSecretMT" - # echo "::add-mask::$clientIDMT" - # echo "::add-mask::$username" - # echo "::add-mask::$password" - # echo "::add-mask::$noSDMRoleUsername" - # echo "::add-mask::$noSDMRoleUserPassword" - - # if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi - # if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi - # if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi - # if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi - # if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi - # if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi - # if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi - # if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi - # if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi - # if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi - # if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi - # if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi - # if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi - - # cat > "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < ${TARGET_CDS_SERVICES_VERSION}" + FILES=$(grep -Rl "" . | grep pom.xml || true) + if [ -z "$FILES" ]; then + echo "No pom.xml files with found" >&2; exit 1; + fi + echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + for f in $FILES; do + sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" + done + echo "Post-update values:"; grep -R "" $FILES || true + echo "(Not committing these changes)" + shell: bash + # - name: Deleting the sdm directory for fresh build # run: | # pwd diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml b/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml index a2747ee6..ae1d5ffc 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test_LatestVersion.yml @@ -1,7 +1,7 @@ name: Single Tenant Deploy and Integration Test LatestVersion # This workflow now runs ONLY after the main "Single Tenant Deploy and Integration Test" workflow -# (deploy_and_Integration_test.yml) has completed successfully. It can still be +# (singleTenant_deploy_and_integration.yml) has completed successfully. It can still be # triggered manually via workflow_dispatch if needed. on: workflow_run: @@ -45,6 +45,23 @@ jobs: exit 1 fi + - name: Override cds.services.version (runtime only) + env: + TARGET_CDS_SERVICES_VERSION: 4.3.1 + run: | + echo "Override requested: cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" + FILES=$(grep -Rl "" . | grep pom.xml || true) + if [ -z "$FILES" ]; then + echo "No pom.xml files with found" >&2; exit 1; + fi + echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + for f in $FILES; do + sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" + done + echo "Post-update values:"; grep -R "" $FILES || true + echo "(Not committing these changes)" + shell: bash + - name: Deleting the sdm directory for fresh build run: | pwd @@ -68,27 +85,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Dry Run Validation (cds.services.version 4.3.1) - env: - TARGET_CDS_SERVICES_VERSION: 4.3.1 - run: | - set -e - echo "== Dry Run Validation Start ==" - ROOT_VAL=$(grep -m1 -oP '(?<=)[^<]+' pom.xml || true) - if [ "$ROOT_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then - echo "Root pom mismatch: $ROOT_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi - echo "Root pom.xml OK: $ROOT_VAL" - echo "Evaluating via mvn help:evaluate..." - MVN_VAL=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) - if [ "$MVN_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then - echo "help:evaluate mismatch: $MVN_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi - echo "Property resolution OK ($MVN_VAL)" - echo "Downloading dependencies (go-offline)..." - mvn -B -U -DskipTests dependency:go-offline - echo "Compiling (skip tests) ..." - mvn -B -q -DskipTests -DskipITs=true -DskipIntegrationTests=true -DskipUnitTests=true -pl sdm -am compile - echo "== Dry Run Validation Success ==" - shell: bash # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) # run: | From 991541452e83d05257ad5a2d9174bb986c49b4bd Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:46:01 +0530 Subject: [PATCH 13/19] disabled the merge event --- .github/workflows/singleTenant_deploy_and_Integration_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 55956f11..76e851d2 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -13,7 +13,7 @@ permissions: jobs: deploy: - if: github.event.pull_request.merged == true + if: github.event.pull_request.merged == false runs-on: ubuntu-latest steps: From dd04d3cac3446a5b18146d42327e1fbb89f9e6cf Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:47:11 +0530 Subject: [PATCH 14/19] disabled the merge event --- .../workflows/singleTenant_deploy_and_Integration_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 76e851d2..43533db5 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -18,8 +18,8 @@ jobs: steps: - - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. - run: sleep 300 + # - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. + # run: sleep 300 - name: Checkout repository uses: actions/checkout@v2 From 56da6890b2e64d8aaf8673f26fa5aa2757424ab7 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:50:36 +0530 Subject: [PATCH 15/19] disabled the merge event --- ...ngleTenant_deploy_and_Integration_test.yml | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 43533db5..6dcc9b3c 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -46,17 +46,49 @@ jobs: env: TARGET_CDS_SERVICES_VERSION: 4.3.1 run: | - echo "Override requested: cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" + set -e + echo "=== cds.services.version Override Step ===" + echo "Target version to apply: ${TARGET_CDS_SERVICES_VERSION}" FILES=$(grep -Rl "" . | grep pom.xml || true) if [ -z "$FILES" ]; then echo "No pom.xml files with found" >&2; exit 1; fi - echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + echo "POM files containing property:"; echo "$FILES" | sed 's/^/ - /' + + echo "\nCurrent raw occurrences BEFORE override:" + for f in $FILES; do + # Show each occurrence with line number (first 3 if multiple) + MATCHES=$(grep -n "" "$f" | head -3 || true) + if [ -n "$MATCHES" ]; then + echo "--- $f"; echo "$MATCHES" + fi + done + + echo "\nResolving effective value BEFORE override via mvn help:evaluate ..." + RESOLVED_BEFORE=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version before override: '${RESOLVED_BEFORE}'" + if [ "${RESOLVED_BEFORE}" = "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "NOTE: Effective value already equals target; files will still be normalized to target string." + fi + + echo "\nApplying override ..." + # Perform in-place replacement for each file for f in $FILES; do sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" done - echo "Post-update values:"; grep -R "" $FILES || true + + echo "\nRaw occurrences AFTER override:" + grep -R "" $FILES || true + + echo "\nResolving effective value AFTER override via mvn help:evaluate ..." + RESOLVED_AFTER=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version after override: '${RESOLVED_AFTER}'" + if [ "${RESOLVED_AFTER}" != "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "WARNING: Resolved value does not match target (profiles or parent POM could be overriding it)." >&2 + fi + echo "(Not committing these changes)" + echo "=== Override Step Complete ===" shell: bash # - name: Deleting the sdm directory for fresh build From b40a9f203559a253c2092a91ff904417f23f3c5b Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:53:32 +0530 Subject: [PATCH 16/19] disabled the merge event --- ...ngleTenant_deploy_and_Integration_test.yml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 6dcc9b3c..06000cba 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -32,15 +32,20 @@ jobs: java-version: 17 distribution: 'temurin' - - name: Verify and Checkout Deploy Branch + # - name: Verify and Checkout Deploy Branch + # run: | + # git fetch origin + # if git rev-parse --verify origin/develop_deploy; then + # git checkout develop_deploy + # else + # echo "Branch 'develop_deploy' not found. Please verify the branch name." + # exit 1 + # fi + - name: Clone the cloud-cap-samples-java repo 🌐 run: | - git fetch origin - if git rev-parse --verify origin/develop_deploy; then - git checkout develop_deploy - else - echo "Branch 'develop_deploy' not found. Please verify the branch name." - exit 1 - fi + echo "πŸ”„ Cloning repository..." + git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git + echo "βœ… Repository cloned!" - name: Override cds.services.version (runtime only) env: From ff812e18a413d80eb592c7045c27a8ebdaa5850c Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:08:53 +0530 Subject: [PATCH 17/19] Updated the workflow files --- .../workflows/multi tenancy_Integration.yml | 9 +- .github/workflows/multiTenancyDeployLocal.yml | 11 +- ...loy_and_Integration_test_LatestVersion.yml | 64 ++- ...ngleTenant_deploy_and_Integration_test.yml | 388 ++++++++---------- ...loy_and_Integration_test_LatestVersion.yml | 41 +- .../singleTenant_integration_test.yml | 4 +- 6 files changed, 263 insertions(+), 254 deletions(-) diff --git a/.github/workflows/multi tenancy_Integration.yml b/.github/workflows/multi tenancy_Integration.yml index 4145a771..8aef98aa 100644 --- a/.github/workflows/multi tenancy_Integration.yml +++ b/.github/workflows/multi tenancy_Integration.yml @@ -56,8 +56,7 @@ jobs: -u ${{ secrets.CF_USER }} \ -p ${{ secrets.CF_PASSWORD }} \ -o ${{ secrets.CF_ORG }} \ - -s ${{ secrets.CF_SPACE }} - # -s ${{ steps.determine_space.outputs.space }} + -s ${{ steps.determine_space.outputs.space }} - name: Fetch and Escape Client Details for single tenant πŸ” id: fetch_credentials @@ -137,8 +136,8 @@ jobs: echo "πŸš€ Starting integration tests..." set -e PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" + appUrl="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + appUrlMT="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com" authUrl="${{ secrets.CAPAUTH_URL }}" authUrlMT1="${{ secrets.AUTHURLMT1 }}" authUrlMT2="${{ secrets.AUTHURLMT2 }}" @@ -195,4 +194,4 @@ jobs: mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests - echo "βœ… Integration tests completed!" + echo "βœ… Integration tests completed!" \ No newline at end of file diff --git a/.github/workflows/multiTenancyDeployLocal.yml b/.github/workflows/multiTenancyDeployLocal.yml index a98c79df..065a4b48 100644 --- a/.github/workflows/multiTenancyDeployLocal.yml +++ b/.github/workflows/multiTenancyDeployLocal.yml @@ -8,6 +8,10 @@ on: required: true default: 'developcap' + deploy_branch: + description: 'Specify the branch to deploy' + required: false + permissions: pull-requests: read packages: read # Added permission to read packages @@ -20,6 +24,9 @@ jobs: - name: Checkout this repository πŸ“ uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.deploy_branch }} + - name: Set up JDK 21 β˜• uses: actions/setup-java@v3 @@ -82,7 +89,7 @@ jobs: # Login to Cloud Foundry again to ensure session is active echo "πŸ”‘ Logging in to Cloud Foundry..." - 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 }} + cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ github.event.inputs.cf_space }} echo "βœ… Logged in successfully!" # Deploy the application @@ -91,4 +98,4 @@ jobs: ls -lrth echo "▢️ Running cf deploy..." cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f - echo "βœ… Deployment complete!" + echo "βœ… Deployment complete!" \ No newline at end of file diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml index 58c374f3..ab0b5e74 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test_LatestVersion.yml @@ -20,11 +20,6 @@ jobs: runs-on: ubuntu-latest steps: - - - name: Wait for 30 sec ⏳ - run: | - sleep 30 - echo "⏳ Waiting for snapshot deployment... Initiating deployment in 30 sec." - name: Checkout this repository πŸ“ uses: actions/checkout@v2 @@ -57,31 +52,64 @@ jobs: echo "πŸ”„ Cloning repository..." git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git echo "βœ… Repository cloned!" - - - - name: Change directory to cloud-cap-samples-java πŸ“‚ - working-directory: cloud-cap-samples-java - run: | - pwd - echo "βœ”οΈ Directory changed!" - - - name: Override cds.services.version to 4.3.1 (runtime only) + + - name: Override cds.services.version (runtime only) env: TARGET_CDS_SERVICES_VERSION: 4.3.1 run: | - echo "Overriding cds.services.version -> ${TARGET_CDS_SERVICES_VERSION}" + set -e + echo "=== cds.services.version Override Step ===" + echo "Target version to apply: ${TARGET_CDS_SERVICES_VERSION}" FILES=$(grep -Rl "" . | grep pom.xml || true) if [ -z "$FILES" ]; then echo "No pom.xml files with found" >&2; exit 1; fi - echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + echo "POM files containing property:"; echo "$FILES" | sed 's/^/ - /' + + echo "\nCurrent raw occurrences BEFORE override:" + for f in $FILES; do + # Show each occurrence with line number (first 3 if multiple) + MATCHES=$(grep -n "" "$f" | head -3 || true) + if [ -n "$MATCHES" ]; then + echo "--- $f"; echo "$MATCHES" + fi + done + + echo "\nResolving effective value BEFORE override via mvn help:evaluate ..." + RESOLVED_BEFORE=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version before override: '${RESOLVED_BEFORE}'" + if [ "${RESOLVED_BEFORE}" = "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "NOTE: Effective value already equals target; files will still be normalized to target string." + fi + + echo "\nApplying override ..." + # Perform in-place replacement for each file for f in $FILES; do sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" done - echo "Post-update values:"; grep -R "" $FILES - echo "NOTE: Not committing these changes; runtime only." + + echo "\nRaw occurrences AFTER override:" + grep -R "" $FILES || true + + echo "\nResolving effective value AFTER override via mvn help:evaluate ..." + RESOLVED_AFTER=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version after override: '${RESOLVED_AFTER}'" + if [ "${RESOLVED_AFTER}" != "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "WARNING: Resolved value does not match target (profiles or parent POM could be overriding it)." >&2 + fi + + echo "(Not committing these changes)" + echo "=== Override Step Complete ===" shell: bash + + - name: Change directory to cloud-cap-samples-java πŸ“‚ + working-directory: cloud-cap-samples-java + run: | + pwd + echo "βœ”οΈ Directory changed!" + + - name: Run mbt build πŸ”¨ working-directory: cloud-cap-samples-java run: | diff --git a/.github/workflows/singleTenant_deploy_and_Integration_test.yml b/.github/workflows/singleTenant_deploy_and_Integration_test.yml index 06000cba..7a08f41f 100644 --- a/.github/workflows/singleTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/singleTenant_deploy_and_Integration_test.yml @@ -1,10 +1,10 @@ name: Single Tenant Deploy and Integration Test on: - # pull_request: - # types: [closed] - # branches: - # - develop + pull_request: + types: [closed] + branches: + - develop workflow_dispatch: permissions: @@ -13,13 +13,13 @@ permissions: jobs: deploy: - if: github.event.pull_request.merged == false + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - # - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. - # run: sleep 300 + - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. + run: sleep 300 - name: Checkout repository uses: actions/checkout@v2 @@ -32,238 +32,184 @@ jobs: java-version: 17 distribution: 'temurin' - # - name: Verify and Checkout Deploy Branch - # run: | - # git fetch origin - # if git rev-parse --verify origin/develop_deploy; then - # git checkout develop_deploy - # else - # echo "Branch 'develop_deploy' not found. Please verify the branch name." - # exit 1 - # fi - - name: Clone the cloud-cap-samples-java repo 🌐 + - name: Verify and Checkout Deploy Branch run: | - echo "πŸ”„ Cloning repository..." - git clone --depth 1 --branch mtTests https://github.com/vibhutikumar07/cloud-cap-samples-java.git - echo "βœ… Repository cloned!" - - - name: Override cds.services.version (runtime only) - env: - TARGET_CDS_SERVICES_VERSION: 4.3.1 - run: | - set -e - echo "=== cds.services.version Override Step ===" - echo "Target version to apply: ${TARGET_CDS_SERVICES_VERSION}" - FILES=$(grep -Rl "" . | grep pom.xml || true) - if [ -z "$FILES" ]; then - echo "No pom.xml files with found" >&2; exit 1; + git fetch origin + if git rev-parse --verify origin/develop_deploy; then + git checkout develop_deploy + else + echo "Branch 'develop_deploy' not found. Please verify the branch name." + exit 1 fi - echo "POM files containing property:"; echo "$FILES" | sed 's/^/ - /' - - echo "\nCurrent raw occurrences BEFORE override:" - for f in $FILES; do - # Show each occurrence with line number (first 3 if multiple) - MATCHES=$(grep -n "" "$f" | head -3 || true) - if [ -n "$MATCHES" ]; then - echo "--- $f"; echo "$MATCHES" - fi - done - - echo "\nResolving effective value BEFORE override via mvn help:evaluate ..." - RESOLVED_BEFORE=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) - echo "Effective cds.services.version before override: '${RESOLVED_BEFORE}'" - if [ "${RESOLVED_BEFORE}" = "${TARGET_CDS_SERVICES_VERSION}" ]; then - echo "NOTE: Effective value already equals target; files will still be normalized to target string." - fi - - echo "\nApplying override ..." - # Perform in-place replacement for each file - for f in $FILES; do - sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" - done - - echo "\nRaw occurrences AFTER override:" - grep -R "" $FILES || true - echo "\nResolving effective value AFTER override via mvn help:evaluate ..." - RESOLVED_AFTER=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) - echo "Effective cds.services.version after override: '${RESOLVED_AFTER}'" - if [ "${RESOLVED_AFTER}" != "${TARGET_CDS_SERVICES_VERSION}" ]; then - echo "WARNING: Resolved value does not match target (profiles or parent POM could be overriding it)." >&2 - fi - - echo "(Not committing these changes)" - echo "=== Override Step Complete ===" - shell: bash - - # - name: Deleting the sdm directory for fresh build - # run: | - # pwd - # cd - # rm -rf .m2/repository/com/sap/cds + - name: Deleting the sdm directory for fresh build + run: | + pwd + cd + rm -rf .m2/repository/com/sap/cds - # - name: Configure Maven for GitHub Packages - # run: | - # mkdir -p ~/.m2 - # cat > ~/.m2/settings.xml < - # - # - # github-snapshot - # ${{ github.actor }} - # ${{ secrets.GITHUB_TOKEN }} - # - # - # - # EOF - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) - # # run: | - # # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - # # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + - name: Configure Maven for GitHub Packages + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml < + + + github-snapshot + ${{ github.actor }} + ${{ secrets.GITHUB_TOKEN }} + + + + EOF + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) + # run: | + # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm + # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - # - name: Prepare and Deploy to Cloud Foundry - # run: | - # echo "Current Branch......" - # git branch - # pwd - # cd /home/runner/work/sdm/sdm/cap-notebook/demoapp - # # Removing node_modules & package-lock.json - # cd app - # rm -rf node_modules package-lock.json + - name: Prepare and Deploy to Cloud Foundry + run: | + echo "Current Branch......" + git branch + pwd + cd /home/runner/work/sdm/sdm/cap-notebook/demoapp + # Removing node_modules & package-lock.json + cd app + rm -rf node_modules package-lock.json - # npm i + npm i - # cd .. + cd .. - # # Replace placeholder with actual REPOSITORY_ID value - # sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml + # Replace placeholder with actual REPOSITORY_ID value + sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml - # wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - # tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - # sudo mv mbt /usr/local/bin/ + wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz + sudo mv mbt /usr/local/bin/ - # mbt build + mbt build - # # Install cf & login - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ - # | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - # echo "deb https://packages.cloudfoundry.org/debian stable main" \ - # | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt update - # sudo apt install cf-cli + # Install cf & login + wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ + | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc + echo "deb https://packages.cloudfoundry.org/debian stable main" \ + | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list + sudo apt update + sudo apt install cf-cli - # # Install cf CLI plugin - # cf install-plugin multiapps -f + # Install cf CLI plugin + cf install-plugin multiapps -f - # # Login to Cloud Foundry again to ensure session is active - # cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} + # Login to Cloud Foundry again to ensure session is active + cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - # # Deploy the application - # echo "Running cf deploy" - # cf deploy mta_archives/demoappjava_1.0.0.mtar -f + # Deploy the application + echo "Running cf deploy" + cf deploy mta_archives/demoappjava_1.0.0.mtar -f - # integration-test: - # needs: deploy - # runs-on: ubuntu-latest + integration-test: + needs: deploy + runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v2 + steps: + - name: Checkout repository + uses: actions/checkout@v2 - # - name: Set up Java 17 - # uses: actions/setup-java@v3 - # with: - # java-version: 17 - # distribution: 'temurin' + - name: Set up Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' - # - name: Install Cloud Foundry CLI and jq - # run: | - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt-get update - # sudo apt-get install cf8-cli jq - # - name: Login to Cloud Foundry - # run: | - # cf login -a ${{ secrets.CF_API }} \ - # -u ${{ secrets.CF_USER }} \ - # -p ${{ secrets.CF_PASSWORD }} \ - # -o ${{ secrets.CF_ORG }} \ - # -s ${{ secrets.CF_SPACE }} - # - name: Fetch and Escape Client Details for single tenant πŸ” - # id: fetch_credentials - # run: | - # echo "Fetching client details for single tenant..." - # service_instance_guid=$(cf service demoappjava-public-uaa --guid) - # if [ -z "$service_instance_guid" ]; then - # echo "❌ Error: Unable to retrieve service instance GUID"; exit 1; - # fi - # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - # binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid') - # if [ -z "$binding_guid" ]; then - # echo "❌ Error: Unable to retrieve binding GUID"; exit 1; - # fi - # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - # clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - # if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - # echo "❌ Error: clientSecret is not set or is null"; exit 1; - # fi - # escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - # echo "::add-mask::$escapedClientSecret" - # clientID=$(echo "$binding_details" | jq -r '.credentials.clientid') - # if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then - # echo "❌ Error: clientID is not set or is null"; exit 1; - # fi - # echo "::add-mask::$clientID" - # echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - # echo "::set-output name=CLIENT_ID::$clientID" - # echo "βœ… Client details fetched successfully!" - # - name: Run integration tests 🎯 - # env: - # CLIENT_SECRET: ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }} - # CLIENT_ID: ${{ steps.fetch_credentials.outputs.CLIENT_ID }} - # run: | - # echo "πŸš€ Starting integration tests..." - # set -e - # PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - # appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - # authUrl="${{ secrets.CAPAUTH_URL }}" - # clientID="${{ env.CLIENT_ID }}" - # clientSecret="${{ env.CLIENT_SECRET }}" - # username="${{ secrets.CF_USER }}" - # password="${{ secrets.CF_PASSWORD }}" - # noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - # noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - # echo "::add-mask::$clientSecret" - # echo "::add-mask::$clientID" - # echo "::add-mask::$username" - # echo "::add-mask::$password" - # echo "::add-mask::$noSDMRoleUsername" - # echo "::add-mask::$noSDMRoleUserPassword" - # if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi - # if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi - # if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi - # if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi - # if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi - # if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi - # if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi - # if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi - # cat > "$PROPERTIES_FILE" < "$PROPERTIES_FILE" < ${TARGET_CDS_SERVICES_VERSION}" + set -e + echo "=== cds.services.version Override Step ===" + echo "Target version to apply: ${TARGET_CDS_SERVICES_VERSION}" FILES=$(grep -Rl "" . | grep pom.xml || true) if [ -z "$FILES" ]; then echo "No pom.xml files with found" >&2; exit 1; fi - echo "Updating files:"; echo "$FILES" | sed 's/^/ - /' + echo "POM files containing property:"; echo "$FILES" | sed 's/^/ - /' + + echo "\nCurrent raw occurrences BEFORE override:" + for f in $FILES; do + # Show each occurrence with line number (first 3 if multiple) + MATCHES=$(grep -n "" "$f" | head -3 || true) + if [ -n "$MATCHES" ]; then + echo "--- $f"; echo "$MATCHES" + fi + done + + echo "\nResolving effective value BEFORE override via mvn help:evaluate ..." + RESOLVED_BEFORE=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version before override: '${RESOLVED_BEFORE}'" + if [ "${RESOLVED_BEFORE}" = "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "NOTE: Effective value already equals target; files will still be normalized to target string." + fi + + echo "\nApplying override ..." + # Perform in-place replacement for each file for f in $FILES; do sed -i "s|[^<]*|${TARGET_CDS_SERVICES_VERSION}|" "$f" done - echo "Post-update values:"; grep -R "" $FILES || true + + echo "\nRaw occurrences AFTER override:" + grep -R "" $FILES || true + + echo "\nResolving effective value AFTER override via mvn help:evaluate ..." + RESOLVED_AFTER=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) + echo "Effective cds.services.version after override: '${RESOLVED_AFTER}'" + if [ "${RESOLVED_AFTER}" != "${TARGET_CDS_SERVICES_VERSION}" ]; then + echo "WARNING: Resolved value does not match target (profiles or parent POM could be overriding it)." >&2 + fi + echo "(Not committing these changes)" + echo "=== Override Step Complete ===" shell: bash - name: Deleting the sdm directory for fresh build diff --git a/.github/workflows/singleTenant_integration_test.yml b/.github/workflows/singleTenant_integration_test.yml index a903587b..591e5753 100644 --- a/.github/workflows/singleTenant_integration_test.yml +++ b/.github/workflows/singleTenant_integration_test.yml @@ -95,7 +95,7 @@ jobs: echo "πŸš€ Starting integration tests..." set -e PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" + appUrl="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" authUrl="${{ secrets.CAPAUTH_URL }}" clientID="${{ env.CLIENT_ID }}" clientSecret="${{ env.CLIENT_SECRET }}" @@ -130,4 +130,4 @@ jobs: echo "🎯 Running Maven integration tests..." # Run Maven integration tests mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=single -DskipUnitTests || { echo "❌ Maven tests failed for Named User Flow"; exit 1; } - mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=single -DskipUnitTests || { echo "❌ Maven tests failed for Technical User Flow"; exit 1; } + mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=single -DskipUnitTests || { echo "❌ Maven tests failed for Technical User Flow"; exit 1; } \ No newline at end of file From 9cb52dbdad96a1da9d013285f294494623013519 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:10:09 +0530 Subject: [PATCH 18/19] enabled the merge condition --- .github/workflows/multiTenant_deploy_and_Integration_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/multiTenant_deploy_and_Integration_test.yml b/.github/workflows/multiTenant_deploy_and_Integration_test.yml index 5b75b3fb..364cda92 100644 --- a/.github/workflows/multiTenant_deploy_and_Integration_test.yml +++ b/.github/workflows/multiTenant_deploy_and_Integration_test.yml @@ -13,7 +13,7 @@ permissions: jobs: deploy: - if: github.event.pull_request.merged == false + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: From 924b11c713142641f5b3414ac583664afbffaed7 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:12:29 +0530 Subject: [PATCH 19/19] Update new_wokflow_test.yml --- .github/workflows/new_wokflow_test.yml | 236 +------------------------ 1 file changed, 7 insertions(+), 229 deletions(-) diff --git a/.github/workflows/new_wokflow_test.yml b/.github/workflows/new_wokflow_test.yml index c4acb953..1c6856d0 100644 --- a/.github/workflows/new_wokflow_test.yml +++ b/.github/workflows/new_wokflow_test.yml @@ -1,241 +1,19 @@ -name: Single Tenant Deploy and Integration Test LatestVersion +name: Check Release Branch Names -# This workflow now runs ONLY after the main "Single Tenant Deploy and Integration Test" workflow -# (deploy_and_Integration_test.yml) has completed successfully. It can still be -# triggered manually via workflow_dispatch if needed. on: workflow_run: workflows: ["Single Tenant Deploy and Integration Test"] types: [completed] workflow_dispatch: - -permissions: - pull-requests: read - packages: read # Added permission to read packages - jobs: - deploy: - # Run only if the triggering workflow concluded successfully + check_release_branches: if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - - - name: Wait for 5 minutes # Added a 5-minute delay to ensure the snapshot is deployed successfully before initiating the deployment job. - run: sleep 300 - - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: develop - - - name: Set up Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - - - name: Verify and Checkout Deploy Branch - run: | - git fetch origin - if git rev-parse --verify origin/develop_deploy; then - git checkout develop_deploy - else - echo "Branch 'develop_deploy' not found. Please verify the branch name." - exit 1 - fi - - - name: Dry Run Validation (cds.services.version 4.3.1) - env: - TARGET_CDS_SERVICES_VERSION: 4.3.1 - run: | - set -e - echo "== Dry Run Validation Start ==" - ROOT_VAL=$(grep -m1 -oP '(?<=)[^<]+' pom.xml || true) - if [ "$ROOT_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then - echo "Root pom mismatch: $ROOT_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi - echo "Root pom.xml OK: $ROOT_VAL" - echo "Evaluating via mvn help:evaluate..." - MVN_VAL=$(mvn -q -DforceStdout help:evaluate -Dexpression=cds.services.version || true) - if [ "$MVN_VAL" != "$TARGET_CDS_SERVICES_VERSION" ]; then - echo "help:evaluate mismatch: $MVN_VAL != $TARGET_CDS_SERVICES_VERSION" >&2; exit 1; fi - echo "Property resolution OK ($MVN_VAL)" - echo "Downloading dependencies (go-offline)..." - mvn -B -U -DskipTests dependency:go-offline - echo "Compiling (skip tests) ..." - mvn -B -q -DskipTests -DskipITs=true -DskipIntegrationTests=true -DskipUnitTests=true -pl sdm -am compile - echo "== Dry Run Validation Success ==" - shell: bash - - # - name: Deleting the sdm directory for fresh build - # run: | - # pwd - # cd - # rm -rf .m2/repository/com/sap/cds - - # - name: Configure Maven for GitHub Packages - # run: | - # mkdir -p ~/.m2 - # cat > ~/.m2/settings.xml < - # - # - # github-snapshot - # ${{ github.actor }} - # ${{ secrets.GITHUB_TOKEN }} - # - # - # - # EOF - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - # # - name: Consume GitHub Packages (com.sap.cds.sdm-root and com.sap.cds.sdm) - # # run: | - # # mvn dependency:get -Dartifact=com.sap.cds:sdm-root:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - # # mvn dependency:get -Dartifact=com.sap.cds:sdm:LATEST -DrepoUrl=https://maven.pkg.github.com/cap-java/sdm - - # - name: Prepare and Deploy to Cloud Foundry - # run: | - # echo "Current Branch......" - # git branch - # pwd - # cd /home/runner/work/sdm/sdm/cap-notebook/demoapp - # # Removing node_modules & package-lock.json - # cd app - # rm -rf node_modules package-lock.json - - # npm i - - # cd .. - - # # Replace placeholder with actual REPOSITORY_ID value - # sed -i 's|__REPOSITORY_ID__|'${{ steps.set_repository_id.outputs.repository_id }}'|g' ./mta.yaml - - # wget -P /tmp https://github.com/SAP/cloud-mta-build-tool/releases/download/v1.2.28/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - # tar -xvzf /tmp/cloud-mta-build-tool_1.2.28_Linux_amd64.tar.gz - # sudo mv mbt /usr/local/bin/ - - # mbt build - - # # Install cf & login - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key \ - # | sudo tee /etc/apt/trusted.gpg.d/cloudfoundry.asc - # echo "deb https://packages.cloudfoundry.org/debian stable main" \ - # | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt update - # sudo apt install cf-cli - - # # Install cf CLI plugin - # cf install-plugin multiapps -f - - # # Login to Cloud Foundry again to ensure session is active - # cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE }} - - # # Deploy the application - # echo "Running cf deploy" - # cf deploy mta_archives/demoappjava_1.0.0.mtar -f - - # integration-test: - # needs: deploy - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout repository - # uses: actions/checkout@v2 - - # - name: Set up Java 17 - # uses: actions/setup-java@v3 - # with: - # java-version: 17 - # distribution: 'temurin' + - name: Checkout repository + uses: actions/checkout@v2 - # - name: Install Cloud Foundry CLI and jq - # run: | - # wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - # echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - # sudo apt-get update - # sudo apt-get install cf8-cli jq - # - name: Login to Cloud Foundry - # run: | - # cf login -a ${{ secrets.CF_API }} \ - # -u ${{ secrets.CF_USER }} \ - # -p ${{ secrets.CF_PASSWORD }} \ - # -o ${{ secrets.CF_ORG }} \ - # -s ${{ secrets.CF_SPACE }} - # - name: Fetch and Escape Client Secret - # id: fetch_secret - # run: | - # # Fetch the service instance GUID - # service_instance_guid=$(cf service demoappjava-public-uaa --guid) - # if [ -z "$service_instance_guid" ]; then - # echo "Error: Unable to retrieve service instance GUID"; exit 1; - # fi - # # Fetch the binding GUID - # bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}") - - # binding_guid=$(echo $bindings_response | jq -r '.resources[0].guid') - # if [ -z "$binding_guid" ]; then - # echo "Error: Unable to retrieve binding GUID"; exit 1; - # fi - - # # Fetch the clientSecret - # binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details") - # clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret') - # if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then - # echo "Error: clientSecret is not set or is null"; exit 1; - # fi - - # # Escape any $ characters in the clientSecret - # escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g') - # echo "::set-output name=CLIENT_SECRET::$escapedClientSecret" - # - name: Run integration tests - # env: - # CLIENT_SECRET: ${{ steps.fetch_secret.outputs.CLIENT_SECRET }} - # run: | - # set -e # Enable error checking - # PROPERTIES_FILE="sdm/src/test/resources/credentials.properties" - # # Gather secrets and other values - # appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com" - # authUrl="${{ secrets.CAPAUTH_URL }}" - # clientID="${{ secrets.CAPSDM_CLIENT_ID }}" - # clientSecret="${{ env.CLIENT_SECRET }}" - # username="${{ secrets.CF_USER }}" - # password="${{ secrets.CF_PASSWORD }}" - # noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}" - # noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}" - # # Ensure all required variables are set - # if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi - # if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi - # if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi - # if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi - # if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi - # if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi - # if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi - # if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi - # # Function to partially mask sensitive information for logging - # mask() { - # local value="$1" - # if [ ${#value} -gt 6 ]; then - # echo "${value:0:3}*****${value: -3}" - # else - # echo "${value:0:2}*****" - # fi - # } - # # Update properties file with real values - # cat > "$PROPERTIES_FILE" <