Skip to content

Commit

Permalink
Merge pull request #56 from JFolberth/feature/dacpac_infra
Browse files Browse the repository at this point in the history
Feature/dacpac infra
  • Loading branch information
JFolberth authored Aug 13, 2024
2 parents 76daff9 + 08cbead commit ea0bd85
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 14 deletions.
2 changes: 2 additions & 0 deletions jobs/arm_rg_deploy_env_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ parameters:
type: string
- name: infrastructureHasSecrets
type: boolean
default: false
- name: infrastructureSecrets
type: object
default: []
- name: dependsOn
type: object
default: []
Expand Down
2 changes: 2 additions & 0 deletions jobs/bicep_deploy_env_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ parameters:
type: string
- name: infrastructureHasSecrets
type: boolean
default: false
- name: infrastructureSecrets
type: object
default: false
- name: dependsOn
type: object
default: []
Expand Down
2 changes: 1 addition & 1 deletion stages/bicep_build_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ stages:
- stage: '${{ parameters.serviceName }}_build'
variables:
- name: bicepParamString
${{ if eq(parameters.BicepParamExt, true)}} :
${{ if eq(parameters.bicepParamExt, true)}} :
value: '.bicepparam'
${{ else }} :
value: '.json'
Expand Down
2 changes: 1 addition & 1 deletion stages/bicep_deploy_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ stages:
- stage: '${{ parameters.serviceName }}_${{ environmentObject.environmentName}}_${{regionAbrv}}_bicep_deploy'
variables:
- name: bicepParamString
${{ if eq(parameters.BicepParamExt, true)}} :
${{ if eq(parameters.bicepParamExt, true)}} :
value: '.bicepparam'
${{ else }} :
value: '.json'
Expand Down
32 changes: 20 additions & 12 deletions stages/bicep_dotnet_depoy_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,50 @@ parameters:
infrastructureHasSecrets: false
infrastructureSecrets: []
deploymentScope: 'subscription'
paramExt: '.json'
bicepParamExt: false

stages:
- ${{ each regionAbrv in parameters.regionAbrvs }} :
- stage: deploy_${{ parameters.serviceName }}_${{parameters.environmentName }}_${{ regionAbrv }}
variables:
${{ if eq(parameters.BicepParamExt, true)}} :
bicepParamString: '.bicepparam'
${{ else }} :
bicepParamString: '.json'
${{ if eq(parameters.dependsOnEnv,'' )}} :
dependsOnEnv: '${{ parameters.serviceName }}_build'
${{ else }}:
dependsOnEnv: 'deploy_${{ parameters.serviceName }}_${{parameters.dependsOnEnv}}_${{ regionAbrv }}'
workSpace: $(Pipeline.Workspace)
dependsOn: ${{ variables.dependsOnEnv }}


jobs:
- ${{ elseif eq(parameters.deploymentScope, 'subscription')}} :
- template: ../jobs/bicep_deploy_env_job.yml
- ${{ if eq(parameters.deploymentScope, 'resourceGroup')}} :
- template: ../jobs/arm_rg_deploy_env_job.yml
parameters:
environmentName: ${{ parameters.environmentName }}
templateFile: ${{ parameters.templateFile }}
environmentName: ${{ environmentObject.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName}}
regionAbrv: ${{ regionAbrv }}
infrastructureHasSecrets: ${{ parameters.infrastructureHasSecrets }}
infrastructureSecrets: ${{ parameters.infrastructureSecrets}}
appName: ${{ parameters.appName }}
paramExt: ${{ parameters.paramExt }}

