Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/deploy' into feat/storybook-…
Browse files Browse the repository at this point in the history
…deploy
  • Loading branch information
asvishnyakov committed Oct 4, 2023
2 parents 2e59247 + 89889fc commit 7738986
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 92 deletions.
29 changes: 0 additions & 29 deletions .deployment/storefront-app/argoDeploy.json

This file was deleted.

29 changes: 29 additions & 0 deletions .deployment/theme/cloudDeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"artifactKey": "vc-theme-b2b-vue",
"deployRepo": "vc-deploy-dev",
"cmPath": "backend/packages.json",
"dev": {
"deployAppName": "vcst-dev",
"deployBranch": "vcst-dev",
"environmentId": "dev",
"environmentName": "Development",
"environmentType": "staging",
"environmentUrl": "https://vcst-dev-storefront.paas.govirto.com/"
},
"qa": {
"deployAppName": "vcst-qa",
"deployBranch": "vcst-qa",
"environmentId": "qa",
"environmentName": "QA",
"environmentType": "testing",
"environmentUrl": "https://vcst-qa-storefront.paas.govirto.com/"
},
"prod": {
"deployAppName": "vcst-demo",
"deployBranch": "vcst-demo",
"environmentId": "prod",
"environmentName": "Demo",
"environmentType": "production",
"environmentUrl": "https://vcst-demo-storefront.paas.govirto.com/"
}
}
99 changes: 61 additions & 38 deletions .github/workflows/deploy.yml → .github/workflows/deploy-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,98 @@

name: VC deployment
on:
workflow_dispatch:
workflow_call:
inputs:
argoServer:
required: false
default: 'argo.virtocommerce.cloud'
type: string
artifactUrl:
description: 'Full link to artifact docker image or artifact download url'
required: true
deployEnvironment:
description: 'Deployment environment type. Allowed values: dev, qa, prod'
required: true
type: string
environmentId:
description: 'Environment ID (dev, qa, prod)'
default: 'dev'
deployConfigPath:
description: 'Full path to argoDeploy.json'
required: false
type: string
jiraKeys:
description: 'Deployed artifact Jira keys (for cycle time report)'
required: false
default: ''
type: string
workflow_dispatch:
inputs:
argoServer:
required: false
default: 'argo.virtocommerce.cloud'
type: string
artifactUrl:
description: 'Full link to artifact docker image or artifact download url'
required: true
default: 'argoDeploy.json'
type: string
environmentId:
description: 'Environment ID (dev, qa, prod)'
default: 'dev'
required: false
type: string
jiraKeys:
description: 'Deployed artifact Jira keys (for cycle time report)'
required: false
default: ''
type: string

jobs:
cd:
deploy:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
ARGO_SERVER: ${{ inputs.argoServer }}
CLIENT_ID: ${{secrets.CLIENT_ID}}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
SLEEP_TIME: '5m'
ARGO_SERVER: argo.govirto.com,
APP: ""
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
DEPLOY_STATE: ''
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
SLEEP_TIME: '3m'

steps:

- name: Install vc-build
run: |
dotnet tool install --global VirtoCommerce.GlobalTool
- name: Set Output
id: app-name
run: |
if [ ${{ github.ref }} == 'refs/heads/master' ]; then
echo "IS master branch"
echo "APP=vcst-demo" >> $GITHUB_ENV
elif [ ${{ github.ref }} == 'refs/heads/dev' ]; then
echo "IS dev branch"
echo "APP=vcst-dev" >> $GITHUB_ENV
elif [ ${{ github.ref }} == 'refs/heads/demo' ]; then
echo "IS demo branch"
echo "APP=vcst-demo" >> $GITHUB_ENV
fi
- name: Read deployment config
uses: VirtoCommerce/vc-github-actions/get-deploy-param@master
id: deployConfig
with:
envName: ${{ github.event.inputs.deployEnvironment }}
deployConfigPath: ${{ github.event.inputs.deployConfigPath }}
envName: ${{ inputs.environmentId }}
deployConfigPath: .deployment/theme/cloudDeploy.json

- name: Start deployment
uses: bobheadxi/deployments@v1
uses: bobheadxi/deployments@main
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.deployConfig.outputs.environmentName }}
override: true

