Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CD as commented section #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 43 additions & 21 deletions templates/asp.net-core-.net-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,51 @@
trigger:
- master

pool:
vmImage: 'windows-latest'
stages:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unclear to me what this template is supposed to do. Ideally it should be build and deploy .Net core app to Azure Web App or Web App Linux or equivalent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are so many options to deploy a .net core app. It looks like the intent of this template is to provide enough of a boiler plate so that one can later add the script/task more easily through the editor. I agree that this is a good step.

- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'windows-latest'

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0

steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
#- stage: Deploy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting out the entire section, we should introduce stage condition with a variable initialized such that it will skip the stage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with this is that it will impact the user experience. It will show two stages in all runs in the landing page and in the summary. The second stage will always show as skipped. There are some optimizations in the UI for a single stage pipeline. Those will be lost. I would like to start here and see how many people uncomment this section and grow up from here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a syntax flaw in my opinion. Something like insertCondition: would be a very welcome feature. Sure, it can partly be solved using expressions, but it's clunky, has a goofy syntax, poor VSCode support and can't be used with variables not available at template compile time.

# displayName: Deploy stage
# dependsOn: Build
# condition: succeeded()
# jobs:
# - deployment: Deploy
# displayName: Deploy
# environment: '$(EnvironmentName)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnvironmentName variable is not initialized. We should evaluate using different defaults.For example reponame-dev and/or appname-dev

# pool:
# vmImage: $(vmImageName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build stage is using "windows-latest", we should have a variable that can be used across here?

# strategy:
# runOnce:
# deploy:
# steps:
# - script: echo Replace this step with your Deployment configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be WebApp deploy step with subscription, appname as inputs in the wizard. Check if UI panel can be bypassed if the stage is disabled