Unable to publish or import psresource in cache rule
- Dominant language
- No language data
- Stars
- 177
- Forks
- 137
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
After creating a ACR for psresources with a cache rule against MAR, there is no way to get the module into the ACR.
The cache rule blocks pushes for the target-repo in the cache rule.
I need a way for my acr to pull the pwsh module referenced in the cache rule
OR
be allowed to push/copy this module into the acr.
**To Reproduce**
Steps to reproduce the behavior:
1. create acr
2. create cache rule
3. copy psresource into the acr (`oras copy`, `Import-AzContainerRegistryImage`, `az acr import`)
4. get error
```pwsh
$resourceGroupName = 'rg-pwshacr'
$registryName = 'acrtest736'
Connect-AzAccount
New-AzContainerRegistry -Name $registryName -ResourceGroupName $resourceGroupName -Sku 'Basic' -Location 'swedencentral'
$body = @{
properties = @{
sourceRepository = 'mcr.microsoft.com/psresource/az.ssh'
targetRepository = "az.ssh"
}
}
$subId = (Get-AzContext).Subscription.Id
$uri = "https://management.azure.com/subscriptions/$subId/resourceGroups/$resourceGroupName/providers/Microsoft.ContainerRegistry/registries/$registryName/cacheRules/nameforcacherule?api-version=2023-01-01-preview"
Invoke-AzRestMethod -Uri $uri -Method PUT -Payload ($body | ConvertTo-Json)
$splat = @{
RegistryName = $registryName
ResourceGroupName = $resourceGroupName
SourceRegistryUri = 'mcr.microsoft.com'
SourceImage = 'psresource/az.ssh:0.2.1'
TargetTag = 'az.ssh:0.2.1'
}
Import-AzContainerRegistryImage @splat
```
**Expected behavior**
Two possible behaviors:
1. the acr does the pull for me (automatically or manually triggered)
2. I can use `Import-AzContainerRegistryImage` without error, as long as the source registry and source image matches the cache rule. e.g. I should not be able to have a cache rule for a MAR-module and push my local module to that acr- repository
**Screenshots**
### `oras copy`
### `Import-AzContainerRegistryImage`
### `az acr import`
**Any relevant environment information**
- OS: win11
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.