Skip to content

Commit

Permalink
Merge branch 'develop' into epic/ssr-error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelfras committed Aug 29, 2024
2 parents a1979bc + e968054 commit c6d3a7a
Show file tree
Hide file tree
Showing 806 changed files with 29,812 additions and 3,926 deletions.
2 changes: 1 addition & 1 deletion .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1
version: 2
update_configs:
- package_manager: "javascript"
directory: "/"
Expand Down
11 changes: 10 additions & 1 deletion .env-cmdrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"CX_BASE_URL": "https://api.cp96avkh5f-integrati1-d1-public.model-t.cc.commerce.ondemand.com"
},
"cpq": {
"CX_BASE_URL": "https://api.cpce-teamtiger1-d2-public.model-t.cc.commerce.ondemand.com",
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s1-public.model-t.myhybris.cloud/",
"CX_B2B": "true",
"CX_CPQ": "true"
},
Expand All @@ -55,6 +55,10 @@
"CX_REQUESTED_DELIVERY_DATE": "true",
"CX_PDF_INVOICES": "true"
},
"omf":{
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s9-public.model-t.myhybris.cloud",
"CX_OMF": "true"
},
"requested-delivery-date": {
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud",
"CX_REQUESTED_DELIVERY_DATE": "true"
Expand All @@ -81,5 +85,10 @@
"opps":{
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s5-public.model-t.myhybris.cloud",
"CX_OPPS": "true"
},
"s4-service":{
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s1-public.model-t.myhybris.cloud",
"CX_S4_SERVICE": "true",
"CX_B2B": "true"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jobs:
- name: Notify the slack channel of when build conclusion failed
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: ${{ secrets.SLACK_NOTIFICATION_CHANNEL }}
payload: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ on:
schedule:
- cron: '45 2 * * *'


jobs:
analyze:
name: Analyze (${{ matrix.language }})

# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
Expand Down Expand Up @@ -62,6 +64,13 @@ jobs:
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config: |
name: Disable scan for tests
paths-ignore:
- "projects/storefrontapp-e2e-cypress/**"
- "**/*.spec.ts"
- "**/*.spec.js"
- "**/*_spec.ts"
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/update-cloud-repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Update Cloud Commerce Repository
on:
workflow_dispatch:
inputs:
version:
description: 'Enter the version to use'
required: true
npm_token:
description: 'Enter your npm token'
required: true
secret: true

env:
CONFIG_DIR: scripts/install
REPO_URL: https://${{secrets.GH_TEMPORARY_TOKEN}}@github.com/SAP-samples/cloud-commerce-sample-setup.git
NPM_REPO_URL: https://73554900100900004337.dev.npmsrv.base.repositories.cloud.sap/
OCC_BACKEND_URL: OCC_BACKEND_BASE_URL_VALUE

jobs:
run_script:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create storefronts
run: |
function setup_config_dir() {
[ -d "${CONFIG_DIR}" ]
cp "${CONFIG_DIR}/config.default.sh" "${CONFIG_DIR}/config.sh"
}
function update_config() {
local storefront_type=$1
local version=${{ github.event.inputs.version }}
local npm_token=${{ github.event.inputs.npm_token }}
# Update configuration values
if [ "${storefront_type}" == "b2c" ]; then
sed -i 's/^BASE_SITE=.*/BASE_SITE="electronics-spa"/' "${CONFIG_DIR}/config.sh"
sed -i 's/^SSR_APP_NAME=.*/SSR_APP_NAME="spartacusstore"/' "${CONFIG_DIR}/config.sh"
elif [ "${storefront_type}" == "b2b" ]; then
sed -i 's/^BASE_SITE=.*/BASE_SITE="powertools-spa"/' "${CONFIG_DIR}/config.sh"
sed -i 's/^SSR_APP_NAME=.*/SSR_APP_NAME="b2bspastore"/' "${CONFIG_DIR}/config.sh"
sed -i '/ADD_B2B_LIBS/c\ADD_B2B_LIBS=true' "${CONFIG_DIR}/config.sh"
else
echo "Invalid storefront type. BASE_SITE and SSR_APP_NAME not set."
fi
sed -i 's/^BACKEND_URL=.*/BACKEND_URL="'${OCC_BACKEND_URL}'"/' "${CONFIG_DIR}/config.sh"
sed -i "s/^SPARTACUS_VERSION=.*/SPARTACUS_VERSION='${version}'/" "${CONFIG_DIR}/config.sh"
sed -i "s/^NPM_TOKEN=.*/NPM_TOKEN='${npm_token}'/" "${CONFIG_DIR}/config.sh"
sed -i "s|^NPM_URL=.*|NPM_URL='${NPM_REPO_URL}'|" "${CONFIG_DIR}/config.sh"
}
# Rename the generated spartacus folders so we can have B2C and B2B folders
function rename_spartacus_folders() {
local version=${{ github.event.inputs.version }}
if [ "${storefront_type}" == "b2c" ]; then
mv ../spartacus-${version} ../spartacus-${version}-b2c
if [ -d "../spartacus-${version}-b2c" ]; then
echo "Renaming to ../spartacus-${version}-b2c was successful"
else
echo "Renaming to ../spartacus-${version}-b2c failed"
exit 1
fi
elif [ "${storefront_type}" == "b2b" ]; then
mv ../spartacus-${version} ../spartacus-${version}-b2b
if [ -d "../spartacus-${version}-b2b" ]; then
echo "Renaming to ../spartacus-${version}-b2b was successful"
else
echo "Renaming to ../spartacus-${version}-b2b failed"
exit 1
fi
fi
}
# Comment out the base url in the spartacus-configuration.module.ts file
function modify_file_to_remove_baseurl() {
local file_location="../spartacus-${{ github.event.inputs.version }}-${storefront_type}/apps/spartacusstore/src/app/spartacus/spartacus-configuration.module.ts"
if [ -f "${file_location}" ]; then
sed -i 's/baseUrl/\/\/baseUrl/1' "${file_location}"
echo "Modified ${file_location}."
else
echo "${file_location} does not exist."
exit 1
fi
}
storefront_types=("b2c" "b2b")
# Loop over storefront types
for storefront_type in "${storefront_types[@]}"; do
setup_config_dir
update_config $storefront_type
cd "${CONFIG_DIR}" && bash "./run.sh" install_npm
cd ../../
rename_spartacus_folders $storefront_type
modify_file_to_remove_baseurl $storefront_type
done
- name: Set Git user
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Commit changes
run: |
function clone_and_setup_repo() {
git clone $REPO_URL
cd cloud-commerce-sample-setup
# Get the current date and time
timestamp=$(date +%Y%m%d%H%M%S)
# Create a new branch with a unique name
branch_name="update_storefronts_$timestamp"
git checkout -b $branch_name
# Copy over the B2C and B2B content to the js-storefront folder and then commit the changes
rm -rf js-storefront/spartacusstore/*
cp -r ./../../spartacus-${{ github.event.inputs.version }}-b2c/apps/spartacusstore/* js-storefront/spartacusstore/
git add .
git commit -m "Updated content of js-storefront/spartacusstore"
rm -rf js-storefront/b2bspastore/*
cp -r ./../../spartacus-${{ github.event.inputs.version }}-b2b/apps/b2bspastore/* js-storefront/b2bspastore/
git add .
git commit -m "Updated content of js-storefront/b2bspastore"
git push -u $REPO_URL
}
clone_and_setup_repo
# Echo the branch name so it can be used in later steps
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Create Pull Request
run: |
curl -X POST -H "Authorization: token ${{ secrets.GH_TEMPORARY_TOKEN }}" -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/SAP-samples/cloud-commerce-sample-setup/pulls \
-d '{
"title": "Update js-storefronts content",
"body": "This PR updates the content of the js-storefronts.",
"head": "'"$branch_name"'",
"base": "main"
}'
4 changes: 2 additions & 2 deletions ci-scripts/e2e-cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if [[ "${SSR}" = true ]]; then
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
if [[ "${GITHUB_HEAD_REF}" == epic/* ]]; then
npm run e2e:run:ci:ssr
else
else
npm run e2e:run:ci:core:ssr
fi
else
Expand All @@ -106,7 +106,7 @@ else
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
if [[ "${GITHUB_HEAD_REF}" == epic/* ]]; then
npm run e2e:run:ci"${SUITE}"
else
else
npm run e2e:run:ci:core"${SUITE}"
fi
else
Expand Down
10 changes: 5 additions & 5 deletions core-libs/setup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/setup",
"version": "2211.25.1",
"version": "2211.28.0-1",
"description": "Includes features that makes Spartacus and it's setup easier and streamlined.",
"keywords": [
"spartacus",
Expand All @@ -21,10 +21,10 @@
"peerDependencies": {
"@angular/core": "^17.0.5",
"@angular/ssr": "^17.0.5",
"@spartacus/cart": "2211.25.1",
"@spartacus/core": "2211.25.1",
"@spartacus/order": "2211.25.1",
"@spartacus/user": "2211.25.1"
"@spartacus/cart": "2211.28.0-1",
"@spartacus/core": "2211.28.0-1",
"@spartacus/order": "2211.28.0-1",
"@spartacus/user": "2211.28.0-1"
},
"optionalDependencies": {
"@angular/platform-server": "^17.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ describe('OptimizedSsrEngine', () => {
"forcedSsrTimeout": 60000,
"maxRenderTime": 300000,
"reuseCurrentRendering": true,
"debug": false,
"renderingStrategyResolver": "() => ssr_optimization_options_1.RenderingStrategy.ALWAYS_SSR",
"logger": "DefaultExpressServerLogger",
"shouldCacheRenderingResult": "({ options, entry }) => !(options.featureToggles?.avoidCachingErrors === true && Boolean(entry.err))",
Expand Down Expand Up @@ -1469,7 +1468,6 @@ describe('OptimizedSsrEngine', () => {
"options": {
"cacheSize": 3000,
"concurrency": 10,
"debug": false,
"featureToggles": {
"avoidCachingErrors": false,
},
Expand Down
9 changes: 5 additions & 4 deletions core-libs/setup/ssr/optimized-engine/optimized-ssr-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,15 @@ export class OptimizedSsrEngine {
});
}

/**
* @deprecated since v2211.27 - This method will be private in the future.
*/
protected log(
message: string,
debug = true,
_ignoredLegacyDebugParameter = true,
context: ExpressServerLoggerContext
): void {
if (debug || this.ssrOptions?.debug) {
this.logger.log(message, context || {});
}
this.logger.log(message, context || {});
}

/** Retrieve the document from the cache or the filesystem */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ export interface SsrOptimizationOptions {
reuseCurrentRendering?: boolean;

/**
* Enable detailed logs for troubleshooting problems
* @deprecated - This flag is not used anymore since v2211.27.
*
* Now all the information about the traffic and rendering is logged unconditionally:
* - receiving requests
* - responding to requests (either with HTML result, error or fallback to CSR)
* - start and end of renders
* - timeout of renders (due to passing `maxRenderTime`)
*/
debug?: boolean;

Expand Down Expand Up @@ -188,7 +194,6 @@ export const defaultSsrOptimizationOptions: SsrOptimizationOptions &
forcedSsrTimeout: 60_000,
maxRenderTime: 300_000,
reuseCurrentRendering: true,
debug: false,
renderingStrategyResolver: defaultRenderingStrategyResolver(
defaultRenderingStrategyResolverOptions
),
Expand Down
Loading

0 comments on commit c6d3a7a

Please sign in to comment.