Skip to content

Commit

Permalink
Personal/namalu/branch specific deploy (#298)
Browse files Browse the repository at this point in the history
* Added ability to specify git branch during container deployment

* Updated Docker files to fix packaging issue

* Allow concurrent container building

* Revert concurrent container build change

* Updated comments in Bicep and ARM Templates

---------

Co-authored-by: Nate Malubay <[email protected]>
  • Loading branch information
namalu and Nate Malubay authored Oct 6, 2023
1 parent 63d429b commit 2ee881d
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 42 deletions.
18 changes: 12 additions & 6 deletions deploy/templates/bicep/BuildContainerImages.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down Expand Up @@ -34,7 +34,13 @@ param location string
'Lookup'
'LookupWithEncounter'
])
param resourceIdentityResolutionType string
param resourceIdentityResolutionType string

@description('The URL for the repository where the container code resides.')
param gitRepositoryUrl string = 'https://github.com/microsoft/iomt-fhir.git'

@description('The branch name or commit hash to be used when building the containers, defaults to main.')
param gitBranch string = 'main'

@description('FHIR version that the FHIR Server supports')
@allowed([
Expand All @@ -50,13 +56,13 @@ resource userAssignedMI 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-0
name: '${baseName}UAMI'
}

var gitRepositoryAndBranch = '${gitRepositoryUrl}#${gitBranch}'
var normalizationImage = 'normalization'
var fhirTransformationImage = 'fhir-transformation'
var imageTag = 'latest'
var normalizationDockerfile = 'src/console/Microsoft.Health.Fhir.Ingest.Console.Normalization/Dockerfile'
var fhirTransformationDockerfile = 'src/console/Microsoft.Health.Fhir.Ingest.Console.FhirTransformation/Dockerfile'

param gitRepositoryUrl string = 'https://github.com/microsoft/iomt-fhir.git'
param acrBuildPlatform string = 'linux'

resource deploymentStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' existing = {
Expand Down Expand Up @@ -86,7 +92,7 @@ resource buildNormalizationImage 'Microsoft.Resources/deploymentScripts@2020-10-
containerGroupName: '${baseName}deployContainer'
}
azCliVersion: '2.50.0'
arguments: '${containerRegistry.name} ${gitRepositoryUrl} ${normalizationImage} ${imageTag} ${normalizationDockerfile} ${acrBuildPlatform}'
arguments: '${containerRegistry.name} ${gitRepositoryAndBranch} ${normalizationImage} ${imageTag} ${normalizationDockerfile} ${acrBuildPlatform}'
scriptContent: '''
az acr build --registry $1 $2 --image $3:$4 --file $5 --platform $6
'''
Expand Down Expand Up @@ -118,7 +124,7 @@ resource buildFhirTransformationImage 'Microsoft.Resources/deploymentScripts@202
containerGroupName: '${baseName}deployContainer'
}
azCliVersion: '2.50.0'
arguments: '${containerRegistry.name} ${gitRepositoryUrl} ${fhirTransformationImage} ${imageTag} ${fhirTransformationDockerfile} ${acrBuildPlatform}'
arguments: '${containerRegistry.name} ${gitRepositoryAndBranch} ${fhirTransformationImage} ${imageTag} ${fhirTransformationDockerfile} ${acrBuildPlatform}'
scriptContent: '''
az acr build --registry $1 $2 --image $3:$4 --file $5 --platform $6
'''
Expand Down
12 changes: 10 additions & 2 deletions deploy/templates/bicep/ContainerApp-SingleAzureDeploy.bicep
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
targetScope = 'subscription'

@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down Expand Up @@ -44,6 +44,12 @@ param resourceIdentityResolutionType string
])
param fhirVersion string

@description('The URL for the repository where the container code resides.')
param gitRepositoryUrl string = 'https://github.com/microsoft/iomt-fhir.git'

@description('The branch name or commit hash to be used when building the containers, defaults to main.')
param gitBranch string = 'main'

