Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewListPager always returns 0 results for TaskRunsClient #23897

Open
ToxicGLaDOS opened this issue Dec 30, 2024 · 1 comment
Open

NewListPager always returns 0 results for TaskRunsClient #23897

ToxicGLaDOS opened this issue Dec 30, 2024 · 1 comment
Labels
Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@ToxicGLaDOS
Copy link

Bug Report

I never get any results from NewListPager when trying to list task runs via TaskRunsClient. I've tried using versions 1.0.0-1.3.0-beta.2 and it doesn't seem to make a difference. The example doesn't seem to work either (after replacing "<subscription-id>", "myResourceGroup", and "myRegistry"). Here's a minimal example that shows the problem (alternatively you could replace the values and run the link above).

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
)

var (
    subscriptionID = "<subscription-id>"
    resourceGroup = "<resource-group>"
    registryName = "<registry>"
)

func main() {
    cred, err := azidentity.NewDefaultAzureCredential(nil)
    if err != nil {
        log.Fatal("Couldn't create credential\n")
    }

    containerRegistryClientFactory, err := armcontainerregistry.NewClientFactory(subscriptionID, cred, nil)
	if err != nil {
		log.Fatal(err)
	}

    taskRunsClient := containerRegistryClientFactory.NewTaskRunsClient()
    taskRunsPager := taskRunsClient.NewListPager(resourceGroup, registryName, nil)

    for taskRunsPager.More() {
        fmt.Println("More")
        page, err := taskRunsPager.NextPage(context.Background())
        if err != nil {
            log.Fatal(err)
        }

        j, err := page.MarshalJSON()
        fmt.Println(string(j))

        for _, taskRun := range page.Value {
            fmt.Println("TaskRun")
            fmt.Printf("%s: %s\n", *taskRun.Name, *taskRun.Properties.RunResult.Name)
        }

    }
}

This yields

More
{"value":[]}

even though this registry definitely has task runs in it's history. This is confirmed by using the azure-cli: az acr task list-runs -r <registry> --subscription <subscription-id> If there were an error I'd expect to hit one of the error conditions.

We can tell that it's at least connecting to the registry because changing the the registry name to a name that doesn't exist yields an error.

module path:
sdk/resourcemanager/containerregistry/armcontainerregistry

go version:
go version go1.22.7 linux/amd64

@github-actions github-actions bot added Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Dec 30, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @northtyphoon @toddysm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Container Registry customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

1 participant