Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 15 additions & 19 deletions .github/workflows/deploy-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,43 @@ jobs:
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
steps:
- name: Determine environment-specific variables
id: determine-environment
shell: bash
run: |
REF=${{ github.ref }}

if [ $REF = 'refs/heads/main' ]; then
ENVNAME='production'
ENVCODE='demo-magento2'
MIDDLEWARE_URL='https://demo-magento2.europe-west1.gcp.vuestorefront.cloud/api/'
ENVINFO_FILE=production

elif [ $REF = 'refs/heads/develop' ]; then
ENVNAME='dev'
ENVCODE='demo-magento2-dev'
MIDDLEWARE_URL='https://demo-magento2-dev.europe-west1.gcp.storefrontcloud.io/api/'
ENVINFO_FILE=dev

elif [[ $REF = refs/heads/release* ]]; then
ENVNAME='canary'
ENVCODE='demo-magento2-canary'
MIDDLEWARE_URL='https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io/api/'
ENVINFO_FILE=canary

elif [ $REF = 'refs/heads/enterprise' ]; then
ENVNAME='enterprise'
ENVCODE='demo-magento2-enterprise'
MIDDLEWARE_URL='https://demo-magento2-enterprise.europe-west1.gcp.storefrontcloud.io/api/'
ENVINFO_FILE=enterprise

else
echo 'unrecognized branch name'
exit 1
echo 'unrecognized branch name'
exit 1
fi

echo ::set-output name=name::$ENVNAME
echo ::set-output name=code::$ENVCODE
echo ::set-output name=middleware-url::$MIDDLEWARE_URL
cat .github/workflows/public_env_info/$ENVINFO_FILE >> $GITHUB_ENV
Copy link
Contributor Author

Choose a reason for hiding this comment

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

environment-related env vars are now kept in separate files. Had I not done that, env info would be duplicated in the k6 action and in our regular deploy to Farmer action. It'd be more difficult to maintain


- id: determine-environment
run: |
echo ::set-output name=name::${{ env.ENVNAME }}
echo ::set-output name=code::${{ env.ENVCODE }}
echo ::set-output name=middleware-url::${{ env.MIDDLEWARE_URL }}

- name: Create GitHub deployment
id: deployment
uses: chrnorm/deployment-action@v2
with:
token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }}
environment: ${{ steps.determine-environment.outputs.name }}
environment: ${{ env.ENVNAME }}
initial-status: in_progress

build:
needs: create-deployment
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/public_env_info/canary
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVNAME=canary
ENVCODE=demo-magento2-canary
BASE_URL=https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io
MIDDLEWARE_URL=https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io/api
MAGENTO_GRAPHQL_URL=https://magento2-instance.vuestorefront.io:8443/graphql
5 changes: 5 additions & 0 deletions .github/workflows/public_env_info/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVNAME=dev
ENVCODE=demo-magento2-dev
BASE_URL=https://demo-magento2-dev.europe-west1.gcp.storefrontcloud.io
MIDDLEWARE_URL=https://demo-magento2-dev.europe-west1.gcp.storefrontcloud.io/api
MAGENTO_GRAPHQL_URL=https://magento2-instance.vuestorefront.io:8443/graphql
5 changes: 5 additions & 0 deletions .github/workflows/public_env_info/enterprise
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVNAME=enterprise
ENVCODE=demo-magento2-enterprise
BASE_URL=https://demo-magento2-enterprise.europe-west1.gcp.storefrontcloud.io
MIDDLEWARE_URL=https://demo-magento2-enterprise.europe-west1.gcp.storefrontcloud.io/api
MAGENTO_GRAPHQL_URL=https://magento2-instance.vuestorefront.io:8443/graphql
5 changes: 5 additions & 0 deletions .github/workflows/public_env_info/production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVNAME=production
ENVCODE=demo-magento2
BASE_URL=https://demo-magento2.europe-west1.gcp.vuestorefront.cloud
MIDDLEWARE_URL=https://demo-magento2.europe-west1.gcp.vuestorefront.cloud/api
MAGENTO_GRAPHQL_URL=https://magento2-instance.vuestorefront.io:8443/graphql
16 changes: 7 additions & 9 deletions .github/workflows/run-k6-load-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ on:
environment:
description: The full URL of the environment on which load tests will be ran
required: true
default: 'https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io'
type: choice
options:
- 'https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io'
- 'https://demo-magento2-dev.europe-west1.gcp.storefrontcloud.io'
- 'https://demo-magento2.europe-west1.gcp.storefrontcloud.cloud'
- 'https://demo-magento2-enterprise.europe-west1.gcp.storefrontcloud.io'
default: canary
type: environment

flags:
description: Additional argument and flags to provide to the k6 CLI. See https://k6.io/docs/using-k6/options for details.
Expand All @@ -40,10 +35,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Run k6 cloud test
- run: |
cat .github/workflows/public_env_info/${{ inputs.environment }} >> $GITHUB_ENV

- name: Run k6 test
uses: grafana/[email protected]
with:
cloud: ${{ github.event.inputs.cloud }}
token: ${{ secrets.K6_CLOUD_API_TOKEN }}
filename: ${{ github.event.inputs.filename }}
flags: -e BASE_URL=${{ github.event.inputs.environment }} ${{ github.event.inputs.flags }}
flags: -e BASE_URL=${{ env.BASE_URL }} -e MIDDLEWARE_URL=${{ env.MIDDLEWARE_URL }} -e MAGENTO_GRAPHQL_URL=${{ env.MAGENTO_GRAPHQL_URL }} ${{ github.event.inputs.flags }}