resource resourceGroup 'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: baseName
location: location
Expand Down Expand Up @@ -86,6 +92,8 @@ module buildContainerImages 'BuildContainerImages.bicep' = {
location: location
resourceIdentityResolutionType: resourceIdentityResolutionType
fhirVersion: fhirVersion
gitRepositoryUrl: gitRepositoryUrl
gitBranch: gitBranch
}
dependsOn: [
infrastructureSetup
Expand Down
83 changes: 57 additions & 26 deletions deploy/templates/bicep/ContainerApp-SingleAzureDeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.20.4.51522",
"templateHash": "13672600818265155109"
"version": "0.22.6.54827",
"templateHash": "13353804260323222956"
}
},
"parameters": {
"baseName": {
"type": "string",
"minLength": 3,
"minLength": 6,
"maxLength": 16,
"metadata": {
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters."
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters."
}
},
"location": {
Expand Down Expand Up @@ -64,6 +64,20 @@
"metadata": {
"description": "FHIR version that the FHIR Server supports"
}
},
"gitRepositoryUrl": {
"type": "string",
"defaultValue": "https://github.com/microsoft/iomt-fhir.git",
"metadata": {
"description": "The URL for the repository where the container code resides."
}
},
"gitBranch": {
"type": "string",
"defaultValue": "main",
"metadata": {
"description": "The branch name or commit hash to be used when building the containers, defaults to main."
}
}
},
"resources": [
Expand Down Expand Up @@ -107,17 +121,17 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.20.4.51522",
"templateHash": "9440424175545731576"
"version": "0.22.6.54827",
"templateHash": "17349789646225745736"
}
},
"parameters": {
"baseName": {
"type": "string",
"minLength": 3,
"minLength": 6,
"maxLength": 16,
"metadata": {
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters."
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters."
}
},
"location": {
Expand Down Expand Up @@ -450,17 +464,17 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.20.4.51522",
"templateHash": "11639116328160071053"
"version": "0.22.6.54827",
"templateHash": "11088519812661916410"
}
},
"parameters": {
"baseName": {
"type": "string",
"minLength": 3,
"minLength": 6,
"maxLength": 16,
"metadata": {
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters."
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters."
}
},
"location": {
Expand Down Expand Up @@ -660,6 +674,12 @@
},
"fhirVersion": {
"value": "[parameters('fhirVersion')]"
},
"gitRepositoryUrl": {
"value": "[parameters('gitRepositoryUrl')]"
},
"gitBranch": {
"value": "[parameters('gitBranch')]"
}
},
"template": {
Expand All @@ -668,17 +688,17 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.20.4.51522",
"templateHash": "12312286705077005359"
"version": "0.22.6.54827",
"templateHash": "1636373595736283998"
}
},
"parameters": {
"baseName": {
"type": "string",
"minLength": 3,
"minLength": 6,
"maxLength": 16,
"metadata": {
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters."
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters."
}
},
"location": {
Expand Down Expand Up @@ -720,6 +740,20 @@
"description": "Configures how patient, device, and other FHIR resource identities are resolved from the ingested data stream."
}
},
"gitRepositoryUrl": {
"type": "string",
"defaultValue": "https://github.com/microsoft/iomt-fhir.git",
"metadata": {
"description": "The URL for the repository where the container code resides."
}
},
"gitBranch": {
"type": "string",
"defaultValue": "main",
"metadata": {
"description": "The branch name or commit hash to be used when building the containers, defaults to main."
}
},
"fhirVersion": {
"type": "string",
"allowedValues": [
Expand All @@ -729,16 +763,13 @@
"description": "FHIR version that the FHIR Server supports"
}
},
"gitRepositoryUrl": {
"type": "string",
"defaultValue": "https://github.com/microsoft/iomt-fhir.git"
},
"acrBuildPlatform": {
"type": "string",
"defaultValue": "linux"
}
},
"variables": {
"gitRepositoryAndBranch": "[format('{0}#{1}', parameters('gitRepositoryUrl'), parameters('gitBranch'))]",
"normalizationImage": "normalization",
"fhirTransformationImage": "fhir-transformation",
"imageTag": "latest",
Expand Down Expand Up @@ -771,7 +802,7 @@
"containerGroupName": "[format('{0}deployContainer', parameters('baseName'))]"
},
"azCliVersion": "2.50.0",
"arguments": "[format('{0} {1} {2} {3} {4} {5}', format('{0}acr', parameters('baseName')), parameters('gitRepositoryUrl'), variables('normalizationImage'), variables('imageTag'), variables('normalizationDockerfile'), parameters('acrBuildPlatform'))]",
"arguments": "[format('{0} {1} {2} {3} {4} {5}', format('{0}acr', parameters('baseName')), variables('gitRepositoryAndBranch'), variables('normalizationImage'), variables('imageTag'), variables('normalizationDockerfile'), parameters('acrBuildPlatform'))]",
"scriptContent": " az acr build --registry $1 $2 --image $3:$4 --file $5 --platform $6\r\n ",
"retentionInterval": "P1D",
"cleanupPreference": "OnSuccess"
Expand Down Expand Up @@ -802,7 +833,7 @@
"containerGroupName": "[format('{0}deployContainer', parameters('baseName'))]"
},
"azCliVersion": "2.50.0",
"arguments": "[format('{0} {1} {2} {3} {4} {5}', format('{0}acr', parameters('baseName')), parameters('gitRepositoryUrl'), variables('fhirTransformationImage'), variables('imageTag'), variables('fhirTransformationDockerfile'), parameters('acrBuildPlatform'))]",
"arguments": "[format('{0} {1} {2} {3} {4} {5}', format('{0}acr', parameters('baseName')), variables('gitRepositoryAndBranch'), variables('fhirTransformationImage'), variables('imageTag'), variables('fhirTransformationDockerfile'), parameters('acrBuildPlatform'))]",
"scriptContent": " az acr build --registry $1 $2 --image $3:$4 --file $5 --platform $6\r\n ",
"retentionInterval": "P1D",
"cleanupPreference": "OnSuccess"
Expand Down Expand Up @@ -850,17 +881,17 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.20.4.51522",
"templateHash": "18029408802853782428"
"version": "0.22.6.54827",
"templateHash": "17147861500615029993"
}
},
"parameters": {
"baseName": {
"type": "string",
"minLength": 3,
"minLength": 6,
"maxLength": 16,
"metadata": {
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters."
"description": "Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters."
}
},
"location": {
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/bicep/ContainerAppSetup.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/bicep/InfrastructureSetup.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/bicep/Main.bicep
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
targetScope = 'subscription'

@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/bicep/UploadTemplates.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@minLength(3)
@minLength(6)
@maxLength(16)
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 3 characters and less than 16 characters.')
@description('Basename that is used to name provisioned resources. Should be alphanumeric, at least 6 characters and less than 16 characters.')
param baseName string

@description('Location where the resources are deployed. For a list of Azure regions where Azure Health Data Services are available, see [Products available by regions](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=health-data-services)')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM mcr.microsoft.com/dotnet/runtime:6.0@sha256:3525f2e1a54f8e437ea98a2237e1db8
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:5ecf5be1ce0aa12d623963336a54f588091797f75268d57d40dc01260fc58d09 AS publish
COPY ["Directory.Build.props", "."]
COPY ["Directory.Packages.props", "."]
COPY ["nuget.config", "."]
COPY ["src/console/Microsoft.Health.Fhir.Ingest.Console.FhirTransformation", "src/console/Microsoft.Health.Fhir.Ingest.Console.FhirTransformation"]
COPY ["src/console/Microsoft.Health.Fhir.Ingest.Console.Common", "src/console/Microsoft.Health.Fhir.Ingest.Console.Common"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM mcr.microsoft.com/dotnet/runtime:6.0@sha256:3525f2e1a54f8e437ea98a2237e1db8
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:5ecf5be1ce0aa12d623963336a54f588091797f75268d57d40dc01260fc58d09 AS publish
COPY ["Directory.Build.props", "."]
COPY ["Directory.Packages.props", "."]
COPY ["nuget.config", "."]
COPY ["src/console/Microsoft.Health.Fhir.Ingest.Console.Normalization", "src/console/Microsoft.Health.Fhir.Ingest.Console.Normalization"]
COPY ["src/console/Microsoft.Health.Fhir.Ingest.Console.Common", "src/console/Microsoft.Health.Fhir.Ingest.Console.Common"]
Expand Down

0 comments on commit 2ee881d

Please sign in to comment.