- name: Install vc-build
run: |
dotnet tool install --global VirtoCommerce.GlobalTool --version 3.16.0
- name: Update environment
run: |
export ARTIFACT=$(echo "${{ github.event.inputs.artifactUrl }}" | xargs)
vc-build SetHelmParameter -ArgoServer https://argo.virtocommerce.cloud -ArgoAppName ${{ env.APP }} -ArgoToken ${{ secrets.VCST_TOKEN }} -HelmParameters themes.B2B-store=$ARTIFACT
vc-build SetHelmParameter -ArgoServer https://${{ env.ARGO_SERVER }} -ArgoAppName ${{ steps.deployConfig.outputs.deployAppName }} -ArgoToken ${{ secrets.VCST_TOKEN }} -HelmParameters themes.B2B-store=$ARTIFACT
- name: Sleep for ${{ env.SLEEP_TIME }}
run: sleep ${{ env.SLEEP_TIME }}
shell: bash

- name: Wait for environment is up
timeout-minutes: 5
uses: VirtoCommerce/vc-github-actions/vc-argocd-cli@master
with:
server: ${{env.ARGO_SERVER}}
username: ${{ secrets.VIRTOCLOUD_LOGIN }}
password: ${{ secrets.VIRTOCLOUD_PASSWORD }}
command: app wait ${{ steps.deployConfig.outputs.deployAppName }}

- name: DEPLOY_STATE::successful
if: success()
Expand All @@ -82,19 +104,19 @@ jobs:
run: echo "DEPLOY_STATE=failed" >> $GITHUB_ENV

- name: Update GitHub deployment status
uses: bobheadxi/deployments@v1
uses: bobheadxi/deployments@main
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.deployConfig.outputs.environmentName }}
status: ${{ job.status }}
env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

- name: Push Deployment Info to Jira
if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && github.event.inputs.jiraKeys != '' && always() }}
id: push_deployment_info_to_jira
uses: HighwayThree/jira-upload-deployment-info@master
uses: VirtoCommerce/jira-upload-deployment-info@master
env:
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
CLIENT_ID: ${{secrets.CLIENT_ID}}
Expand All @@ -108,6 +130,7 @@ jobs:
issue-keys: ${{ github.event.inputs.jiraKeys }}
display-name: ${{ steps.deployConfig.outputs.deployAppName }}
url: ${{ steps.deployConfig.outputs.environmentUrl }}
label: ${{ steps.deployConfig.outputs.environmentName }}
description: 'Deployment to the ${{ steps.deployConfig.outputs.environmentName }} environment'
last-updated: '${{github.event.head_commit.timestamp}}'
state: '${{ env.DEPLOY_STATE }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# v1.0.0
name: Release - Quick release
# v1.0.1
name: Release

on:
workflow_dispatch:
Expand Down
32 changes: 9 additions & 23 deletions .github/workflows/main.yml → .github/workflows/theme-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- 'build/**'
- 'README.md'
- 'LICENSE'
- '**/argoDeploy.json'
- '**/cloudDeploy.json'
pull_request:
branches:
[master, dev, demo]
Expand All @@ -22,7 +22,7 @@ on:
- 'build/**'
- 'README.md'
- 'LICENSE'
- '**/argoDeploy.json'
- '**/cloudDeploy.json'

jobs:
ci:
Expand Down Expand Up @@ -170,26 +170,12 @@ jobs:
run: |
echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}"
deploy:
deploy-cloud:
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/demo' || github.ref == 'refs/heads/master') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
needs: ci
runs-on: ubuntu-latest
env:
CONFIG_PATH: '.deployment/storefront-app/argoDeploy.json'
steps:

- name: Set deployment environment
id: deployEnv
run: |
if [ '${{ github.ref }}' = 'refs/heads/demo' ] || [ '${{ github.ref }}' = 'refs/heads/master' ]; then
echo ::set-output name=NAME::prod
else
echo ::set-output name=NAME::dev
fi;
- name: Invoke Module deployment workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: VC deployment
token: ${{ secrets.REPO_TOKEN }}
inputs: '{ "artifactUrl": "${{ needs.ci.outputs.artifactUrl }}", "deployEnvironment": "${{ steps.deployEnv.outputs.NAME }}", "deployConfigPath": "${{ env.CONFIG_PATH }}", "jiraKeys":"${{ needs.ci.outputs.jira-keys }}" }'
uses: ./.github/workflows/deploy-cloud.yml
with:
artifactUrl: ${{ needs.ci.outputs.artifactUrl }}
environmentId: ${{ github.ref == 'refs/head/dev' && 'dev' || 'prod' }}
jiraKeys: ${{ needs.ci.outputs.jira-keys }}
secrets: inherit

0 comments on commit 7738986

Please sign in to comment.