Skip to content

Unable to publish or import psresource in cache rule #845

@picccard

Description

@picccard

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
$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

Image

Import-AzContainerRegistryImage

Image

az acr import

Image

Any relevant environment information

  • OS: win11
Image

Metadata

Metadata

Assignees

Labels

bugFeature bugs that should be fixed.customer-response-pendingIssues that are pending customer responsefeature-artifact-syncIssues related to Artifact Sync feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions