@ -0,0 +1,92 @@ | |||
parameters: | |||
services: '' | |||
registryEndpoint: '' | |||
helmfrom: '' | |||
helmto: '' | |||
jobs: | |||
- job: BuildContainersForPR_Linux | |||
condition: eq('${{ variables['Build.Reason'] }}', 'PullRequest') | |||
pool: | |||
vmImage: 'ubuntu-16.04' | |||
steps: | |||
- bash: docker-compose build ${{ parameters.services }} | |||
displayName: Create multiarch manifest | |||
env: | |||
TAG: ${{ variables['Build.SourceBranchName'] }} | |||
- job: BuildContainersForPR_Windows | |||
condition: eq('${{ variables['Build.Reason'] }}', 'PullRequest') | |||
pool: | |||
vmImage: 'windows-2019' | |||
steps: | |||
- bash: docker-compose build ${{ parameters.services }} | |||
displayName: Create multiarch manifest | |||
env: | |||
TAG: ${{ variables['Build.SourceBranchName'] }} | |||
PLATFORM: win | |||
NODE_IMAGE: stefanscherer/node-windows:8.11 | |||
- job: BuildLinux | |||
condition: ne('${{ variables['Build.Reason'] }}', 'PullRequest') | |||
pool: | |||
vmImage: 'ubuntu-16.04' | |||
steps: | |||
- task: DockerCompose@0 | |||
displayName: Compose build ${{ parameters.services }} | |||
inputs: | |||
dockerComposeCommand: 'build ${{ parameters.services }}' | |||
containerregistrytype: Container Registry | |||
dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} | |||
dockerComposeFile: docker-compose.yml | |||
qualifyImageNames: true | |||
projectName: "" | |||
dockerComposeFileArgs: | | |||
TAG=${{ variables['Build.SourceBranchName'] }} | |||
- task: DockerCompose@0 | |||
displayName: Compose push ${{ parameters.images }} | |||
inputs: | |||
dockerComposeCommand: 'push ${{ parameters.services }}' | |||
containerregistrytype: Container Registry | |||
dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} | |||
dockerComposeFile: docker-compose.yml | |||
qualifyImageNames: true | |||
projectName: "" | |||
dockerComposeFileArgs: | | |||
TAG=${{ variables['Build.SourceBranchName'] }} | |||
- task: CopyFiles@2 | |||
inputs: | |||
sourceFolder: ${{ parameters.helmfrom }} | |||
targetFolder: ${{ parameters.helmto }} | |||
- task: PublishBuildArtifacts@1 | |||
inputs: | |||
pathtoPublish: ${{ parameters.helmto }} | |||
artifactName: helm | |||
- job: BuildWindows | |||
condition: ne('${{ variables['Build.Reason'] }}', 'PullRequest') | |||
pool: | |||
vmImage: 'windows-2019' | |||
steps: | |||
- task: DockerCompose@0 | |||
displayName: Compose build ${{ parameters.services }} | |||
inputs: | |||
dockerComposeCommand: 'build ${{ parameters.services }}' | |||
containerregistrytype: Container Registry | |||
dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} | |||
dockerComposeFile: docker-compose.yml | |||
qualifyImageNames: true | |||
projectName: "" | |||
dockerComposeFileArgs: | | |||
TAG=${{ variables['Build.SourceBranchName'] }} | |||
PLATFORM=win | |||
NODE_IMAGE=stefanscherer/node-windows:8.11 | |||
- task: DockerCompose@0 | |||
displayName: Compose push ${{ parameters.services }} | |||
inputs: | |||
dockerComposeCommand: 'push ${{ parameters.services }}' | |||
containerregistrytype: Container Registry | |||
dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} | |||
dockerComposeFile: docker-compose.yml | |||
qualifyImageNames: true | |||
projectName: "" | |||
dockerComposeFileArgs: | | |||
TAG=${{ variables['Build.SourceBranchName'] }} | |||
PLATFORM=win |
@ -0,0 +1,30 @@ | |||
parameters: | |||
image: '' | |||
branch: '' | |||
registry: 'eshop' | |||
registryEndpoint: '' | |||
jobs: | |||
- job: manifest | |||
condition: and(succeeded(),ne('${{ variables['Build.Reason'] }}', 'PullRequest')) | |||
dependsOn: | |||
- BuildWindows | |||
- BuildLinux | |||
pool: | |||
vmImage: 'Ubuntu 16.04' | |||
steps: | |||
- task: Docker@1 | |||
displayName: Docker Login | |||
inputs: | |||
command: login | |||
containerregistrytype: 'Container Registry' | |||
dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} | |||
- bash: | | |||
mkdir -p ~/.docker | |||
sed '$ s/.$//' $DOCKER_CONFIG/config.json > ~/.docker/config.json | |||
echo ',"experimental": "enabled" }' >> ~/.docker/config.json | |||
docker --config ~/.docker manifest create ${{ parameters.registry }}/${{ parameters.image }}:${{ parameters.branch }} ${{ parameters.registry }}/${{ parameters.image }}:linux-${{ parameters.branch }} ${{ parameters.registry }}/${{ parameters.image }}:win-${{ parameters.branch }} | |||
docker --config ~/.docker manifest create ${{ parameters.registry }}/${{ parameters.image }}:latest ${{ parameters.registry }}/${{ parameters.image }}:linux-latest ${{ parameters.registry }}/${{ parameters.image }}:win-latest | |||
docker --config ~/.docker manifest push ${{ parameters.registry }}/${{ parameters.image }}:${{ parameters.branch }} | |||
docker --config ~/.docker manifest push ${{ parameters.registry }}/${{ parameters.image }}:latest | |||
displayName: Create multiarch manifest |
@ -1,17 +1,16 @@ | |||
using FluentValidation; | |||
using Microsoft.Extensions.Logging; | |||
using Ordering.API.Application.Commands; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Ordering.API.Application.Validations | |||
{ | |||
public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand> | |||
{ | |||
public CancelOrderCommandValidator() | |||
public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger) | |||
{ | |||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); | |||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | |||
} | |||
} | |||
} | |||
} |
@ -1,13 +1,16 @@ | |||
using FluentValidation; | |||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | |||
using Microsoft.Extensions.Logging; | |||
namespace Ordering.API.Application.Validations | |||
{ | |||
public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand,bool>> | |||
{ | |||
public IdentifiedCommandValidator() | |||
public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger) | |||
{ | |||
RuleFor(command => command.Id).NotEmpty(); | |||
RuleFor(command => command.Id).NotEmpty(); | |||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | |||
} | |||
} | |||
} |
@ -1,17 +1,16 @@ | |||
using FluentValidation; | |||
using Microsoft.Extensions.Logging; | |||
using Ordering.API.Application.Commands; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Ordering.API.Application.Validations | |||
{ | |||
public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand> | |||
{ | |||
public ShipOrderCommandValidator() | |||
public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger) | |||
{ | |||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); | |||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | |||
} | |||
} | |||
} | |||
} |