Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneHezser committed Nov 1, 2024
1 parent 8621959 commit 8280210
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion avm/ptn/deployment-script/import-image-to-acr/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ module imageImport 'br/public:avm/res/resources/deployment-script:0.4.0' = {
tags: tags
managedIdentities: useExistingManagedIdentity
// ? managedIdentities // once the referenced module is using the common type
? { userAssignedResourcesIds: managedIdentities.userAssignedResourceIds! }
? { userAssignedResourcesIds: managedIdentities.?userAssignedResourceIds! }
: { userAssignedResourcesIds: [newManagedIdentity.id] }
kind: 'AzureCLI'
runOnce: runOnce
Expand Down
10 changes: 5 additions & 5 deletions avm/ptn/deployment-script/import-image-to-acr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "17604113955002769079"
"templateHash": "13499969833198262162"
},
"name": "import-image-to-acr",
"description": "This modules deployes an image to an Azure Container Registry.",
Expand Down Expand Up @@ -195,7 +195,7 @@
"type": "object",
"nullable": true,
"metadata": {
"example": " {\r\n \"key1\": \"value1\"\r\n \"key2\": \"value2\"\r\n }\r\n ",
"example": " {\n \"key1\": \"value1\"\n \"key2\": \"value2\"\n }\n ",
"description": "Optional. Tags of the resource."
}
}
Expand Down Expand Up @@ -307,7 +307,7 @@
"tags": {
"value": "[parameters('tags')]"
},
"managedIdentities": "[if(variables('useExistingManagedIdentity'), createObject('value', createObject('userAssignedResourcesIds', parameters('managedIdentities').userAssignedResourceIds)), createObject('value', createObject('userAssignedResourcesIds', createArray(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', coalesce(parameters('managedIdentityName'), 'id-ContainerRegistryImport'))))))]",
"managedIdentities": "[if(variables('useExistingManagedIdentity'), createObject('value', createObject('userAssignedResourcesIds', tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'))), createObject('value', createObject('userAssignedResourcesIds', createArray(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', coalesce(parameters('managedIdentityName'), 'id-ContainerRegistryImport'))))))]",
"kind": {
"value": "AzureCLI"
},
Expand Down Expand Up @@ -376,7 +376,7 @@
"value": "[parameters('subnetResourceIds')]"
},
"scriptContent": {
"value": "#!/bin/bash\r\n echo \"Waiting on RBAC replication ($initialDelay)\\n\"\r\n sleep $initialDelay\r\n\r\n # retry loop to catch errors (usually RBAC delays, but 'Error copying blobs' is also not unheard of)\r\n retryLoopCount=0\r\n until [ $retryLoopCount -ge $retryMax ]\r\n do\r\n echo \"Importing Image ($retryLoopCount): $imageName into ACR: $acrName\\n\"\r\n if [ $overwriteExistingImage = 'true' ]; then\r\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\r\n az acr import -n $acrName --source $imageName --image $newImageName --force --username $sourceRegistryUsername --password $sourceRegistryPassword\r\n else\r\n az acr import -n $acrName --source $imageName --image $newImageName --force\r\n fi\r\n else\r\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\r\n az acr import -n $acrName --source $imageName --image $newImageName --username $sourceRegistryUsername --password $sourceRegistryPassword\r\n else\r\n az acr import -n $acrName --source $imageName --image $newImageName\r\n fi\r\n fi\r\n\r\n sleep $retrySleep\r\n retryLoopCount=$((retryLoopCount+1))\r\n done\r\n\r\n echo \"done\\n\""
"value": "#!/bin/bash\n echo \"Waiting on RBAC replication ($initialDelay)\\n\"\n sleep $initialDelay\n\n # retry loop to catch errors (usually RBAC delays, but 'Error copying blobs' is also not unheard of)\n retryLoopCount=0\n until [ $retryLoopCount -ge $retryMax ]\n do\n echo \"Importing Image ($retryLoopCount): $imageName into ACR: $acrName\\n\"\n if [ $overwriteExistingImage = 'true' ]; then\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\n az acr import -n $acrName --source $imageName --image $newImageName --force --username $sourceRegistryUsername --password $sourceRegistryPassword\n else\n az acr import -n $acrName --source $imageName --image $newImageName --force\n fi\n else\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\n az acr import -n $acrName --source $imageName --image $newImageName --username $sourceRegistryUsername --password $sourceRegistryPassword\n else\n az acr import -n $acrName --source $imageName --image $newImageName\n fi\n fi\n\n sleep $retrySleep\n retryLoopCount=$((retryLoopCount+1))\n done\n\n echo \"done\\n\""
}
},
"template": {
Expand Down Expand Up @@ -922,4 +922,4 @@
}
}
}
}
}

0 comments on commit 8280210

Please sign in to comment.