diff --git a/.github/workflows/basket-api-deploy.yml b/.github/workflows/basket-api-deploy.yml new file mode 100644 index 000000000..3d51c6d24 --- /dev/null +++ b/.github/workflows/basket-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy basket-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["basket-api"] + branches: [dev] + types: [completed] + +env: + CHART: basket-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/basket-api.yml b/.github/workflows/basket-api.yml index cf89c0a1f..91f05d5dd 100644 --- a/.github/workflows/basket-api.yml +++ b/.github/workflows/basket-api.yml @@ -2,15 +2,6 @@ name: basket-api on: workflow_dispatch: - # Inputs the workflow accepts. - inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'exec name' - # Default value if no value is explicitly provided - default: 'default execution' - # Input has to be provided for the workflow to run - required: false push: branches: - dev @@ -31,6 +22,7 @@ on: env: SERVICE: basket-api IMAGE: basket.api + DOTNET_VERSION: 5.0.x jobs: @@ -40,7 +32,23 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master - + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - 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 @@ -56,6 +64,22 @@ jobs: - name: 'Checkout Github Action' uses: actions/checkout@master + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - 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: Enable experimental features for the Docker daemon and CLI run: | echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json diff --git a/.github/workflows/catalog-api-deploy.yml b/.github/workflows/catalog-api-deploy.yml new file mode 100644 index 000000000..7a5827b66 --- /dev/null +++ b/.github/workflows/catalog-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy catalog-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["catalog-api"] + branches: [dev] + types: [completed] + +env: + CHART: catalog-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/catalog-api.yml b/.github/workflows/catalog-api.yml index 53892126a..9170e7cc8 100644 --- a/.github/workflows/catalog-api.yml +++ b/.github/workflows/catalog-api.yml @@ -2,15 +2,6 @@ name: catalog-api on: workflow_dispatch: - # Inputs the workflow accepts. - inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'exec name' - # Default value if no value is explicitly provided - default: 'default execution' - # Input has to be provided for the workflow to run - required: false push: branches: - dev @@ -31,6 +22,7 @@ on: env: SERVICE: catalog-api IMAGE: catalog.api + DOTNET_VERSION: 5.0.x jobs: @@ -40,6 +32,22 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + 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 }} @@ -56,6 +64,22 @@ jobs: - name: 'Checkout Github Action' uses: actions/checkout@master + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + 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: Enable experimental features for the Docker daemon and CLI run: | echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json diff --git a/.github/workflows/identity-api-deploy.yml b/.github/workflows/identity-api-deploy.yml new file mode 100644 index 000000000..5b2626a3e --- /dev/null +++ b/.github/workflows/identity-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy identity-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["identity-api"] + branches: [dev] + types: [completed] + +env: + CHART: identity-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/mobileshoppingagg-deploy.yml b/.github/workflows/mobileshoppingagg-deploy.yml new file mode 100644 index 000000000..012d4957a --- /dev/null +++ b/.github/workflows/mobileshoppingagg-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy mobileshoppingagg + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["mobileshoppingagg"] + branches: [dev] + types: [completed] + +env: + CHART: mobileshoppingagg + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/ordering-api-deploy.yml b/.github/workflows/ordering-api-deploy.yml new file mode 100644 index 000000000..0ae9d28cb --- /dev/null +++ b/.github/workflows/ordering-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy ordering-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["ordering-api"] + branches: [dev] + types: [completed] + +env: + CHART: ordering-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/ordering-api.yml b/.github/workflows/ordering-api.yml index 6bf5a2fdf..10be98451 100644 --- a/.github/workflows/ordering-api.yml +++ b/.github/workflows/ordering-api.yml @@ -2,15 +2,6 @@ name: ordering-api on: workflow_dispatch: - # Inputs the workflow accepts. - inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'exec name' - # Default value if no value is explicitly provided - default: 'default execution' - # Input has to be provided for the workflow to run - required: false push: branches: - dev @@ -31,6 +22,7 @@ on: env: SERVICE: ordering-api IMAGE: ordering.api + DOTNET_VERSION: 5.0.x jobs: @@ -40,6 +32,22 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + 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 }} @@ -55,6 +63,22 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + 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: Enable experimental features for the Docker daemon and CLI run: | diff --git a/.github/workflows/ordering-backgroundtasks-deploy.yml b/.github/workflows/ordering-backgroundtasks-deploy.yml new file mode 100644 index 000000000..65eab8148 --- /dev/null +++ b/.github/workflows/ordering-backgroundtasks-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy ordering-backgroundtasks + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["ordering-backgroundtasks"] + branches: [dev] + types: [completed] + +env: + CHART: ordering-backgroundtasks + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/ordering-signalrhub-deploy.yml b/.github/workflows/ordering-signalrhub-deploy.yml new file mode 100644 index 000000000..d7842a30f --- /dev/null +++ b/.github/workflows/ordering-signalrhub-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy ordering-signalrhub + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["ordering-signalrhub"] + branches: [dev] + types: [completed] + +env: + CHART: ordering-signalrhub + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/payment-api-deploy.yml b/.github/workflows/payment-api-deploy.yml new file mode 100644 index 000000000..9592259b1 --- /dev/null +++ b/.github/workflows/payment-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy payment-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["payment-api"] + branches: [dev] + types: [completed] + +env: + CHART: payment-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/webhooks-api-deploy.yml b/.github/workflows/webhooks-api-deploy.yml new file mode 100644 index 000000000..08955a3d4 --- /dev/null +++ b/.github/workflows/webhooks-api-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy webhooks-api + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["webhooks-api"] + branches: [dev] + types: [completed] + +env: + CHART: webhooks-api + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/webmvc-deploy.yml b/.github/workflows/webmvc-deploy.yml new file mode 100644 index 000000000..3f1d9c4a1 --- /dev/null +++ b/.github/workflows/webmvc-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy webmvc + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["webmvc"] + branches: [dev] + types: [completed] + +env: + CHART: webmvc + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/webshoppingagg-deploy.yml b/.github/workflows/webshoppingagg-deploy.yml new file mode 100644 index 000000000..7cff7ceac --- /dev/null +++ b/.github/workflows/webshoppingagg-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy webshoppingagg + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["webshoppingagg"] + branches: [dev] + types: [completed] + +env: + CHART: webshoppingagg + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/webspa-deploy.yml b/.github/workflows/webspa-deploy.yml new file mode 100644 index 000000000..2700ee9cd --- /dev/null +++ b/.github/workflows/webspa-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy webspa + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["webspa"] + branches: [dev] + types: [completed] + +env: + CHART: webspa + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/webstatus-deploy.yml b/.github/workflows/webstatus-deploy.yml new file mode 100644 index 000000000..dc5629ab9 --- /dev/null +++ b/.github/workflows/webstatus-deploy.yml @@ -0,0 +1,50 @@ +name: Deploy webstatus + +on: + workflow_dispatch: + repository_dispatch: + types: + - deploy + workflow_run: + workflows: ["webstatus"] + branches: [dev] + types: [completed] + +env: + CHART: webstatus + NAMESPACE: eshop + CHART_ROOT: deploy/k8s/helm + +jobs: + deploy-to-k8s: + #if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: ${{ secrets.CLUSTER_NAME }} + 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 }} \ No newline at end of file diff --git a/deploy/k8s/helm/deploy-chart.sh b/deploy/k8s/helm/deploy-chart.sh new file mode 100755 index 000000000..4196d5cfe --- /dev/null +++ b/deploy/k8s/helm/deploy-chart.sh @@ -0,0 +1,199 @@ +#!/usr/bin/env bash + +# http://redsymbol.net/articles/unofficial-bash-strict-mode +set -euo pipefail + +usage() +{ + cat < + The name of the AKS cluster. Required when the registry (using the -r parameter) is set to "aks". + --aks-rg + The resource group for the AKS cluster. Required when the registry (using the -r parameter) is set to "aks". + -c | --chart + The name of the chart to upgrade (or install) + -d | --dns | --dns aks + Specifies the external DNS/ IP address of the Kubernetes cluster. + If 'aks' is set as value, the DNS value is retrieved from the AKS. --aks-name and --aks-rg are needed. + When --use-local-k8s is specified the external DNS is automatically set to localhost. + -h | --help + Displays this help text and exits the script. + -n | --app-name + Specifies the name of the application (default: eshop). + --namespace + Specifies the namespace name to deploy the app. If it doesn't exists it will be created (default: eshop). + -p | --docker-password + The Docker password used to logon to the custom registry, supplied using the -r parameter. + -r | --registry + Specifies the container registry to use (required), e.g. myregistry.azurecr.io. + --skip-clean + Do not clean the Kubernetes helm chart. Default is to clean the chart. + -t | --tag + The tag used for the newly created docker images. Default: latest. + -u | --docker-username + The Docker username used to logon to the custom registry, supplied using the -r parameter. + --use-local-k8s + Deploy to a locally installed Kubernetes (default: false). + +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: +https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks + +WARNING! THE SCRIPT WILL COMPLETELY DESTROY ALL DEPLOYMENTS AND SERVICES VISIBLE +FROM THE CURRENT CONFIGURATION CONTEXT AND NAMESPACE. +It is recommended that you check your selected namespace, 'eshop' by default, is already in use. +Every deployment and service done in the namespace will be deleted. +For more information see https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + +END +} + +acr_connected='' +app_name='eshop' +aks_name='' +aks_rg='' +chart='' +clean='yes' +container_registry='' +docker_password='' +docker_username='' +dns='' +image_tag='latest' +skip_infrastructure='' +use_local_k8s='' +namespace='eshop' + +while [[ $# -gt 0 ]]; do + case "$1" in + --acr-connected ) + acr_connected='yes'; shift ;; + --aks-name ) + aks_name="$2"; shift 2;; + --aks-rg ) + aks_rg="$2"; shift 2;; + -c | --chart ) + chart="$2"; shift 2;; + -d | --dns ) + dns="$2"; shift 2;; + -h | --help ) + usage; exit 1 ;; + -n | --app-name ) + app_name="$2"; shift 2;; + -p | --docker-password ) + docker_password="$2"; shift 2;; + -r | --registry ) + container_registry="$2"; shift 2;; + --skip-clean ) + clean=''; shift ;; + --image-build ) + build_images='yes'; shift ;; + --image-push ) + push_images='yes'; shift ;; + --skip-infrastructure ) + skip_infrastructure='yes'; shift ;; + -t | --tag ) + image_tag="$2"; shift 2;; + -u | --docker-username ) + docker_username="$2"; shift 2;; + --use-local-k8s ) + use_local_k8s='yes'; shift ;; + --namespace ) + namespace="$2"; shift 2;; + *) + echo "Unknown option $1" + usage; exit 2 ;; + esac +done + +export TAG=$image_tag + +use_custom_registry='' + +if [[ -n $container_registry ]] && [[ -z $acr_connected ]]; then + echo "################ Log into custom registry $container_registry ##################" + use_custom_registry='yes' + if [[ -z $docker_username ]] || [[ -z $docker_password ]]; then + echo "Error: Must use -u (--docker-username) AND -p (--docker-password) if specifying custom registry" + exit 1 + fi + docker login -u $docker_username -p $docker_password $container_registry +fi + +ingress_values_file="ingress_values.yaml" + +if [[ $use_local_k8s ]]; then + ingress_values_file="ingress_values_dockerk8s.yaml" + dns="localhost" +fi + +if [[ $dns == "aks" ]]; then + echo "#################### Begin AKS discovery based on the --dns aks setting. ####################" + if [[ -z $aks_name ]] || [[ -z $aks_rg ]]; then + echo "Error: When using -dns aks, MUST set -aksName and -aksRg too." + echo '' + usage + exit 1 + fi + + echo "Getting AKS cluster $aks_name AKS (in resource group $aks_rg)" + # JMESPath queries are case sensitive and httpapplicationrouting can be lowercase sometimes + jmespath_dnsqueries=(\ + addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName \ + addonProfiles.httpapplicationrouting.config.HTTPApplicationRoutingZoneName \ + ) + for q in "${jmespath_dnsqueries[@]}" + do + dns="$(az aks show -n $aks_name -g $aks_rg --query $q -o tsv)" + if [[ -n $dns ]]; then break; fi + done + if [[ -z $dns ]]; then + echo "Error: when getting DNS of AKS $aks_name (in resource group $aks_rg). Please ensure AKS has httpRouting enabled AND Azure CLI is logged in and is of version 2.0.37 or higher." + exit 1 + fi + echo "DNS base found is $dns. Will use $aks_name.$dns for the app!" + dns="$aks_name.$dns" +fi + +# Initialization & check commands +if [[ -z $dns ]]; then + echo "No DNS specified. Ingress resources will be bound to public IP." +fi + +previous_install='' +if [[ -z $(helm ls -q --namespace $namespace | grep "$app_name-$chart") ]]; then + echo "No previous release found" +else + previous_install='yes' +fi + +if [[ $clean ]] && [[ $previous_install ]]; then + echo "Cleaning previous helm releases..." + helm uninstall "$app_name-$chart" --namespace $namespace + echo "Previous release deleted" + waitsecs=5; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done + previous_install='' +fi + +echo "#################### Begin $app_name $chart installation using Helm ####################" +if [[ $use_custom_registry ]] || [[ $acr_connected ]]; then + if [[ -z $acr_connected ]]; then + if [[ -z $previous_install ]]; then + helm upgrade --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 + else + helm upgrade --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 + fi + elif [[ $chart != "eshop-common" ]]; then + # ACR is already connected, so we don't need username/password + if [[ -z $previous_install ]]; then + helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --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 + else + # don't set the image repo since it's already set + helm upgrade "$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 + fi + fi +elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed + helm upgrade --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 +fi +echo "FINISHED: Helm chart installed." \ No newline at end of file diff --git a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml index 1ae8c45a1..8f2162ad7 100644 --- a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml +++ b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml @@ -103,7 +103,7 @@ static_resources: lb_policy: round_robin hosts: - socket_address: - address: webshoppingagg + address: mobileshoppingagg port_value: 80 - name: catalog connect_timeout: 0.25s diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile index ee0370910..d64cd2f77 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop index b2a61dc7d..c4988428d 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile index 5736c19f7..6a7eb023b 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop index 462afbcd9..5fbbdbffb 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Basket/Basket.API/Dockerfile b/src/Services/Basket/Basket.API/Dockerfile index de2718ad4..7ba77d156 100644 --- a/src/Services/Basket/Basket.API/Dockerfile +++ b/src/Services/Basket/Basket.API/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Basket/Basket.API/Dockerfile.develop b/src/Services/Basket/Basket.API/Dockerfile.develop index 4ad633175..3e9aed06b 100644 --- a/src/Services/Basket/Basket.API/Dockerfile.develop +++ b/src/Services/Basket/Basket.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Catalog/Catalog.API/Dockerfile b/src/Services/Catalog/Catalog.API/Dockerfile index ec10cac79..74dd100a5 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile +++ b/src/Services/Catalog/Catalog.API/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Catalog/Catalog.API/Dockerfile.develop b/src/Services/Catalog/Catalog.API/Dockerfile.develop index 3df91b3df..12a4cdae4 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile.develop +++ b/src/Services/Catalog/Catalog.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Identity/Identity.API/Dockerfile b/src/Services/Identity/Identity.API/Dockerfile index 3608476bc..039aba031 100644 --- a/src/Services/Identity/Identity.API/Dockerfile +++ b/src/Services/Identity/Identity.API/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Identity/Identity.API/Dockerfile.develop b/src/Services/Identity/Identity.API/Dockerfile.develop index 0d50b0388..11c5c6536 100644 --- a/src/Services/Identity/Identity.API/Dockerfile.develop +++ b/src/Services/Identity/Identity.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Ordering/Ordering.API/Dockerfile b/src/Services/Ordering/Ordering.API/Dockerfile index 7659da4de..54d63a41c 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile +++ b/src/Services/Ordering/Ordering.API/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Ordering/Ordering.API/Dockerfile.develop b/src/Services/Ordering/Ordering.API/Dockerfile.develop index 5f7200c84..9bf101ad1 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile.develop +++ b/src/Services/Ordering/Ordering.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile b/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile index ea95935ab..05b83d441 100644 --- a/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile +++ b/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/CardType.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/CardType.cs index 3053cb678..872a8f65d 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/CardType.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/CardType.cs @@ -9,9 +9,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B public class CardType : Enumeration { - public static CardType Amex = new CardType(1, "Amex"); - public static CardType Visa = new CardType(2, "Visa"); - public static CardType MasterCard = new CardType(3, "MasterCard"); + public static CardType Amex = new CardType(1, nameof(Amex)); + public static CardType Visa = new CardType(2, nameof(Visa)); + public static CardType MasterCard = new CardType(3, nameof(MasterCard)); public CardType(int id, string name) : base(id, name) diff --git a/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs b/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs index d3e415df2..731dd8c86 100644 --- a/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs +++ b/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs @@ -11,27 +11,23 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork public int Id { get; private set; } - protected Enumeration(int id, string name) - { - Id = id; - Name = name; - } + protected Enumeration(int id, string name) => (Id, Name) = (id, name); public override string ToString() => Name; - - public static IEnumerable GetAll() where T : Enumeration - { - var fields = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly); - - return fields.Select(f => f.GetValue(null)).Cast(); - } - + + public static IEnumerable GetAll() where T : Enumeration => + typeof(T).GetFields(BindingFlags.Public | + BindingFlags.Static | + BindingFlags.DeclaredOnly) + .Select(f => f.GetValue(null)) + .Cast(); + public override bool Equals(object obj) { - var otherValue = obj as Enumeration; - - if (otherValue == null) + if (obj is not Enumeration otherValue) + { return false; + } var typeMatches = GetType().Equals(obj.GetType()); var valueMatches = Id.Equals(otherValue.Id); diff --git a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile index bb80617ff..ce132b71a 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile +++ b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile.develop b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile.develop index efe636e63..9acf557ac 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile.develop +++ b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Payment/Payment.API/Dockerfile b/src/Services/Payment/Payment.API/Dockerfile index d56f3d7c3..fba668f09 100644 --- a/src/Services/Payment/Payment.API/Dockerfile +++ b/src/Services/Payment/Payment.API/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Payment/Payment.API/Dockerfile.develop b/src/Services/Payment/Payment.API/Dockerfile.develop index bb6e353d2..3717c132e 100644 --- a/src/Services/Payment/Payment.API/Dockerfile.develop +++ b/src/Services/Payment/Payment.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Services/Webhooks/Webhooks.API/Dockerfile b/src/Services/Webhooks/Webhooks.API/Dockerfile index 263de13d6..67e1c5375 100644 --- a/src/Services/Webhooks/Webhooks.API/Dockerfile +++ b/src/Services/Webhooks/Webhooks.API/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Services/Webhooks/Webhooks.API/Dockerfile.develop b/src/Services/Webhooks/Webhooks.API/Dockerfile.develop index eda18ae91..c1e4b880e 100644 --- a/src/Services/Webhooks/Webhooks.API/Dockerfile.develop +++ b/src/Services/Webhooks/Webhooks.API/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index bab4109b5..a99a72c6f 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Web/WebMVC/Dockerfile.develop b/src/Web/WebMVC/Dockerfile.develop index c22717a35..2a6115246 100644 --- a/src/Web/WebMVC/Dockerfile.develop +++ b/src/Web/WebMVC/Dockerfile.develop @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim +FROM mcr.microsoft.com/dotnet/sdk:5.0 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/src/Web/WebSPA/Client/modules/catalog/catalog.component.ts b/src/Web/WebSPA/Client/modules/catalog/catalog.component.ts index c4538b393..942f117d5 100644 --- a/src/Web/WebSPA/Client/modules/catalog/catalog.component.ts +++ b/src/Web/WebSPA/Client/modules/catalog/catalog.component.ts @@ -59,6 +59,7 @@ export class CatalogComponent implements OnInit { this.brandSelected = this.brandSelected && this.brandSelected.toString() != "null" ? this.brandSelected : null; this.typeSelected = this.typeSelected && this.typeSelected.toString() != "null" ? this.typeSelected : null; + this.paginationInfo.actualPage = 0; this.getCatalog(this.paginationInfo.itemsPage, this.paginationInfo.actualPage, this.brandSelected, this.typeSelected); } diff --git a/src/Web/WebSPA/Dockerfile b/src/Web/WebSPA/Dockerfile index 0dcac8433..800caa2ac 100644 --- a/src/Web/WebSPA/Dockerfile +++ b/src/Web/WebSPA/Dockerfile @@ -10,7 +10,7 @@ COPY Web/WebSPA/package-lock.json . COPY Web/WebSPA . RUN npm i npm@6.14.11 -g && npm update && npm install && npm run build:prod -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Web/WebSPA/package-lock.json b/src/Web/WebSPA/package-lock.json index e0b8a607c..724c29073 100644 --- a/src/Web/WebSPA/package-lock.json +++ b/src/Web/WebSPA/package-lock.json @@ -8474,12 +8474,12 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, "is-svg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz", - "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-4.2.2.tgz", + "integrity": "sha512-JlA7Mc7mfWjdxxTkJ094oUK9amGD7gQaj5xA/NCY0vlVvZ1stmj4VX+bRuwOMN93IHRZ2ctpPH/0FO6DqvQ5Rw==", "dev": true, "requires": { - "html-comment-regex": "^1.1.0" + "html-comment-regex": "^1.1.2" } }, "is-symbol": { @@ -14408,18 +14408,21 @@ } }, "sockjs": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz", - "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.20.tgz", + "integrity": "sha512-SpmVOVpdq0DJc0qArhF3E5xsxvaiqGNb73XfgBpK1y3UD5gs8DSo8aCTsuT5pX8rssdc2NDIzANwP9eCAiSdTA==", + "dev": true, "requires": { "faye-websocket": "^0.10.0", - "uuid": "^3.0.1" + "uuid": "^3.4.0", + "websocket-driver": "0.6.5" } }, "sockjs-client": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.3.0.tgz", - "integrity": "sha512-R9jxEzhnnrdxLCNln0xg5uGHqMnkhPSTzUZH2eXcR03S/On9Yvoq2wyUZILRUhZCNVu2PmwWVoyuiPz8th8zbg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz", + "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==", + "dev": true, "requires": { "debug": "^3.2.5", "eventsource": "^1.0.7", @@ -14429,10 +14432,20 @@ "url-parse": "^1.4.3" }, "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, "faye-websocket": { "version": "0.11.3", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz", "integrity": "sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==", + "dev": true, "requires": { "websocket-driver": ">=0.5.1" } @@ -14771,9 +14784,9 @@ } }, "ssri": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.0.tgz", - "integrity": "sha512-aq/pz989nxVYwn16Tsbj1TqFpD5LLrQxHf5zaHuieFV+R0Bbr4y8qUsOA45hXT/N4/9UNXTarBjnjVmjSOVaAA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", "dev": true, "requires": { "minipass": "^3.1.1" @@ -16765,8 +16778,8 @@ "selfsigned": "^1.9.1", "semver": "^5.6.0", "serve-index": "^1.7.2", - "sockjs": "0.3.19", - "sockjs-client": "1.3.0", + "sockjs": "0.3.20", + "sockjs-client": "1.4.0", "spdy": "^4.0.0", "strip-ansi": "^3.0.0", "supports-color": "^5.1.0", diff --git a/src/Web/WebSPA/package.json b/src/Web/WebSPA/package.json index d1f140331..43358a1e3 100644 --- a/src/Web/WebSPA/package.json +++ b/src/Web/WebSPA/package.json @@ -56,7 +56,9 @@ "tslib": "^2.0.0", "typedoc": "^0.19.2", "webpack-dev-server": "3.1.14", - "zone.js": "~0.10.2" + "zone.js": "~0.10.2", + "ssri": ">=8.0.1", + "is-svg": ">=4.2.2" }, "devDependencies": { "@angular-devkit/build-angular": "~0.1002.0", diff --git a/src/Web/WebStatus/Dockerfile b/src/Web/WebStatus/Dockerfile index 7c1f74e7e..438837423 100644 --- a/src/Web/WebStatus/Dockerfile +++ b/src/Web/WebStatus/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles diff --git a/src/Web/WebhookClient/Dockerfile b/src/Web/WebhookClient/Dockerfile index 31c4c76eb..150049bd9 100644 --- a/src/Web/WebhookClient/Dockerfile +++ b/src/Web/WebhookClient/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles