Merge branch 'dev' into migration/net-6
This commit is contained in:
commit
8c178e349e
31
.github/workflows/basket-api-deploy.yml
vendored
31
.github/workflows/basket-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
102
.github/workflows/basket-api.yml
vendored
102
.github/workflows/basket-api.yml
vendored
@ -22,7 +22,6 @@ on:
|
|||||||
env:
|
env:
|
||||||
SERVICE: basket-api
|
SERVICE: basket-api
|
||||||
IMAGE: basket.api
|
IMAGE: basket.api
|
||||||
DOTNET_VERSION: 5.0.x
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -30,97 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
- name: Build and run unit tests
|
|
||||||
run: |
|
|
||||||
cd src
|
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
|
||||||
cd Services/Basket/Basket.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Basket/Basket.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
- name: Build and run unit tests
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
run: |
|
image_name: ${{ env.IMAGE }}
|
||||||
cd src
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
cd Services/Basket/Basket.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Basket/Basket.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/catalog-api-deploy.yml
vendored
31
.github/workflows/catalog-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
106
.github/workflows/catalog-api.yml
vendored
106
.github/workflows/catalog-api.yml
vendored
@ -23,6 +23,8 @@ env:
|
|||||||
SERVICE: catalog-api
|
SERVICE: catalog-api
|
||||||
IMAGE: catalog.api
|
IMAGE: catalog.api
|
||||||
DOTNET_VERSION: 5.0.x
|
DOTNET_VERSION: 5.0.x
|
||||||
|
PROJECT_PATH: Services/Catalog/Catalog.API
|
||||||
|
TESTS_PATH: Services/Catalog/Catalog.UnitTests
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -30,97 +32,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-test
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
- name: Build and run unit tests
|
dotnet_version: ${{ env.DOTNET_VERSION }}
|
||||||
run: |
|
project_path: ${{ env.PROJECT_PATH }}
|
||||||
cd src
|
tests_path: ${{ env.TESTS_PATH }}
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
|
||||||
cd Services/Catalog/Catalog.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Catalog/Catalog.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
- name: Build and run unit tests
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
run: |
|
image_name: ${{ env.IMAGE }}
|
||||||
cd src
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
cd Services/Catalog/Catalog.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Catalog/Catalog.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
71
.github/workflows/composite/build-push/action.yml
vendored
Normal file
71
.github/workflows/composite/build-push/action.yml
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
name: "Build and push image"
|
||||||
|
description: "Builds and pushes an image to a registry"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
service:
|
||||||
|
description: "Service to build"
|
||||||
|
required: true
|
||||||
|
registry_host:
|
||||||
|
description: "Image registry host e.g. myacr.azureacr.io"
|
||||||
|
required: true
|
||||||
|
registry_endpoint:
|
||||||
|
description: "Image registry repo e.g. myacr.azureacr.io/eshop"
|
||||||
|
required: true
|
||||||
|
image_name:
|
||||||
|
description: "Name of image"
|
||||||
|
required: true
|
||||||
|
registry_username:
|
||||||
|
description: "Registry username"
|
||||||
|
required: true
|
||||||
|
registry_password:
|
||||||
|
description: "Registry password"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Enable experimental features for the Docker daemon and CLI
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
||||||
|
mkdir -p ~/.docker
|
||||||
|
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
||||||
|
sudo service docker restart
|
||||||
|
docker version -f '{{.Client.Experimental}}'
|
||||||
|
docker version -f '{{.Server.Experimental}}'
|
||||||
|
|
||||||
|
- name: Login to Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ${{ inputs.registry_host }}
|
||||||
|
username: ${{ inputs.registry_username }}
|
||||||
|
password: ${{ inputs.registry_password }}
|
||||||
|
|
||||||
|
- name: Set branch name as env variable
|
||||||
|
run: |
|
||||||
|
currentbranch=$(echo ${GITHUB_REF##*/})
|
||||||
|
echo "running on $currentbranch"
|
||||||
|
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Compose build ${{ inputs.service }}
|
||||||
|
shell: bash
|
||||||
|
run: sudo -E docker-compose build ${{ inputs.service }}
|
||||||
|
working-directory: ./src
|
||||||
|
env:
|
||||||
|
TAG: ${{ env.BRANCH }}
|
||||||
|
REGISTRY: ${{ inputs.registry_endpoint }}
|
||||||
|
|
||||||
|
- name: Compose push ${{ inputs.service }}
|
||||||
|
shell: bash
|
||||||
|
run: sudo -E docker-compose push ${{ inputs.service }}
|
||||||
|
working-directory: ./src
|
||||||
|
env:
|
||||||
|
TAG: ${{ env.BRANCH }}
|
||||||
|
REGISTRY: ${{ inputs.registry_endpoint }}
|
||||||
|
|
||||||
|
- name: Create multiarch manifest
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker --config ~/.docker manifest create ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.BRANCH }} ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:linux-${{ env.BRANCH }}
|
||||||
|
docker --config ~/.docker manifest push ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.BRANCH }}
|
47
.github/workflows/composite/build-test/action.yml
vendored
Normal file
47
.github/workflows/composite/build-test/action.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: "Build for PRe"
|
||||||
|
description: "Builds a docker image without pushing"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
service:
|
||||||
|
description: "Service to build"
|
||||||
|
required: true
|
||||||
|
registry_endpoint:
|
||||||
|
description: "Image registry repo e.g. myacr.azureacr.io/eshop"
|
||||||
|
required: true
|
||||||
|
dotnet_version:
|
||||||
|
description: "Version of dotnet to use for testing"
|
||||||
|
required: true
|
||||||
|
project_path:
|
||||||
|
description: "Path to project to test e.g. Services/Catalog/Catalog.API"
|
||||||
|
required: true
|
||||||
|
tests_path:
|
||||||
|
description: "Path to test project e.g. Services/Catalog/Catalog.UnitTests"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Setup dotnet
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: ${{ inputs.dotnet_version }}
|
||||||
|
|
||||||
|
- name: Build and run unit tests
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd src
|
||||||
|
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
||||||
|
cd ${{ inputs.project_path }}
|
||||||
|
dotnet build --no-restore
|
||||||
|
cd -
|
||||||
|
cd ${{ inputs.tests_path }}
|
||||||
|
dotnet build --no-restore
|
||||||
|
dotnet test --no-build -v=normal
|
||||||
|
|
||||||
|
- name: Compose build ${{ inputs.service }}
|
||||||
|
shell: bash
|
||||||
|
run: sudo -E docker-compose build ${{ inputs.service }}
|
||||||
|
working-directory: ./src
|
||||||
|
env:
|
||||||
|
TAG: ${{ env.BRANCH }}
|
||||||
|
REGISTRY: ${{ inputs.registry_endpoint }}
|
21
.github/workflows/composite/build/action.yml
vendored
Normal file
21
.github/workflows/composite/build/action.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: "Build for PRe"
|
||||||
|
description: "Builds a docker image without pushing"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
service:
|
||||||
|
description: "Service to build"
|
||||||
|
required: true
|
||||||
|
registry_endpoint:
|
||||||
|
description: "Image registry repo e.g. myacr.azureacr.io/eshop"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Compose build ${{ inputs.service }}
|
||||||
|
shell: bash
|
||||||
|
run: sudo -E docker-compose build ${{ inputs.service }}
|
||||||
|
working-directory: ./src
|
||||||
|
env:
|
||||||
|
TAG: ${{ env.BRANCH }}
|
||||||
|
REGISTRY: ${{ inputs.registry_endpoint }}
|
54
.github/workflows/composite/deploy-helm/action.yml
vendored
Normal file
54
.github/workflows/composite/deploy-helm/action.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: "Deploy Helm to AKS"
|
||||||
|
description: "Deploys a helm chart to AKS"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
azure_credentials:
|
||||||
|
description: "Credentials to connect to AKS"
|
||||||
|
required: true
|
||||||
|
cluster_name:
|
||||||
|
description: "Name of AKS cluster"
|
||||||
|
required: true
|
||||||
|
resource_group:
|
||||||
|
description: "Resource group of AKS cluster"
|
||||||
|
required: true
|
||||||
|
registry_host:
|
||||||
|
description: "Image registry host e.g. myacr.azureacr.io"
|
||||||
|
required: true
|
||||||
|
chart:
|
||||||
|
description: "Chart name"
|
||||||
|
required: true
|
||||||
|
chart_root:
|
||||||
|
description: "Root folder of chart"
|
||||||
|
required: true
|
||||||
|
namespace:
|
||||||
|
description: "Namespace to deploy to"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: azure/login@v1
|
||||||
|
with:
|
||||||
|
creds: ${{ inputs.azure_credentials }}
|
||||||
|
|
||||||
|
- uses: azure/aks-set-context@v1
|
||||||
|
name: Set AKS context
|
||||||
|
with:
|
||||||
|
creds: '${{ inputs.azure_credentials }}'
|
||||||
|
cluster-name: ${{ inputs.cluster_name }}
|
||||||
|
resource-group: ${{ inputs.resource_group }}
|
||||||
|
|
||||||
|
- name: Set branch name as env variable
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
currentbranch=$(echo ${GITHUB_REF##*/})
|
||||||
|
echo "running on $currentbranch"
|
||||||
|
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Deploy Chart
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
./deploy-chart.sh -c ${{ inputs.chart }} --dns aks --aks-name ${{ inputs.clusteR_name }} --aks-rg ${{ inputs.resource_group }} -r ${{ inputs.registry_host }} -t $TAG --namespace ${{ inputs.namespace }} --acr-connected
|
||||||
|
env:
|
||||||
|
TAG: ${{ env.BRANCH }}
|
||||||
|
working-directory: ${{ inputs.chart_root }}
|
31
.github/workflows/identity-api-deploy.yml
vendored
31
.github/workflows/identity-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/identity-api.yml
vendored
72
.github/workflows/identity-api.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: identity-api
|
name: identity-api
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/mobileshoppingagg-deploy.yml
vendored
31
.github/workflows/mobileshoppingagg-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/mobileshoppingagg.yml
vendored
72
.github/workflows/mobileshoppingagg.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: mobileshoppingagg
|
name: mobileshoppingagg
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -26,65 +27,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/ordering-api-deploy.yml
vendored
31
.github/workflows/ordering-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
106
.github/workflows/ordering-api.yml
vendored
106
.github/workflows/ordering-api.yml
vendored
@ -23,6 +23,8 @@ env:
|
|||||||
SERVICE: ordering-api
|
SERVICE: ordering-api
|
||||||
IMAGE: ordering.api
|
IMAGE: ordering.api
|
||||||
DOTNET_VERSION: 5.0.x
|
DOTNET_VERSION: 5.0.x
|
||||||
|
PROJECT_PATH: Services/Ordering/Ordering.API
|
||||||
|
TESTS_PATH: Services/Ordering/Ordering.UnitTests
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -30,97 +32,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-test
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
- name: Build and run unit tests
|
dotnet_version: ${{ env.DOTNET_VERSION }}
|
||||||
run: |
|
project_path: ${{ env.PROJECT_PATH }}
|
||||||
cd src
|
tests_path: ${{ env.TESTS_PATH }}
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
|
||||||
cd Services/Ordering/Ordering.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Ordering/Ordering.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Setup dotnet
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
service: ${{ env.SERVICE }}
|
||||||
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
- name: Build and run unit tests
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
run: |
|
image_name: ${{ env.IMAGE }}
|
||||||
cd src
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
cd Services/Ordering/Ordering.API
|
|
||||||
dotnet build --no-restore
|
|
||||||
cd -
|
|
||||||
cd Services/Ordering/Ordering.UnitTests
|
|
||||||
dotnet build --no-restore
|
|
||||||
dotnet test --no-build -v=normal
|
|
||||||
|
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/ordering-backgroundtasks.yml
vendored
72
.github/workflows/ordering-backgroundtasks.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: ordering-backgroundtasks
|
name: ordering-backgroundtasks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/ordering-signalrhub-deploy.yml
vendored
31
.github/workflows/ordering-signalrhub-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/ordering-signalrhub.yml
vendored
72
.github/workflows/ordering-signalrhub.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: ordering-signalrhub
|
name: ordering-signalrhub
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/payment-api-deploy.yml
vendored
31
.github/workflows/payment-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/payment-api.yml
vendored
72
.github/workflows/payment-api.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: payment-api
|
name: payment-api
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/webhooks-api-deploy.yml
vendored
31
.github/workflows/webhooks-api-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/webhooks-api.yml
vendored
72
.github/workflows/webhooks-api.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webhooks-api
|
name: webhooks-api
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
72
.github/workflows/webhooks-client.yml
vendored
72
.github/workflows/webhooks-client.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webhooks-client
|
name: webhooks-client
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
27
.github/workflows/webmvc-deploy.yml
vendored
27
.github/workflows/webmvc-deploy.yml
vendored
@ -28,23 +28,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
|
||||||
- uses: azure/aks-set-context@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
name: Set AKS context
|
|
||||||
with:
|
with:
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
- name: Set branch name as env variable
|
chart: ${{ env.CHART }}
|
||||||
run: |
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
namespace: ${{ env.NAMESPACE }}
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/webmvc.yml
vendored
72
.github/workflows/webmvc.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webmvc
|
name: webmvc
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -29,65 +30,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/webshoppingagg-deploy.yml
vendored
31
.github/workflows/webshoppingagg-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/webshoppingagg.yml
vendored
72
.github/workflows/webshoppingagg.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webshoppingagg
|
name: webshoppingagg
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -26,65 +27,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/webspa-deploy.yml
vendored
31
.github/workflows/webspa-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/webspa.yml
vendored
72
.github/workflows/webspa.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webspa
|
name: webspa
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -28,65 +29,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
31
.github/workflows/webstatus-deploy.yml
vendored
31
.github/workflows/webstatus-deploy.yml
vendored
@ -24,27 +24,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: azure/login@v1
|
- uses: ./.github/workflows/composite/deploy-helm
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
cluster_name: ${{ secrets.CLUSTER_NAME }}
|
||||||
- uses: azure/aks-set-context@v1
|
resource_group: ${{ secrets.RESOURCE_GROUP }}
|
||||||
name: Set AKS context
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
with:
|
chart: ${{ env.CHART }}
|
||||||
creds: '${{ secrets.AZURE_CREDENTIALS }}'
|
chart_root: ${{ env.CHART_ROOT }}
|
||||||
cluster-name: ${{ secrets.CLUSTER_NAME }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
resource-group: ${{ secrets.RESOURCE_GROUP }}
|
|
||||||
|
|
||||||
- name: Set branch name as env variable
|
|
||||||
run: |
|
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Deploy Chart
|
|
||||||
run: |
|
|
||||||
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
working-directory: ${{ env.CHART_ROOT }}
|
|
||||||
|
72
.github/workflows/webstatus.yml
vendored
72
.github/workflows/webstatus.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
name: webstatus
|
name: webstatus
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@ -29,65 +30,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
with:
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
service: ${{ env.SERVICE }}
|
||||||
working-directory: ./src
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
BuildLinux:
|
BuildLinux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Github Action'
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/workflows/composite/build-push
|
||||||
- name: Enable experimental features for the Docker daemon and CLI
|
|
||||||
run: |
|
|
||||||
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
||||||
sudo service docker restart
|
|
||||||
docker version -f '{{.Client.Experimental}}'
|
|
||||||
docker version -f '{{.Server.Experimental}}'
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_HOST }}
|
service: ${{ env.SERVICE }}
|
||||||
username: ${{ secrets.USERNAME }}
|
registry_host: ${{ secrets.REGISTRY_HOST }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }}
|
||||||
|
image_name: ${{ env.IMAGE }}
|
||||||
- name: Set branch name as env variable
|
registry_username: ${{ secrets.USERNAME }}
|
||||||
run: |
|
registry_password: ${{ secrets.PASSWORD }}
|
||||||
currentbranch=$(echo ${GITHUB_REF##*/})
|
|
||||||
echo "running on $currentbranch"
|
|
||||||
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Compose build ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose build ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Compose push ${{ env.SERVICE }}
|
|
||||||
run: sudo -E docker-compose push ${{ env.SERVICE }}
|
|
||||||
working-directory: ./src
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TAG: ${{ env.BRANCH }}
|
|
||||||
REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
|
|
||||||
|
|
||||||
- name: Create multiarch manifest
|
|
||||||
run: |
|
|
||||||
docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
|
|
||||||
docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
|
|
||||||
shell: bash
|
|
16
README.md
16
README.md
@ -56,18 +56,18 @@ The basic scenario can be run locally using docker-compose, and also deployed to
|
|||||||
|
|
||||||
### Advanced scenario
|
### Advanced scenario
|
||||||
|
|
||||||
The Advanced scenario can be run only in a Kubernetes cluster. Currently this scenario is the same as a basic scenario with the following differences:
|
The Advanced scenario can be run only in a Kubernetes cluster. Currently, this scenario is the same as a basic scenario with the following differences:
|
||||||
|
|
||||||
- [Deploy to AKS with a Service Mesh for resiliency](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Azure-Kubernetes-Service-(AKS))
|
- [Deploy to AKS with a Service Mesh for resiliency](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Azure-Kubernetes-Service-(AKS))
|
||||||
|
|
||||||
In the future more features will be implemented in the advanced scenario.
|
In the future, more features will be implemented in the advanced scenario.
|
||||||
|
|
||||||
|
|
||||||
## IMPORTANT NOTES!
|
## IMPORTANT NOTES!
|
||||||
|
|
||||||
**You can use either the latest version of Visual Studio or simply Docker CLI and .NET CLI for Windows, Mac and Linux**.
|
**You can use either the latest version of Visual Studio or simply Docker CLI and .NET CLI for Windows, Mac, and Linux**.
|
||||||
|
|
||||||
**Note for Pull Requests (PRs)**: We accept pull request from the community. When doing it, please do it onto the **DEV branch** which is the consolidated work-in-progress branch. Do not request it onto **master** branch.
|
**Note for Pull Requests (PRs)**: We accept pull requests from the community. When doing it, please do it onto the **DEV branch** which is the consolidated work-in-progress branch. Do not request it onto **main** branch.
|
||||||
|
|
||||||
**NEWS / ANNOUNCEMENTS**
|
**NEWS / ANNOUNCEMENTS**
|
||||||
Do you want to be up-to-date on .NET Architecture guidance and reference apps like eShopOnContainers? --> Subscribe by "WATCHING" this new GitHub repo: https://github.com/dotnet-architecture/News
|
Do you want to be up-to-date on .NET Architecture guidance and reference apps like eShopOnContainers? --> Subscribe by "WATCHING" this new GitHub repo: https://github.com/dotnet-architecture/News
|
||||||
@ -86,15 +86,15 @@ eShopOnContainers is updated to .NET 5 "wave" of technologies. Not just compilat
|
|||||||
|
|
||||||
### Architecture overview
|
### Architecture overview
|
||||||
|
|
||||||
This reference application is cross-platform at the server and client side, thanks to .NET 5 services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
|
This reference application is cross-platform at the server and client-side, thanks to .NET 5 services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS, or Windows/UWP plus any browser for the client web apps.
|
||||||
The architecture proposes a microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using Http as the communication protocol between the client apps and the microservices and supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus (a light message broker, to choose between RabbitMQ or Azure Service Bus, underneath) plus other features defined at the [roadmap](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Roadmap).
|
The architecture proposes a microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using HTTP as the communication protocol between the client apps and the microservices and supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus (a light message broker, to choose between RabbitMQ or Azure Service Bus, underneath) plus other features defined at the [roadmap](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Roadmap).
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## Related documentation and guidance
|
## Related documentation and guidance
|
||||||
|
|
||||||
You can find the related reference **Guide/eBook** focusing on **architecting and developing containerized and microservice based .NET Applications** (download link available below) which explains in detail how to develop this kind of architectural style (microservices, Docker containers, Domain-Driven Design for certain microservices) plus other simpler architectural styles, like monolithic apps that can also live as Docker containers.
|
You can find the related reference **Guide/eBook** focusing on **architecting and developing containerized and microservice-based .NET Applications** (download link available below) which explains in detail how to develop this kind of architectural style (microservices, Docker containers, Domain-Driven Design for certain microservices) plus other simpler architectural styles, like monolithic apps that can also live as Docker containers.
|
||||||
|
|
||||||
There are also additional eBooks focusing on Containers/Docker lifecycle (DevOps, CI/CD, etc.) with Microsoft Tools, already published plus an additional eBook focusing on Enterprise Apps Patterns with Xamarin.Forms.
|
There are also additional eBooks focusing on Containers/Docker lifecycle (DevOps, CI/CD, etc.) with Microsoft Tools, already published plus an additional eBook focusing on Enterprise Apps Patterns with Xamarin.Forms.
|
||||||
You can download them and start reviewing these Guides/eBooks here:
|
You can download them and start reviewing these Guides/eBooks here:
|
||||||
@ -107,7 +107,7 @@ You can download them and start reviewing these Guides/eBooks here:
|
|||||||
For more free e-Books check out [.NET Architecture center](https://dot.net/architecture). If you have an e-book feedback, let us know by creating a new issue here: <https://github.com/dotnet-architecture/ebooks/issues>
|
For more free e-Books check out [.NET Architecture center](https://dot.net/architecture). If you have an e-book feedback, let us know by creating a new issue here: <https://github.com/dotnet-architecture/ebooks/issues>
|
||||||
|
|
||||||
## Are you new to **microservices** and **cloud-native development**?
|
## Are you new to **microservices** and **cloud-native development**?
|
||||||
Take a look at the free course [Create and deploy a cloud-native ASP.NET Core microservice](https://docs.microsoft.com/en-us/learn/modules/microservices-aspnet-core/) on MS Learn. This module explains microservices concepts, cloud-native technologies, and reduce the friction in getting started with `eShopOnContainers`.
|
Take a look at the free course [Create and deploy a cloud-native ASP.NET Core microservice](https://docs.microsoft.com/en-us/learn/modules/microservices-aspnet-core/) on MS Learn. This module explains microservices concepts, cloud-native technologies, and reduces the friction in getting started with `eShopOnContainers`.
|
||||||
|
|
||||||
## Read further
|
## Read further
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
"OrderingSubscriptionName": "Ordering",
|
"OrderingSubscriptionName": "Ordering",
|
||||||
"GracePeriodSubscriptionName": "GracePeriod",
|
"GracePeriodSubscriptionName": "GracePeriod",
|
||||||
"PaymentSubscriptionName": "Payment",
|
"PaymentSubscriptionName": "Payment",
|
||||||
|
"BackgroundTaskSubscriptionName": "backgroundtasks",
|
||||||
|
"OrderingSignalrHubSubscriptionName": "Ordering.signalrhub",
|
||||||
|
"WebhooksSubscriptionName": "Webhooks",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[resourceGroup().location]",
|
||||||
"sbVersion": "2015-08-01",
|
"sbVersion": "2015-08-01",
|
||||||
"defaultSASKeyName": "Root",
|
"defaultSASKeyName": "Root",
|
||||||
@ -172,6 +175,66 @@
|
|||||||
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
"entityAvailabilityStatus": "Available"
|
"entityAvailabilityStatus": "Available"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('BackgroundTaskSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('OrderingSignalrHubSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('WebhooksSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ Write-Host "Creating AKS $resourceGroupName/$serviceName" -ForegroundColor Yello
|
|||||||
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsNamePrefix --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize --vm-set-type $vmSetType
|
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsNamePrefix --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize --vm-set-type $vmSetType
|
||||||
|
|
||||||
if ($enableHttpApplicationAddon) {
|
if ($enableHttpApplicationAddon) {
|
||||||
Write-Host "Enabling Http Applciation Routing in AKS $serviceName" -ForegroundColor Yellow
|
Write-Host "Enabling Http Application Routing in AKS $serviceName" -ForegroundColor Yellow
|
||||||
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons http_application_routing
|
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons http_application_routing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ Parameters:
|
|||||||
The Docker username used to logon to the custom registry, supplied using the -r parameter.
|
The Docker username used to logon to the custom registry, supplied using the -r parameter.
|
||||||
--use-local-k8s
|
--use-local-k8s
|
||||||
Deploy to a locally installed Kubernetes (default: false).
|
Deploy to a locally installed Kubernetes (default: false).
|
||||||
|
--use-mesh
|
||||||
|
Use Linkerd as service mesh
|
||||||
|
--image-pull-policy <policy>
|
||||||
|
Image Pull Policy: Always, IfNotPresent, Never (default: Always)
|
||||||
|
|
||||||
It is assumed that the Kubernetes cluster has been granted access to the container registry.
|
It is assumed that the Kubernetes cluster has been granted access to the container registry.
|
||||||
If using AKS and ACR see link for more info:
|
If using AKS and ACR see link for more info:
|
||||||
@ -72,6 +76,9 @@ push_images=''
|
|||||||
skip_infrastructure=''
|
skip_infrastructure=''
|
||||||
use_local_k8s=''
|
use_local_k8s=''
|
||||||
namespace='eshop'
|
namespace='eshop'
|
||||||
|
use_mesh='false'
|
||||||
|
ingressMeshAnnotationsFile='ingress_values_linkerd.yaml'
|
||||||
|
imagePullPolicy='Always'
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -107,12 +114,21 @@ while [[ $# -gt 0 ]]; do
|
|||||||
use_local_k8s='yes'; shift ;;
|
use_local_k8s='yes'; shift ;;
|
||||||
--namespace )
|
--namespace )
|
||||||
namespace="$2"; shift 2;;
|
namespace="$2"; shift 2;;
|
||||||
|
--use-mesh )
|
||||||
|
use_mesh='true'; shift ;;
|
||||||
|
--image-pull-policy )
|
||||||
|
imagePullPolicy="$2"; shift 2;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option $1"
|
echo "Unknown option $1"
|
||||||
usage; exit 2 ;;
|
usage; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $imagePullPolicy != "Always" && $imagePullPolicy != "Never" && $imagePullPolicy != "IfNotPresent" ]]; then
|
||||||
|
echo "--image-pull-policy needs to be a valid value: Always, IfNotPresent, Never"
|
||||||
|
usage; exit 2;
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $build_solution ]]; then
|
if [[ $build_solution ]]; then
|
||||||
echo "#################### Building $app_name solution ####################"
|
echo "#################### Building $app_name solution ####################"
|
||||||
dotnet publish -o obj/Docker/publish ../../eShopOnContainers-ServicesAndWebApps.sln
|
dotnet publish -o obj/Docker/publish ../../eShopOnContainers-ServicesAndWebApps.sln
|
||||||
@ -201,7 +217,7 @@ if [[ $clean ]]; then
|
|||||||
if [[ -z $(helm ls -q --namespace $namespace) ]]; then
|
if [[ -z $(helm ls -q --namespace $namespace) ]]; then
|
||||||
echo "No previous releases found"
|
echo "No previous releases found"
|
||||||
else
|
else
|
||||||
helm uninstall $(helm ls -q --namespace $namespace)
|
helm --namespace $namespace uninstall $(helm ls -q --namespace $namespace)
|
||||||
echo "Previous releases deleted"
|
echo "Previous releases deleted"
|
||||||
waitsecs=10; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done
|
waitsecs=10; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done
|
||||||
fi
|
fi
|
||||||
@ -209,13 +225,14 @@ fi
|
|||||||
|
|
||||||
echo "#################### Begin $app_name installation using Helm ####################"
|
echo "#################### Begin $app_name installation using Helm ####################"
|
||||||
infras=(sql-data nosql-data rabbitmq keystore-data basket-data)
|
infras=(sql-data nosql-data rabbitmq keystore-data basket-data)
|
||||||
charts=(eshop-common apigwms apigwws basket-api catalog-api identity-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web)
|
charts=(eshop-common basket-api catalog-api identity-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web)
|
||||||
|
gateways=(apigwms apigwws)
|
||||||
|
|
||||||
if [[ !$skip_infrastructure ]]; then
|
if [[ !$skip_infrastructure ]]; then
|
||||||
for infra in "${infras[@]}"
|
for infra in "${infras[@]}"
|
||||||
do
|
do
|
||||||
echo "Installing infrastructure: $infra"
|
echo "Installing infrastructure: $infra"
|
||||||
helm install "$app_name-$infra" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns $infra
|
helm install "$app_name-$infra" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns $infra --set inf.mesh.enabled=$use_mesh
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -223,10 +240,16 @@ for chart in "${charts[@]}"
|
|||||||
do
|
do
|
||||||
echo "Installing: $chart"
|
echo "Installing: $chart"
|
||||||
if [[ $use_custom_registry ]]; then
|
if [[ $use_custom_registry ]]; then
|
||||||
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
|
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=$imagePullPolicy $chart --set inf.mesh.enabled=$use_mesh
|
||||||
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed
|
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed
|
||||||
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
|
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --values $ingressMeshAnnotationsFile --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=$imagePullPolicy $chart --set inf.mesh.enabled=$use_mesh
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for gw in "${gateways[@]}"
|
||||||
|
do
|
||||||
|
echo "Installing gateway: $gw"
|
||||||
|
helm install "$app_name-$gw" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.pullPolicy=$imagePullPolicy $gw
|
||||||
|
done
|
||||||
|
|
||||||
echo "FINISHED: Helm charts installed."
|
echo "FINISHED: Helm charts installed."
|
@ -22,7 +22,7 @@
|
|||||||
<PackageReference Include="Grpc.Core" Version="2.34.0" />
|
<PackageReference Include="Grpc.Core" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.34.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<PackageReference Include="Grpc.Net.Client" Version="2.34.0" />
|
<PackageReference Include="Grpc.Net.Client" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.34.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||||
|
@ -2,54 +2,44 @@
|
|||||||
|
|
||||||
public class DefaultServiceBusPersisterConnection : IServiceBusPersisterConnection
|
public class DefaultServiceBusPersisterConnection : IServiceBusPersisterConnection
|
||||||
{
|
{
|
||||||
private readonly ServiceBusConnectionStringBuilder _serviceBusConnectionStringBuilder;
|
private readonly string _serviceBusConnectionString;
|
||||||
private readonly string _subscriptionClientName;
|
private ServiceBusClient _topicClient;
|
||||||
private SubscriptionClient _subscriptionClient;
|
private ServiceBusAdministrationClient _subscriptionClient;
|
||||||
private ITopicClient _topicClient;
|
|
||||||
|
|
||||||
bool _disposed;
|
bool _disposed;
|
||||||
|
|
||||||
public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder,
|
public DefaultServiceBusPersisterConnection(string serviceBusConnectionString)
|
||||||
string subscriptionClientName)
|
|
||||||
{
|
{
|
||||||
_serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ??
|
_serviceBusConnectionString = serviceBusConnectionString;
|
||||||
throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder));
|
_subscriptionClient = new ServiceBusAdministrationClient(_serviceBusConnectionString);
|
||||||
_subscriptionClientName = subscriptionClientName;
|
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||||
_subscriptionClient = new SubscriptionClient(_serviceBusConnectionStringBuilder, subscriptionClientName);
|
|
||||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITopicClient TopicClient
|
public ServiceBusClient TopicClient
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_topicClient.IsClosedOrClosing)
|
if (_topicClient.IsClosed)
|
||||||
{
|
{
|
||||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||||
}
|
}
|
||||||
return _topicClient;
|
return _topicClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISubscriptionClient SubscriptionClient
|
public ServiceBusAdministrationClient AdministrationClient
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_subscriptionClient.IsClosedOrClosing)
|
|
||||||
{
|
|
||||||
_subscriptionClient = new SubscriptionClient(_serviceBusConnectionStringBuilder, _subscriptionClientName);
|
|
||||||
}
|
|
||||||
return _subscriptionClient;
|
return _subscriptionClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceBusConnectionStringBuilder ServiceBusConnectionStringBuilder => _serviceBusConnectionStringBuilder;
|
public ServiceBusClient CreateModel()
|
||||||
|
|
||||||
public ITopicClient CreateModel()
|
|
||||||
{
|
{
|
||||||
if (_topicClient.IsClosedOrClosing)
|
if (_topicClient.IsClosed)
|
||||||
{
|
{
|
||||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _topicClient;
|
return _topicClient;
|
||||||
@ -60,5 +50,6 @@ public class DefaultServiceBusPersisterConnection : IServiceBusPersisterConnecti
|
|||||||
if (_disposed) return;
|
if (_disposed) return;
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
|
_topicClient.DisposeAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,48 @@
|
|||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
|
||||||
public class EventBusServiceBus : IEventBus
|
public class EventBusServiceBus : IEventBus, IDisposable
|
||||||
{
|
{
|
||||||
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
|
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
|
||||||
private readonly ILogger<EventBusServiceBus> _logger;
|
private readonly ILogger<EventBusServiceBus> _logger;
|
||||||
private readonly IEventBusSubscriptionsManager _subsManager;
|
private readonly IEventBusSubscriptionsManager _subsManager;
|
||||||
private readonly ILifetimeScope _autofac;
|
private readonly ILifetimeScope _autofac;
|
||||||
|
private readonly string _topicName = "eshop_event_bus";
|
||||||
|
private readonly string _subscriptionName;
|
||||||
|
private ServiceBusSender _sender;
|
||||||
|
private ServiceBusProcessor _processor;
|
||||||
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
|
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
|
||||||
private const string INTEGRATION_EVENT_SUFFIX = "IntegrationEvent";
|
private const string INTEGRATION_EVENT_SUFFIX = "IntegrationEvent";
|
||||||
|
|
||||||
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
|
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
|
||||||
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, ILifetimeScope autofac)
|
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, ILifetimeScope autofac, string subscriptionClientName)
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection = serviceBusPersisterConnection;
|
_serviceBusPersisterConnection = serviceBusPersisterConnection;
|
||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
||||||
_autofac = autofac;
|
_autofac = autofac;
|
||||||
|
_subscriptionName = subscriptionClientName;
|
||||||
|
_sender = _serviceBusPersisterConnection.TopicClient.CreateSender(_topicName);
|
||||||
|
ServiceBusProcessorOptions options = new ServiceBusProcessorOptions { MaxConcurrentCalls = 10, AutoCompleteMessages = false };
|
||||||
|
_processor = _serviceBusPersisterConnection.TopicClient.CreateProcessor(_topicName, _subscriptionName, options);
|
||||||
|
|
||||||
RemoveDefaultRule();
|
RemoveDefaultRule();
|
||||||
RegisterSubscriptionClientMessageHandler();
|
RegisterSubscriptionClientMessageHandlerAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Publish(IntegrationEvent @event)
|
public void Publish(IntegrationEvent @event)
|
||||||
{
|
{
|
||||||
var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFFIX, "");
|
var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFFIX, "");
|
||||||
var jsonMessage = JsonSerializer.Serialize(@event);
|
var jsonMessage = JsonSerializer.Serialize(@event, @event.GetType());
|
||||||
var body = Encoding.UTF8.GetBytes(jsonMessage);
|
var body = Encoding.UTF8.GetBytes(jsonMessage);
|
||||||
|
|
||||||
var message = new Message
|
var message = new ServiceBusMessage
|
||||||
{
|
{
|
||||||
MessageId = Guid.NewGuid().ToString(),
|
MessageId = Guid.NewGuid().ToString(),
|
||||||
Body = body,
|
Body = new BinaryData(body),
|
||||||
Label = eventName,
|
Subject = eventName,
|
||||||
};
|
};
|
||||||
|
|
||||||
_serviceBusPersisterConnection.TopicClient.SendAsync(message)
|
_sender.SendMessageAsync(message)
|
||||||
.GetAwaiter()
|
.GetAwaiter()
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
@ -58,9 +66,9 @@ public class EventBusServiceBus : IEventBus
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection.SubscriptionClient.AddRuleAsync(new RuleDescription
|
_serviceBusPersisterConnection.AdministrationClient.CreateRuleAsync(_topicName, _subscriptionName, new CreateRuleOptions
|
||||||
{
|
{
|
||||||
Filter = new CorrelationFilter { Label = eventName },
|
Filter = new CorrelationRuleFilter() { Subject = eventName },
|
||||||
Name = eventName
|
Name = eventName
|
||||||
}).GetAwaiter().GetResult();
|
}).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
@ -84,12 +92,12 @@ public class EventBusServiceBus : IEventBus
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection
|
_serviceBusPersisterConnection
|
||||||
.SubscriptionClient
|
.AdministrationClient
|
||||||
.RemoveRuleAsync(eventName)
|
.DeleteRuleAsync(_topicName, _subscriptionName, eventName)
|
||||||
.GetAwaiter()
|
.GetAwaiter()
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
catch (MessagingEntityNotFoundException)
|
catch (ServiceBusException ex) when (ex.Reason == ServiceBusFailureReason.MessagingEntityNotFound)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("The messaging entity {eventName} Could not be found.", eventName);
|
_logger.LogWarning("The messaging entity {eventName} Could not be found.", eventName);
|
||||||
}
|
}
|
||||||
@ -107,39 +115,42 @@ public class EventBusServiceBus : IEventBus
|
|||||||
_subsManager.RemoveDynamicSubscription<TH>(eventName);
|
_subsManager.RemoveDynamicSubscription<TH>(eventName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task RegisterSubscriptionClientMessageHandlerAsync()
|
||||||
|
{
|
||||||
|
_processor.ProcessMessageAsync +=
|
||||||
|
async (args) =>
|
||||||
|
{
|
||||||
|
var eventName = $"{args.Message.Subject}{INTEGRATION_EVENT_SUFFIX}";
|
||||||
|
string messageData = args.Message.Body.ToString();
|
||||||
|
|
||||||
|
// Complete the message so that it is not received again.
|
||||||
|
if (await ProcessEvent(eventName, messageData))
|
||||||
|
{
|
||||||
|
await args.CompleteMessageAsync(args.Message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_processor.ProcessErrorAsync += ErrorHandler;
|
||||||
|
await _processor.StartProcessingAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_subsManager.Clear();
|
_subsManager.Clear();
|
||||||
|
_processor.CloseAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterSubscriptionClientMessageHandler()
|
private Task ErrorHandler(ProcessErrorEventArgs args)
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection.SubscriptionClient.RegisterMessageHandler(
|
var ex = args.Exception;
|
||||||
async (message, token) =>
|
var context = args.ErrorSource;
|
||||||
{
|
|
||||||
var eventName = $"{message.Label}{INTEGRATION_EVENT_SUFFIX}";
|
|
||||||
var messageData = Encoding.UTF8.GetString(message.Body);
|
|
||||||
|
|
||||||
// Complete the message so that it is not received again.
|
|
||||||
if (await ProcessEventAsync(eventName, messageData))
|
|
||||||
{
|
|
||||||
await _serviceBusPersisterConnection.SubscriptionClient.CompleteAsync(message.SystemProperties.LockToken);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new MessageHandlerOptions(ExceptionReceivedHandlerAsync) { MaxConcurrentCalls = 10, AutoComplete = false });
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task ExceptionReceivedHandlerAsync(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
|
|
||||||
{
|
|
||||||
var ex = exceptionReceivedEventArgs.Exception;
|
|
||||||
var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
|
|
||||||
|
|
||||||
_logger.LogError(ex, "ERROR handling message: {ExceptionMessage} - Context: {@ExceptionContext}", ex.Message, context);
|
_logger.LogError(ex, "ERROR handling message: {ExceptionMessage} - Context: {@ExceptionContext}", ex.Message, context);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> ProcessEventAsync(string eventName, string message)
|
private async Task<bool> ProcessEvent(string eventName, string message)
|
||||||
{
|
{
|
||||||
var processed = false;
|
var processed = false;
|
||||||
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
||||||
@ -178,14 +189,14 @@ public class EventBusServiceBus : IEventBus
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection
|
_serviceBusPersisterConnection
|
||||||
.SubscriptionClient
|
.AdministrationClient
|
||||||
.RemoveRuleAsync(RuleDescription.DefaultRuleName)
|
.DeleteRuleAsync(_topicName, _subscriptionName, RuleProperties.DefaultRuleName)
|
||||||
.GetAwaiter()
|
.GetAwaiter()
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
catch (MessagingEntityNotFoundException)
|
catch (ServiceBusException ex) when (ex.Reason == ServiceBusFailureReason.MessagingEntityNotFound)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("The messaging entity {DefaultRuleName} Could not be found.", RuleDescription.DefaultRuleName);
|
_logger.LogWarning("The messaging entity {DefaultRuleName} Could not be found.", RuleProperties.DefaultRuleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
<PackageReference Include="Autofac" Version="6.1.0" />
|
||||||
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.1.0" />
|
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.2.1" />
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
|
||||||
public interface IServiceBusPersisterConnection : IDisposable
|
public interface IServiceBusPersisterConnection : IDisposable
|
||||||
{
|
{
|
||||||
ITopicClient TopicClient { get; }
|
ServiceBusClient TopicClient { get; }
|
||||||
ISubscriptionClient SubscriptionClient { get; }
|
ServiceBusAdministrationClient AdministrationClient { get; }
|
||||||
}
|
}
|
@ -5,6 +5,9 @@
|
|||||||
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
|
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
|
||||||
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
|
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
|
// Integration Events notes:
|
||||||
|
// An Event is “something that has happened in the past”, therefore its name has to be past tense
|
||||||
|
// An Integration Event is an event that can cause side effects to other microsrvices, Bounded-Contexts or external systems.
|
||||||
public int ProductId { get; private init; }
|
public int ProductId { get; private init; }
|
||||||
|
|
||||||
public decimal NewPrice { get; private init; }
|
public decimal NewPrice { get; private init; }
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Basket.API;
|
namespace Microsoft.eShopOnContainers.Services.Basket.API;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
@ -85,10 +84,8 @@ public class Startup
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
|
||||||
|
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -248,9 +245,10 @@ public class Startup
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API;
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
@ -246,10 +246,9 @@ public static class CustomExtensionMethods
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var settings = sp.GetRequiredService<IOptions<CatalogSettings>>().Value;
|
var settings = sp.GetRequiredService<IOptions<CatalogSettings>>().Value;
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection);
|
var serviceBusConnection = settings.EventBusConnection;
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -298,9 +297,10 @@ public static class CustomExtensionMethods
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.2.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.2.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Setup\*">
|
<None Update="Setup\*">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
@ -258,10 +258,10 @@ static class CustomExtensionsMethods
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusConnectionString = configuration["EventBusConnection"];
|
var serviceBusConnectionString = configuration["EventBusConnection"];
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -335,9 +335,10 @@ static class CustomExtensionsMethods
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using Autofac;
|
using Autofac;
|
||||||
using Microsoft.Azure.ServiceBus;
|
using Azure.Messaging.ServiceBus;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||||
@ -54,9 +54,8 @@ namespace Ordering.BackgroundTasks.Extensions
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusConnectionString = configuration["EventBusConnection"];
|
var serviceBusConnectionString = configuration["EventBusConnection"];
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
@ -65,8 +64,9 @@ namespace Ordering.BackgroundTasks.Extensions
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, iLifetimeScope);
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
@ -41,11 +41,10 @@ public class Startup
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
|
||||||
|
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -189,9 +188,10 @@ public class Startup
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Payment.API;
|
namespace Microsoft.eShopOnContainers.Payment.API;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
@ -22,10 +22,9 @@ public class Startup
|
|||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -111,9 +110,10 @@ public class Startup
|
|||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
namespace Webhooks.API;
|
namespace Webhooks.API;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
@ -36,8 +35,6 @@ public class Startup
|
|||||||
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
|
|
||||||
|
|
||||||
var pathBase = Configuration["PATH_BASE"];
|
var pathBase = Configuration["PATH_BASE"];
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(pathBase))
|
if (!string.IsNullOrEmpty(pathBase))
|
||||||
@ -46,8 +43,6 @@ public class Startup
|
|||||||
app.UsePathBase(pathBase);
|
app.UsePathBase(pathBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors("CorsPolicy");
|
app.UseCors("CorsPolicy");
|
||||||
ConfigureAuth(app);
|
ConfigureAuth(app);
|
||||||
@ -144,7 +139,6 @@ static class CustomExtensionMethods
|
|||||||
{
|
{
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
{
|
{
|
||||||
options.DescribeAllEnumsAsStrings();
|
|
||||||
options.SwaggerDoc("v1", new OpenApiInfo
|
options.SwaggerDoc("v1", new OpenApiInfo
|
||||||
{
|
{
|
||||||
Title = "eShopOnContainers - Webhooks HTTP API",
|
Title = "eShopOnContainers - Webhooks HTTP API",
|
||||||
@ -177,44 +171,46 @@ static class CustomExtensionMethods
|
|||||||
public static IServiceCollection AddEventBus(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddEventBus(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
{
|
|
||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
|
||||||
eventBusSubcriptionsManager, iLifetimeScope);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
|
|
||||||
{
|
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
|
||||||
|
|
||||||
var retryCount = 5;
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
|
|
||||||
{
|
{
|
||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
}
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
});
|
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||||
}
|
});
|
||||||
|
|
||||||
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
}
|
||||||
services.AddTransient<ProductPriceChangedIntegrationEventHandler>();
|
else
|
||||||
services.AddTransient<OrderStatusChangedToShippedIntegrationEventHandler>();
|
{
|
||||||
services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>();
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
|
||||||
return services;
|
{
|
||||||
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
|
var retryCount = 5;
|
||||||
|
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
|
||||||
|
{
|
||||||
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||||
|
services.AddTransient<ProductPriceChangedIntegrationEventHandler>();
|
||||||
|
services.AddTransient<OrderStatusChangedToShippedIntegrationEventHandler>();
|
||||||
|
services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>();
|
||||||
|
|
||||||
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
|
||||||
@ -248,50 +244,49 @@ static class CustomExtensionMethods
|
|||||||
public static IServiceCollection AddIntegrationServices(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddIntegrationServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
services.AddTransient<Func<DbConnection, IIntegrationEventLogService>>(
|
services.AddTransient<Func<DbConnection, IIntegrationEventLogService>>(
|
||||||
sp => (DbConnection c) => new IntegrationEventLogService(c));
|
sp => (DbConnection c) => new IntegrationEventLogService(c));
|
||||||
|
|
||||||
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
if (configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
{
|
|
||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
|
||||||
{
|
{
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(configuration["EventBusConnection"]);
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
{
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
});
|
return new DefaultServiceBusPersisterConnection(configuration["EventBusConnection"]);
|
||||||
}
|
});
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
|
||||||
{
|
{
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
|
|
||||||
var factory = new ConnectionFactory()
|
|
||||||
{
|
{
|
||||||
HostName = configuration["EventBusConnection"],
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
DispatchConsumersAsync = true
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
factory.UserName = configuration["EventBusUserName"];
|
HostName = configuration["EventBusConnection"],
|
||||||
}
|
DispatchConsumersAsync = true
|
||||||
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusPassword"]))
|
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
||||||
{
|
{
|
||||||
factory.Password = configuration["EventBusPassword"];
|
factory.UserName = configuration["EventBusUserName"];
|
||||||
}
|
}
|
||||||
|
|
||||||
var retryCount = 5;
|
if (!string.IsNullOrEmpty(configuration["EventBusPassword"]))
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
|
{
|
||||||
{
|
factory.Password = configuration["EventBusPassword"];
|
||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
|
var retryCount = 5;
|
||||||
});
|
if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"]))
|
||||||
}
|
{
|
||||||
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
|
}
|
||||||
|
|
||||||
return services;
|
return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
1174
src/Web/WebSPA/Client/package-lock.json
generated
1174
src/Web/WebSPA/Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user