forked from MicrosoftLearning/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unai huete
committed
Oct 11, 2022
1 parent
c63a41e
commit 75ba081
Showing
458 changed files
with
21,394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
trigger: none | ||
resources: | ||
- repo: self | ||
|
||
variables: | ||
location: 'westeurope' | ||
templateFile: '.azure/bicep/aci.bicep' | ||
subscriptionid: '6829b3f6-89a8-4e99-9260-9c1602b2ca33' | ||
azureserviceconnection: 'azure subs unai' | ||
webappname: 'az400eshop-unai' | ||
acr-login-server: 'acrv2f3ual42h4yy.azurecr.io' | ||
acr-username: 'acrv2f3ual42h4yy' | ||
resource-group: 'att-az400-ewebshop-unai' | ||
|
||
|
||
stages: | ||
- stage: Deploy | ||
displayName: Docker Compose to ACI | ||
#variable group referencing KV secret | ||
variables: | ||
- group: 'eshopweb-vg' | ||
jobs: | ||
- job: Deploy | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
# Deploy Azure Container Instance using Bicep | ||
- task: AzureResourceManagerTemplateDeployment@3 | ||
displayName: Deploy ACI Bicep | ||
inputs: | ||
deploymentScope: 'Resource Group' | ||
azureResourceManagerConnection: '$(azureserviceconnection)' | ||
subscriptionId: '$(subscriptionid)' | ||
action: 'Create Or Update Resource Group' | ||
resourceGroupName: '$(resource-group)' | ||
location: '$(location)' | ||
templateLocation: 'Linked artifact' | ||
csmFile: '$(templateFile)' | ||
overrideParameters: ' -name $(webappname) -image $(acr-login-server)/eshopwebmvc:latest -server $(acr-login-server) -username $(acr-username) -password $(acr-secret)' | ||
deploymentMode: 'Incremental' | ||
# deploymentOutputs: 'asp-json' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Trigger CD wehn CI executed succesfully | ||
resources: | ||
pipelines: | ||
- pipeline: eshopweb-ci-main | ||
source: eshopweb-ci-main # given pipeline name | ||
trigger: true | ||
|
||
|
||
variables: | ||
resource-group: 'AZ400-EWebShop-Unai' | ||
location: 'westeurope' | ||
templateFile: '.ado/IaC/webapp.bicep' | ||
subscriptionid: '16169bdf-109c-4eb7-9963-3d01e2352774' | ||
azureserviceconnection: 'azure subs' | ||
webappname: 'az400-webapp-unai' | ||
# webappname: 'webapp-windows-eshop' | ||
|
||
|
||
stages: | ||
- stage: Deploy | ||
displayName: Deploy to WebApp | ||
jobs: | ||
- job: Deploy | ||
pool: | ||
vmImage: windows-latest | ||
steps: | ||
#download artifacts | ||
- download: eshopweb-ci-main | ||
|
||
# Deploy App Service Plan + App Service using Bicep | ||
- task: AzureResourceManagerTemplateDeployment@3 | ||
displayName: Deploy App Service Plan Bicep | ||
inputs: | ||
deploymentScope: 'Resource Group' | ||
azureResourceManagerConnection: '$(azureserviceconnection)' | ||
subscriptionId: '$(subscriptionid)' | ||
action: 'Create Or Update Resource Group' | ||
resourceGroupName: '$(resource-group)' | ||
location: '$(location)' | ||
templateLocation: 'Linked artifact' | ||
csmFile: '$(templateFile)' | ||
overrideParameters: '-webAppName $(webappname)' | ||
deploymentMode: 'Incremental' | ||
deploymentOutputs: 'asp-json' | ||
|
||
#Publish Website to Azure WebApp | ||
- task: AzureRmWebAppDeployment@4 | ||
displayName: Publish Website to WebApp | ||
inputs: | ||
ConnectionType: 'AzureRM' | ||
azureSubscription: 'azure subs' | ||
appType: 'webApp' | ||
WebAppName: '$(webappname)' | ||
packageForLinux: '$(Pipeline.Workspace)/**/Web.zip' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
trigger: none | ||
resources: | ||
- repo: self | ||
|
||
variables: | ||
tag: '$(Build.BuildId)' | ||
resource-group: 'AZ400-EWebShop-Unai' | ||
location: 'westeurope' | ||
templateFile: '.ado/IaC/app-plan.bicep' | ||
subscriptionid: '16169bdf-109c-4eb7-9963-3d01e2352774' | ||
azureserviceconnection: 'azure subs' | ||
webappname: 'az400-webapp-compose-NAME' | ||
composeFile: 'docker-compose-webapp.yml' | ||
acr-login-server: 'acrwl3ppxlniyfui.azurecr.io' | ||
acr-username: 'acrwl3ppxlniyfui' | ||
|
||
|
||
stages: | ||
- stage: Deploy | ||
displayName: Docker Compose to WebApp | ||
jobs: | ||
- job: Deploy | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
# Deploy App Service Plan using Bicep | ||
- task: AzureResourceManagerTemplateDeployment@3 | ||
displayName: Deploy App Service Plan Bicep | ||
inputs: | ||
deploymentScope: 'Resource Group' | ||
azureResourceManagerConnection: $(azureserviceconnection) | ||
subscriptionId: $(subscriptionid) | ||
action: 'Create Or Update Resource Group' | ||
resourceGroupName: '$(resource-group)' | ||
location: '$(location)' | ||
templateLocation: 'Linked artifact' | ||
csmFile: '$(templateFile)' | ||
deploymentMode: 'Incremental' | ||
deploymentOutputs: 'asp-json' | ||
|
||
#Parse App Service Plan variable | ||
- task: PowerShell@2 | ||
displayName: Parse Bicep Output | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
$var=ConvertFrom-Json '$(asp-json)' | ||
$value=$var.asplan.value | ||
Write-Host "##vso[task.setvariable variable=appserviceplan;]$value" | ||
echo $appserviceplan | ||
#Replace tokens in Docker Compose file | ||
- task: qetza.replacetokens.replacetokens-task.replacetokens@3 | ||
inputs: | ||
targetFiles: 'docker-compose-webapp.yml' | ||
encoding: 'auto' | ||
writeBOM: true | ||
actionOnMissing: 'warn' | ||
keepToken: false | ||
actionOnNoFiles: 'continue' | ||
enableTransforms: false | ||
tokenPrefix: '__' | ||
tokenSuffix: '__' | ||
enableRecursion: false | ||
useLegacyPattern: false | ||
enableTelemetry: true | ||
#Docker Login into private ACR (TODO alternative, using Docker task and docker ADO Service Connection) | ||
#Deploy using Docker Compose | ||
- task: AzureCLI@2 | ||
inputs: | ||
azureSubscription: '$(azureserviceconnection)' | ||
scriptType: 'bash' | ||
scriptLocation: 'inlineScript' | ||
inlineScript: | | ||
az webapp create --resource-group $(resource-group) --plan $(appserviceplan) --name $(webappname) --multicontainer-config-type compose --multicontainer-config-file $(composeFile) | ||
az webapp config container set --resource-group $(resource-group) --name $(webappname) --docker-registry-server-user $(acr-username) --docker-registry-server-password $(acr-secret) --docker-registry-server-url https://$(acr-login-server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Docker | ||
# Build a Docker image | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker | ||
|
||
trigger: | ||
- main | ||
|
||
resources: | ||
- repo: self | ||
|
||
variables: | ||
tag: '$(Build.BuildId)' | ||
resource-group: 'att-az400-ewebshop-unai' | ||
location: 'westeurope' | ||
templateFile: '.azure/bicep/acr.bicep' | ||
azureserviceconnection: 'azure subs unai' | ||
subscriptionId: '6829b3f6-89a8-4e99-9260-9c1602b2ca33' | ||
|
||
stages: | ||
- stage: Build | ||
displayName: Create ACR for images | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
#Create ACR to keep docker images | ||
- task: AzureResourceManagerTemplateDeployment@3 | ||
displayName: Deploy ACR Bicep | ||
inputs: | ||
deploymentScope: 'Resource Group' | ||
azureResourceManagerConnection: $(azureserviceconnection) | ||
subscriptionId: $(subscriptionId) | ||
action: 'Create Or Update Resource Group' | ||
resourceGroupName: '$(resource-group)' | ||
location: '$(location)' | ||
templateLocation: 'Linked artifact' | ||
csmFile: '$(templateFile)' | ||
deploymentMode: 'Incremental' | ||
deploymentOutputs: 'acr-json' | ||
|
||
#Parse ACR login server variable | ||
- task: PowerShell@2 | ||
displayName: Parse Bicep Output | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
$var=ConvertFrom-Json '$(acr-json)' | ||
$value=$var.loginServer.value | ||
Write-Host "##vso[task.setvariable variable=acrloginserver;]$value" | ||
echo $acrloginserver | ||
# docker compose build images | ||
- task: DockerCompose@0 | ||
displayName: Build Docker Compose | ||
inputs: | ||
containerregistrytype: 'Azure Container Registry' | ||
azureSubscription: '$(azureserviceconnection)' | ||
azureContainerRegistry: '$(acrloginserver)' | ||
dockerComposeFile: '**/docker-compose.yml' | ||
projectName: | ||
action: 'Build services' | ||
additionalImageTags: '$(Build.BuildNumber)' | ||
includeLatestTag: true | ||
- task: DockerCompose@0 | ||
displayName: Push Docker Compose | ||
inputs: | ||
containerregistrytype: 'Azure Container Registry' | ||
azureSubscription: $(azureserviceconnection) | ||
azureContainerRegistry: '$(acrloginserver)' | ||
dockerComposeFile: '**/docker-compose.yml' | ||
projectName: | ||
action: 'Push services' | ||
additionalImageTags: '$(Build.BuildNumber)' | ||
includeLatestTag: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# trigger: | ||
# - main | ||
|
||
resources: | ||
- repo: self | ||
|
||
stages: | ||
- stage: Build | ||
displayName: Build .Net Core Solution | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
- task: DotNetCoreCLI@2 | ||
displayName: Restore | ||
inputs: | ||
command: 'restore' | ||
projects: '**/*.sln' | ||
feedsToUse: 'select' | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Build | ||
inputs: | ||
command: 'build' | ||
projects: '**/*.sln' | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Test | ||
inputs: | ||
command: 'test' | ||
projects: 'tests/UnitTests/*.csproj' | ||
|
||
- task: WhiteSource@21 | ||
inputs: | ||
cwd: '$(System.DefaultWorkingDirectory)' | ||
projectName: 'eShopOnWeb' | ||
- task: DotNetCoreCLI@2 | ||
displayName: Publish | ||
inputs: | ||
command: 'publish' | ||
publishWebProjects: true | ||
arguments: '-o $(Build.ArtifactStagingDirectory)' | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish Artifacts ADO - Website | ||
inputs: | ||
pathToPublish: '$(Build.ArtifactStagingDirectory)' | ||
artifactName: Website | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# trigger: | ||
# - main | ||
|
||
resources: | ||
- repo: self | ||
|
||
stages: | ||
- stage: Build | ||
displayName: Build .Net Core Solution | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
- task: DotNetCoreCLI@2 | ||
displayName: Restore | ||
inputs: | ||
command: 'restore' | ||
projects: '**/*.sln' | ||
feedsToUse: 'select' | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Build | ||
inputs: | ||
command: 'build' | ||
projects: '**/*.sln' | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Test | ||
inputs: | ||
command: 'test' | ||
projects: 'tests/UnitTests/*.csproj' | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Publish | ||
inputs: | ||
command: 'publish' | ||
publishWebProjects: true | ||
arguments: '-o $(Build.ArtifactStagingDirectory)' | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish Artifacts ADO - Website | ||
inputs: | ||
pathToPublish: '$(Build.ArtifactStagingDirectory)' | ||
artifactName: Website | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish Artifacts ADO - Bicep | ||
inputs: | ||
PathtoPublish: '$(Build.SourcesDirectory)/.azure/bicep/webapp.bicep' | ||
ArtifactName: 'Bicep' | ||
publishLocation: 'Container' |
Oops, something went wrong.