- ${{ if eq(parameters.deploymentScope, 'resourceGroup')}} :
- template: ../jobs/arm_rg_deploy_env_job.yml
paramExt: ${{ varaibles.bicepParamString }}
- ${{ elseif eq(parameters.deploymentScope, 'subscription')}} :
- template: ../jobs/bicep_deploy_env_job.yml
parameters:
environmentName: ${{ environmentObject.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
environmentName: ${{ parameters.environmentName }}
templateFile: ${{ parameters.templateFile }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName}}
regionAbrv: ${{ regionAbrv }}
infrastructureHasSecrets: ${{ parameters.infrastructureHasSecrets }}
infrastructureSecrets: ${{ parameters.infrastructureSecrets}}
appName: ${{ parameters.appName }}
paramExt: ${{ varaibles.bicepParamString }}


- ${{ each projectNamesConfiguration in parameters.projectNamesConfigurations }} :
- template: ../jobs/func_app_deploy_env_job.yml
parameters:
Expand Down
75 changes: 75 additions & 0 deletions stages/dacpac_infra_deploy_stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
parameters:
- name: projectConfigurations
type: object
default:
projectName: ''
environmentName: 'dev'
regionAbrvs: ['cus']
sqlServerName: ''
sqlDatabaseName: ''
resourceGroupName: ''
authenticationType: 'servicePrincipal'
ipDetectionMethod: 'AutoDetect'
deployType: 'DacpacTask'
- name: serviceName
type: string
default: ''
- name: deploymentScope
type: string
default: 'subscription'
- name: bicepParamExt
type: boolean
default: false
- name: templateDirectory
type: string
default: 'infrastructure'
- name: templateFileName
type: string
default: 'main'



stages:

- ${{ each projectConfiguration in parameters.projectConfigurations }} :
- ${{ each regionAbrv in projectConfiguration.regionAbrvs }} :
- stage: '${{ parameters.serviceName }}_${{ projectConfiguration.environmentName}}_${{regionAbrv}}_dacpac_deploy'
variables:
- name: bicepParamString
${{ if eq(parameters.bicepParamExt, true)}} :
value: '.bicepparam'
${{ else }} :
value: '.json'
jobs:
- ${{ if eq(parameters.deploymentScope, 'subscription')}} :
- template: ../jobs/bicep_deploy_env_job.yml
parameters:
environmentName: ${{ projectConfiguration.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName}}
regionAbrv: ${{ regionAbrv }}
paramExt: ${{ variables.bicepParamString }}
- ${{ elseif eq(parameters.deploymentScope, 'resourceGroup')}} :
- template: ../jobs/arm_rg_deploy_env_job.yml
parameters:
environmentName: ${{ projectConfiguration.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName}}
regionAbrv: ${{ regionAbrv }}
paramExt: ${{ variables.bicepParamString }}
- template: ../jobs/dacpac_deploy_env_job.yml
parameters:
environmentName: ${{ projectConfiguration.environmentName }}
serviceName: ${{ parameters.serviceName}}
regionAbrv: ${{ regionAbrv }}
sqlServerName: ${{ projectConfiguration.sqlServerName }}
resourceGroupName: ${{ projectConfiguration.resourceGroupName }}
sqlDatabaseName: ${{ projectConfiguration.sqlDatabaseName }}
authenticationType: ${{ projectConfiguration.authenticationType }}
ipDetectionMethod: ${{ projectConfiguration.ipDetectionMethod }}
deployType: ${{ projectConfiguration.deployType }}
dacpacFilePath: ${{ projectConfiguration.projectName }}\**\*.dacpac
dependsOn: ['${{ parameters.serviceName }}_infrastructure_${{ projectConfiguration.environmentName}}_${{ regionAbrv }}']

70 changes: 70 additions & 0 deletions stages/dotnet_sql_infra_build_stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
parameters:
projectNamesConfigurations:
- projectName: ''
publishWebProject: true
dotnetTest: true
efMigrationScript: false
startUpProjectName: ''
projectExtension: '.sqlproj'
buildArguments: ''
environmentName: 'dev'
regionAbrvs: ['eus']
solutionName: ''
serviceName: ''
sdkVersion: ''
zipAppAfterPublish: true
publishArguments: ''
artifactsToPublish: ['infrastructure']
bicepParamExt: false
deploymentScope: 'subscription'
templateDirectory: 'infrastructure'
templateFileName: 'main'

stages:
- stage: '${{ parameters.serviceName }}_build'
variables:
solutionPath: '$(Build.SourcesDirectory)/${{ parameters.solutionName }}/'
${{ if eq(parameters.bicepParamExt, true)}} :
bicepParamString: '.bicepparam'
${{ else }} :
bicepParamString: '.json'
jobs:
- ${{ each artifactToPublish in parameters.artifactsToPublish }} :
- template: ../jobs/ado_publish_job.yml
parameters:
targetPath: ${{ artifactToPublish }}
artifactname: ${{ artifactToPublish }}


- ${{ each projectNamesConfiguration in parameters.projectNamesConfigurations }} :
- template: ../jobs/dotnetcore_sql_build_publish_job.yml
parameters:
solutionName: ${{ parameters.solutionName }}
projectName: ${{replace(projectNamesConfiguration.projectName,'.','_')}}
publishWebProject: ${{ projectNamesConfiguration.publishWebProject }}
sdkVersion: ${{ parameters.sdkVersion }}
dotNetTest: ${{ projectNamesConfiguration.dotnetTest }}
zipAfterPublish: ${{ parameters.zipAppAfterPublish }}
publishArguments: ${{ parameters.publishArguments }}
startUpProjectName: ${{ projectNamesConfiguration.startUpProjectName }}
projectExtension: ${{ projectNamesConfiguration.projectExtension }}
buildArguments: ${{ projectNamesConfiguration.buildArguments }}
- ${{ each regionAbrv in projectNamesConfiguration.regionAbrvs }} :
- ${{ if eq(parameters.deploymentScope, 'subscription')}} :
- template: ../jobs/bicep_whatif_env_job.yml
parameters:
environmentName: ${{ projectNamesConfiguration.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName }}
regionAbrv: ${{ regionAbrv }}
paramExt: ${{ variables.bicepParamString }}
- ${{ elseif eq(parameters.deploymentScope, 'resourceGroup')}} :
- template: ../jobs/bicep_whatif_rg_env_job.yml
parameters:
environmentName: ${{ projectNamesConfiguration.environmentName }}
templateFileName: ${{ parameters.templateFileName }}
templateDirectory: ${{ parameters.templateDirectory }}
serviceName: ${{ parameters.serviceName }}
regionAbrv: ${{ regionAbrv }}
paramExt: ${{ variables.bicepParamString }}

0 comments on commit ea0bd85

Please sign in to comment.