Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/1.5.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pushnitsa committed Nov 26, 2020
2 parents 3fada45 + 6a15bea commit 747a2af
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 3 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# v0.1
name: VC image deployment
on:
workflow_dispatch:
inputs:
baseImageName:
description: 'Base kustomize image name'
required: true
imageName:
description: 'Deploying image name'
required: true
artifactVersion:
description: 'Full artifact build number'
required: true
appDescriptionRepo:
description: 'ArgoCd repository'
required: true
default: 'VirtoCommerce/vc-deploy-apps'
appDescriptionBranch:
description: 'ArgoCd branch'
required: true
default: 'master'


jobs:
cd:
runs-on: ubuntu-latest
steps:

- name: Start deployment
uses: bobheadxi/deployments@master
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Development
no_override: false

- name: Checkout ArgoCD repository
uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_TOKEN }}
repository: "${{ github.event.inputs.appDescriptionRepo }}"
ref: "${{ github.event.inputs.appDescriptionBranch }}"

- name: Update kustomize
shell: pwsh
run: |
$REPOSITORY = "docker.pkg.github.com/$('${{ github.repository }}'.ToLower())"
cd ${{ github.workspace }}
cd ./webstore-app/overlays/dev
kustomize edit set image ${{ github.event.inputs.baseImageName }}=$REPOSITORY/${{ github.event.inputs.imageName }}:${{ github.event.inputs.artifactVersion }}
- name: Commit kustomize change
shell: pwsh
run: |
if(git status --porcelain |Where {$_ -notmatch '^\?\?'}) # uncommitted changes exist
{
git config --global user.name 'GitHub Actions'
git config user.email --global '[email protected]'
git commit -am 'Automated update ${{ github.repository }} to ${{ github.event.inputs.artifactVersion }}'
git push
}
else
{
Write-Output 'Nothing to commit, working tree clean'
}
- name: Wait for environment is up
shell: pwsh
timeout-minutes: 5
run: |
do {
Start-Sleep -s 15
$statusBage = (Invoke-WebRequest -Uri "https://cd.govirto.com/api/badge?name=webstore-app-dev").Content
$syncedAndHealthy = $statusBage.Contains('>Healthy<') -and $statusBage.Contains('>Synced<')
if (-not $syncedAndHealthy) {
Write-Host "Sync pending..."
}
}
while (-not $syncedAndHealthy)
- name: BUILD_STATE::successful
if: success()
run: echo "BUILD_STATE=successful" >> $GITHUB_ENV

- name: BUILD_STATE::failed
if: failure()
run: echo "BUILD_STATE=failed" >> $GITHUB_ENV

- name: Update GitHub deployment status
uses: bobheadxi/deployments@master
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
20 changes: 19 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
BLOB_SAS: ${{ secrets.BLOB_TOKEN }}
PUBLISH_TO_DOCKER: "false"
UPDATE_LATEST_TAG: "true"
VERSION_SUFFIX: ""

steps:

Expand Down Expand Up @@ -59,11 +60,20 @@ jobs:
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@master

- name: Set release variables
run: |
echo "VERSION_SUFFIX=${{ steps.image.outputs.suffix }}" >> $GITHUB_ENV
- name: Set release-alpha variables
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "VERSION_SUFFIX=${{ steps.image.outputs.fullSuffix }}" >> $GITHUB_ENV
- name: Add version suffix
if: ${{ github.ref != 'refs/heads/master' }}
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
with:
versionSuffix: ${{ steps.image.outputs.suffix }}
versionSuffix: ${{ env.VERSION_SUFFIX }}

- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
Expand Down Expand Up @@ -125,3 +135,11 @@ jobs:
docker_token: ${{ secrets.DOCKER_TOKEN }}
docker_hub: ${{ env.PUBLISH_TO_DOCKER }}
update_latest: ${{ env.UPDATE_LATEST_TAG }}

- name: Invoke VC image deployment workflow
if: ${{ github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master')}}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: VC image deployment
token: ${{ secrets.REPO_TOKEN }}
inputs: '{ "baseImageName": "docker.pkg.github.com/virtocommerce/vc-storefront/storefront", "imageName": "demo-storefront", "artifactVersion": "${{ steps.image.outputs.taggedVersion }}"}'
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Authors>VirtoCommerce</Authors>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>1.4.0</VersionPrefix>
<VersionPrefix>1.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredGroup.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using VirtoCommerce.Storefront.Infrastructure.Swagger;
using VirtoCommerce.Storefront.Model.Catalog;
using VirtoCommerce.Storefront.Model.Common;

namespace VirtoCommerce.Storefront.Model.Cart.Demo
{
[SwaggerSchemaId("CartConfiguredGroup")]
public class ConfiguredGroup : Entity
{
public ConfiguredGroup(int quantity, Currency currency, string productId)
Expand Down
2 changes: 2 additions & 0 deletions VirtoCommerce.Storefront.Model/Order/Demo/ConfiguredGroup.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using VirtoCommerce.Storefront.Infrastructure.Swagger;
using VirtoCommerce.Storefront.Model.Catalog;
using VirtoCommerce.Storefront.Model.Common;

namespace VirtoCommerce.Storefront.Model.Order.Demo
{
[SwaggerSchemaId("OrderConfiguredGroup")]
public class ConfiguredGroup : Entity
{
public ConfiguredGroup(int quantity, Currency currency, string productId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using VirtoCommerce.Storefront.Domain.Security;
using VirtoCommerce.Storefront.Model.Common;

namespace VirtoCommerce.Storefront.Filters
{
Expand All @@ -31,8 +32,14 @@ public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
throw new ArgumentNullException(nameof(context));
}

// To avoid an infinite redirect to the login action when no store theme and "Allow anonymous user" of the store is disabled
var isNoThemeAction = context.RouteData.Values.TryGetValue("controller", out var controller)
&& context.RouteData.Values.TryGetValue("action", out var action)
&& ((string)controller).EqualsInvariant("Common")
&& ((string)action).EqualsInvariant("NoTheme");

// Don not call filter for ReExecute requests (such as status code pages) and skips all paths marked as AllowAnonymous attribute
if (context.HttpContext.Features.Get<IStatusCodeReExecuteFeature>() != null || context.Filters.Any(x => x is IAllowAnonymousFilter))
if (context.HttpContext.Features.Get<IStatusCodeReExecuteFeature>() != null || context.Filters.Any(x => x is IAllowAnonymousFilter) || isNoThemeAction)
{
return;
}
Expand Down
5 changes: 5 additions & 0 deletions VirtoCommerce.Storefront/VirtoCommerce.Storefront.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<ItemGroup>
<Compile Remove="wwwroot\cms-content\**" />
<Content Remove="wwwroot\cms-content\**" />
<Content Remove="wwwroot\swagger\index.html" />
<Content Update="wwwroot\cms-content\**" CopyToPublishDirectory="Never" />
</ItemGroup>

Expand All @@ -33,6 +34,10 @@
</Content>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="wwwroot\swagger\index.html" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="3.1.3" />
<PackageReference Include="AspNet.Security.OAuth.StackExchange" Version="3.1.3" />
Expand Down

0 comments on commit 747a2af

Please sign in to comment.