Skip to content

Commit

Permalink
Changed to common useDotNetSDK template. (#72)
Browse files Browse the repository at this point in the history
* Changed to common useDotNetSDK template.

* Added documentation for new common template useDotNetSDK.
  • Loading branch information
SaxProfanityBandit authored May 31, 2023
1 parent 3646d63 commit 32e9fc8
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 31 deletions.
15 changes: 15 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Azure DevOps Pipelines Docs is used to publish and deploy Documentation to Azure
resourceGroupFormat | string | No | '{0}-{1}-{2}' | The format for the resourceGroup name.
preBuildScript | object | No | | Object containing pre-build parameters.
environments | array | Yes | | Array of environments and environment specific parameters.
useDotNetSDK | object | No | | Object containing parameters for specified dotnet SDK.
artifactNamePrefix | string | No | | Prefix for artifacts created by this pipeline.
projectRoot | string | No | | For changing the root of the project, ie where input or other folders are located.

Expand All @@ -41,6 +42,15 @@ Azure DevOps Pipelines Docs is used to publish and deploy Documentation to Azure
bashEnvValue | string | No | | Value for BASH_ENV environment variable.
pwsh | bool | No | false | Use PowerShell Core.

## Use DotNet SDK

**Parameters** | **Type** | **Required** | **Default value** | **Description**
------------------|----------|--------------|-------------------|----------------------------------
packageType | string | No | sdk | Specifies if only the .NET runtime or the SDK should be installed.
useGlobalJson | bool | No | true | Specifies if sdk should be installed from a globalJson file.
workingDirectory | string | No | | The path to the globalJson file.
version | string | No | | Specifies a specific version of the dotnet sdk.

## Source

**Parameters** | **Type** | **Required** | **Default value** | **Description**
Expand Down Expand Up @@ -132,6 +142,11 @@ stages:
resourceGroupFormat: '{0}-{1}-{2}-{3}'
artifactNamePrefix: prefix
projectRoot: some/directory
useDotNetSDK:
packageType: sdk/runtime
useGlobalJson: true/false
workingDirectory: workingDirectory
version: '6.0.x'
build: envName
sources:
- name: authenticateSourceName
Expand Down
13 changes: 3 additions & 10 deletions docs/build_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@ jobs:
fetchTags: true
displayName: Checkout $(Build.Repository.Name)

- task: UseDotNet@2
displayName: 'Use .NET SDK 6.0.x'
inputs:
packageType: sdk
version: '6.0.x'

- task: UseDotNet@2
displayName: Use .NET Core from global.json
inputs:
useGlobalJson: true
- template: ../dotnetcommon/dotnet_sdk.yml
parameters:
useDotNetSDK: ${{ parameters.useDotNetSDK }}

- template: ../dotnetcommon/dotnet_auth.yml
parameters:
Expand Down
3 changes: 2 additions & 1 deletion docs/build_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ stages:
sites: ${{ parameters.sites }}
preBuildScript: ${{ parameters.preBuildScript }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
projectRoot: ${{ coalesce(parameters.projectRoot, '.') }}
projectRoot: ${{ coalesce(parameters.projectRoot, '.') }}
useDotNetSDK: ${{ parameters.useDotNetSDK }}
7 changes: 3 additions & 4 deletions docs/deploy_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ jobs:
fetchDepth: 0
displayName: Checkout $(Build.Repository.Name)

- task: UseDotNet@2
displayName: Use .NET Core from global.json
inputs:
useGlobalJson: true
- template: ../dotnetcommon/dotnet_sdk.yml
parameters:
useDotNetSDK: ${{ parameters.useDotNetSDK }}

- template: ../dotnetcommon/dotnet_auth.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions docs/deploy_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ stages:
searchServiceName: ${{ coalesce(parameters.searchServiceName, format(coalesce(parameters.searchServiceNameFormat, '{0}-{1}-{2}-{3}'), parameters.system, coalesce(parameters.searchServiceType, 'srch'), environment.env, parameters.suffix)) }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
projectRoot: ${{ coalesce(parameters.projectRoot, '.') }}
useDotNetSDK: ${{ parameters.useDotNetSDK }}

15 changes: 15 additions & 0 deletions dotnetweb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Azure DevOps YAML template is used to deploy and publish web applications.
projectSrc | string | No | src | Source folder to build, pack and publish.
preBuildScript | object | No | | Object containing pre-build parameters.
environments | array | Yes | | Array of environments and environment specific parameters.
useDotNetSDK | object | No | | Object containing parameters for specified dotnet SDK.
artifactNamePrefix | string | No | | Prefix for artifacts created by this pipeline.

## Pre-Build
Expand All @@ -37,6 +38,15 @@ Azure DevOps YAML template is used to deploy and publish web applications.
bashEnvValue | string | No | | Value for BASH_ENV environment variable.
pwsh | bool | No | false | Use PowerShell Core.

## Use DotNet SDK

**Parameters** | **Type** | **Required** | **Default value** | **Description**
------------------|----------|--------------|-------------------|----------------------------------
packageType | string | No | sdk | Specifies if only the .NET runtime or the SDK should be installed.
useGlobalJson | bool | No | true | Specifies if sdk should be installed from a globalJson file.
workingDirectory | string | No | | The path to the globalJson file.
version | string | No | | Specifies a specific version of the dotnet sdk.

## Source

**Parameters** | **Type** | **Required** | **Default value** | **Description**
Expand Down Expand Up @@ -141,6 +151,11 @@ stages:
workingDirectory: workingDirectory
bashEnvValue: bashEnvValue
build: envName
useDotNetSDK:
packageType: sdk/runtime
useGlobalJson: true/false
workingDirectory: workingDirectory
version: '6.0.x'
shouldDeploy: eq(variables['Build.SourceBranch'], 'refs/heads/main')
environments:
- env: env
Expand Down
8 changes: 3 additions & 5 deletions dotnetweb/publish_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ jobs:
- job: Publish
displayName: ${{ format('{0} Build', parameters.name) }}
steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK (global.json)'
inputs:
packageType: sdk
useGlobalJson: true
- template: ../dotnetcommon/dotnet_sdk.yml
parameters:
useDotNetSDK: ${{ parameters.useDotNetSDK }}

- template: ../dotnetcommon/dotnet_auth.yml
parameters:
Expand Down
3 changes: 2 additions & 1 deletion dotnetweb/publish_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ stages:
buildParameters: ${{ parameters.buildParameters }}
projectSrc: ${{ coalesce(parameters.projectSrc, 'src') }}
preBuildScript: ${{ parameters.preBuildScript }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
useDotNetSDK: ${{ parameters.useDotNetSDK }}
15 changes: 15 additions & 0 deletions sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Azure DevOps Pipelines YAML template used to build and deploy databases.
projectSrc | string | No | src | Source folder to build, pack and publish.
preBuildScript | object | No | | Object containing pre-build parameters.
environments | array | Yes | | Array of environments and environment specific parameters.
useDotNetSDK | object | No | | Object containing parameters for specified dotnet SDK.
artifactNamePrefix | string | No | | Prefix for artifacts created by this pipeline.

## Pre-Build
Expand All @@ -40,6 +41,15 @@ Azure DevOps Pipelines YAML template used to build and deploy databases.
bashEnvValue | string | No | | Value for BASH_ENV environment variable.
pwsh | bool | No | false | Use PowerShell Core.

## Use DotNet SDK

**Parameters** | **Type** | **Required** | **Default value** | **Description**
------------------|----------|--------------|-------------------|----------------------------------
packageType | string | No | sdk | Specifies if only the .NET runtime or the SDK should be installed.
useGlobalJson | bool | No | true | Specifies if sdk should be installed from a globalJson file.
workingDirectory | string | No | | The path to the globalJson file.
version | string | No | | Specifies a specific version of the dotnet sdk.

## Source

**Parameters** | **Type** | **Required** | **Default value** | **Description**
Expand Down Expand Up @@ -169,6 +179,11 @@ stages:
workingDirectory: workingDirectory
bashEnvValue: bashEnvValue
build: envName
useDotNetSDK:
packageType: sdk/runtime
useGlobalJson: true/false
workingDirectory: workingDirectory
version: '6.0.x'
shouldDeploy: eq(variables['Build.SourceBranch'], 'refs/heads/main')
environments:
- env: dev
Expand Down
8 changes: 3 additions & 5 deletions sql/build_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ jobs:
- job: Build
displayName: ${{ format('{0} Build SSDT', parameters.name) }}
steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK (global.json)'
inputs:
packageType: sdk
useGlobalJson: true
- template: ../dotnetcommon/dotnet_sdk.yml
parameters:
useDotNetSDK: ${{ parameters.useDotNetSDK }}

- template: ../dotnetcommon/dotnet_auth.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions sql/build_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ stages:
projectSrc: ${{ coalesce(parameters.projectSrc, 'src') }}
preBuildScript: ${{ parameters.preBuildScript }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
useDotNetSDK: ${{ parameters.useDotNetSDK }}
8 changes: 3 additions & 5 deletions sql/publish_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ jobs:
- checkout: self
displayName: Checkout $(Build.Repository.Name)

- task: UseDotNet@2
displayName: 'Use .NET SDK (global.json)'
inputs:
packageType: sdk
useGlobalJson: true
- template: ../dotnetcommon/dotnet_sdk.yml
parameters:
useDotNetSDK: ${{ parameters.useDotNetSDK }}

- template: ../dotnetcommon/dotnet_auth.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions sql/publish_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ stages:
sources: ${{ parameters.sources }}
databases: ${{ parameters.databases }}
artifactNamePrefix: ${{ parameters.artifactNamePrefix }}
useDotNetSDK: ${{ parameters.useDotNetSDK }}

0 comments on commit 32e9fc8

Please sign in to comment.