Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bfd292d
Add new preset
vcua-mobify Feb 24, 2025
6471df4
New workflow for bug bounty deploy
vcua-mobify Feb 26, 2025
bbaafa6
Fix indent
vcua-mobify Feb 26, 2025
810b7e2
Add runs-on
vcua-mobify Feb 26, 2025
1c4a6db
Install deps
vcua-mobify Feb 26, 2025
f8d52c7
temp remove step conditions
vcua-mobify Feb 26, 2025
ba8b951
set credentials file to default
vcua-mobify Feb 26, 2025
0c28536
Test version check
vcua-mobify Feb 26, 2025
d57a267
Trigger on Github release
vcua-mobify Feb 26, 2025
604e058
Test
vcua-mobify Feb 27, 2025
15283de
Test2
vcua-mobify Feb 27, 2025
ca3f3f9
test 3
vcua-mobify Feb 27, 2025
9df13a3
test 4
vcua-mobify Feb 27, 2025
40807d8
test5
vcua-mobify Feb 27, 2025
75044f5
test6
vcua-mobify Feb 27, 2025
60d36e1
test7
vcua-mobify Feb 27, 2025
91c131c
test8
vcua-mobify Feb 27, 2025
df36823
test9
vcua-mobify Feb 27, 2025
ad2d28e
test10
vcua-mobify Feb 27, 2025
85d897b
test11
vcua-mobify Feb 27, 2025
d868d2f
test12
vcua-mobify Feb 27, 2025
b08d3b7
test13
vcua-mobify Feb 27, 2025
375cadc
test 14
vcua-mobify Feb 27, 2025
4f97742
test 15
vcua-mobify Feb 27, 2025
f31a88e
test16
vcua-mobify Feb 27, 2025
a5d9b6b
test17
vcua-mobify Feb 27, 2025
daef558
test18
vcua-mobify Feb 27, 2025
a9c008d
test19
vcua-mobify Feb 27, 2025
b7abbbe
test20
vcua-mobify Feb 27, 2025
1e49dfb
test21
vcua-mobify Feb 27, 2025
b385868
test22
vcua-mobify Feb 27, 2025
6943664
test23
vcua-mobify Feb 27, 2025
9e00082
test24
vcua-mobify Feb 27, 2025
4c628b6
test25
vcua-mobify Feb 27, 2025
a4a234d
test26
vcua-mobify Feb 27, 2025
b96c79a
Restore actual changes
vcua-mobify Feb 27, 2025
3d66b85
Test by reversing condition
vcua-mobify Feb 27, 2025
272f034
Revert conditional to what we want
vcua-mobify Feb 27, 2025
c9b987c
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Feb 27, 2025
eed6885
apply suggestions + refactor
vcua-mobify Feb 27, 2025
b536282
flip condition for testing
vcua-mobify Feb 27, 2025
377aca5
Fix file structure
vcua-mobify Feb 27, 2025
36d6825
Add checkout
vcua-mobify Feb 27, 2025
a5e2d3b
Specify shell
vcua-mobify Feb 27, 2025
8f5583d
Set token as input
vcua-mobify Feb 27, 2025
5a47a8c
Checkout before node setup
vcua-mobify Feb 27, 2025
8c39519
Use correct condition
vcua-mobify Feb 27, 2025
0e512b8
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Feb 27, 2025
99dca1e
Allow custom bundle message on deploy
vcua-mobify Feb 28, 2025
8909da9
Add quotes
vcua-mobify Feb 28, 2025
809f673
Set tag name
vcua-mobify Feb 28, 2025
34e7bc1
Remove bracket
vcua-mobify Feb 28, 2025
81ea5a9
Update condition
vcua-mobify Feb 28, 2025
36ec0af
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Mar 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/actions/push_to_mrt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ inputs:
description: Project directory
default: ${{ github.workspace }}
TARGET:
description: MRT target
description: MRT target environment
FLAGS:
description: Push flags
PROJECT:
description: MRT target project
default: "scaffold-pwa"
runs:
using: composite
steps:
- name: Push Bundle to MRT
run: |-
cd ${{ inputs.CWD }}
project="scaffold-pwa"
build="build ${{ github.run_id }} on ${{ github.ref }} (${{ github.sha }})"
if [[ ${{ inputs.TARGET }} ]]; then
npm run push -- -s $project --message "$build" --target ${{ inputs.TARGET }} ${{ inputs.FLAGS }}
npm run push -- -s ${{ inputs.PROJECT }} --message "$build" --target ${{ inputs.TARGET }} ${{ inputs.FLAGS }}
fi
shell: bash
39 changes: 39 additions & 0 deletions .github/workflows/bug_bounty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: SalesforceCommerceCloud/pwa-kit/bug_bounty
on:
# Runs this job when a new Github release is published
# TODO: How do we ensure this only runs for the latest major version? We don't want to run this
# for a new v2 release. But due to policy, we are not allowed to use unverified marketplace actions
# such as https://github.com/marketplace/actions/version-check
release:
types: [released]

jobs:
deploy-bug-bounty:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Would you consider separating the jobs into two or create a separate GitHub Actions to avoid checking if: env.IS_LATEST_RELEASE == 'true' on each step?

Suggested change
jobs:
deploy-bug-bounty:
runs-on: ubuntu-latest
jobs:
check-latest-release:
runs-on: ubuntu-latest
...
deploy-bug-bounty:
needs: check-latest-release
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As suggested, I have separated the latest release check into a separate job.

Here is the flow working (when the condition to trigger is reversed so we proceed if the release is not latest, for testing purposes): https://github.com/SalesforceCommerceCloud/pwa-kit/actions/runs/13576833436/job/37954917447

And here is the flow failing (when the condition to trigger the flow is correct so that we only deploy on latest):
https://github.com/SalesforceCommerceCloud/pwa-kit/actions/runs/13576920319/job/37955192027

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach also allows us to add other deploy jobs to the workflow later on so this is a really good suggestion @adamraya !

steps:
- name: Checkout
uses: actions/checkout@v4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we missing defining the Node version so we make sure we use one of the MRT supported versions?

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm

Suggested change
- name: Setup Node
if: env.IS_LATEST_RELEASE == 'true'
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of relying on the pre-installed node so that we'd have less maintenance and not have to manually bump these node versions up but this is a fair point. We already have to update the node versions of other jobs manually so I'll add this

Copy link
Contributor

@adamraya adamraya Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple idea at least for the workflows like deploy_latest_release, setup_pwa_manual and setup_template_retail_react_app could be to create a .node-version file at the root:

22

And update the Setup node step to:

- name: Setup node
  id: setup_node
  uses: actions/setup-node@v4
  with:
    node-version-file: '.node-version'
    cache: "npm"

It seem like people is using that approach:
https://github.com/search?q=node-version-file%3A+%27.node-version%27+path%3A*.yml&type=code

- name: Install Monorepo Dependencies
run: |-
# Install node dependencies
node ./scripts/gtime.js monorepo_install npm ci

- name: Generate Retail App Demo
uses: ./.github/actions/e2e_generate_app
with:
PROJECT_KEY: "retail-react-app-bug-bounty"

- name: Create MRT credentials file
uses: "./.github/actions/create_mrt"
with:
mobify_user: ${{ secrets.MOBIFY_STG_CLIENT_USER }}
mobify_api_key: ${{ secrets.MOBIFY_STG_CLIENT_API_KEY }}

- name: Push Bundle to MRT (Bug Bounty)
uses: "./.github/actions/push_to_mrt"
with:
CWD: "../generated-projects/retail-react-app-bug-bounty"
TARGET: testing
PROJECT: pwa-kit
FLAGS: --cloud-origin https://cloud-testing.mobify-staging.com -c ~/.mobify --wait
2 changes: 2 additions & 0 deletions e2e/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ module.exports = {
},
],
"retail-app-private-client": [],
"retail-react-app-bug-bounty": [],
},
PRESET: {
"retail-app-private-client": "retail-react-app-private-slas-client",
"retail-react-app-bug-bounty": "retail-react-app-bug-bounty",
},
EXPECTED_GENERATED_ARTIFACTS: {
"retail-app-demo": [
Expand Down
3 changes: 2 additions & 1 deletion e2e/scripts/generate-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ program
'retail-app-demo',
'retail-app-ext',
'retail-app-no-ext',
'retail-app-private-client'
'retail-app-private-client',
'retail-react-app-bug-bounty'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leveraging the generate project script in the e2e directory but it may be a good idea in the future to move this if we continue to use the script for jobs other than the e2e test CI.

]
if (!validKeys.includes(value)) {
throw new Error('Invalid project key.')
Expand Down
25 changes: 25 additions & 0 deletions packages/pwa-kit-create-app/scripts/create-mobify-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,31 @@ const PRESETS = [
assets: ['translations'],
private: true
},
{
id: 'retail-react-app-bug-bounty',
name: 'Retail React App Bug Bounty Project',
description: '',
templateSource: {
type: TEMPLATE_SOURCE_NPM,
id: '@salesforce/retail-react-app'
},
questions: [...EXTENSIBILITY_QUESTIONS, ...HYBRID_QUESTIONS, ...RETAIL_REACT_APP_QUESTIONS],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need HYBRID_QUESTIONS in this preset?

Suggested change
questions: [...EXTENSIBILITY_QUESTIONS, ...HYBRID_QUESTIONS, ...RETAIL_REACT_APP_QUESTIONS],
questions: [...EXTENSIBILITY_QUESTIONS, ...RETAIL_REACT_APP_QUESTIONS],

answers: {
['project.extend']: true,
['project.hybrid']: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be false? The scope is to test Retail React App, not Hybrid scenarios.

Suggested change
['project.hybrid']: true,
['project.hybrid']: false,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. This is a PWA only site so I'll change this.

['project.name']: 'retail-react-app',
['project.commerce.instanceUrl']: 'https://zzec-006.dx.commercecloud.salesforce.com',
['project.commerce.clientId']: 'b56e7ad3-2237-42c9-8f55-41e63ebca420',
['project.commerce.siteId']: 'RefArch',
['project.commerce.organizationId']: 'f_ecom_zzec_006',
['project.commerce.shortCode']: 'staging-001',
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a different Einstein instance to avoid affecting the analytics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really have another Einstein instance set up for PWA tests so we use this one as a default.
This is the same Einstein instance we use in our day to day development so I don't think there'll be much of an impact if we send even more data from another test instance (which our bug bounty instance is) to it.

We can change this to a different instance if there is a need for us to specifically watch the Einstein events generated by the bug bounty instance.

['project.einstein.siteId']: 'aaij-MobileFirst',
['project.commerce.isSlasPrivate']: true
},
assets: ['translations'],
private: true
},
{
id: 'retail-react-app-hybrid-test-project',
name: 'Retail React App Hybrid Test Private SLAS Project',
Expand Down
Loading