From b3a78980f705d215a3b4e41a3ff2ff189b29860e Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Wed, 25 Feb 2026 08:23:19 +0100 Subject: [PATCH] chore: update task versions and add maxResults input to ListBlobs task --- task/AzureFederatedAuth/task.json | 2 +- task/CopyBlob/task.json | 2 +- task/ListBlobs/package.json | 2 +- task/ListBlobs/src/index.ts | 13 ++++++++++--- task/ListBlobs/task.json | 10 +++++++++- vss-extension.json | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/task/AzureFederatedAuth/task.json b/task/AzureFederatedAuth/task.json index ef4137f..2640ae7 100644 --- a/task/AzureFederatedAuth/task.json +++ b/task/AzureFederatedAuth/task.json @@ -10,7 +10,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 5 + "Patch": 8 }, "instanceNameFormat": "Configure federated auth: $(serviceConnectionARM)", "inputs": [ diff --git a/task/CopyBlob/task.json b/task/CopyBlob/task.json index 91dca18..bca7477 100644 --- a/task/CopyBlob/task.json +++ b/task/CopyBlob/task.json @@ -10,7 +10,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 0 + "Patch": 2 }, "instanceNameFormat": "Copy blob: $(srcStorageAccountName)/$(srcContainerName)/$(blobName)", "inputs": [ diff --git a/task/ListBlobs/package.json b/task/ListBlobs/package.json index b9f5b8d..3c61934 100644 --- a/task/ListBlobs/package.json +++ b/task/ListBlobs/package.json @@ -1,6 +1,6 @@ { "name": "list-blobs-task", - "version": "1.0.0", + "version": "1.0.1", "private": true, "author": "Slawomir Koszewski", "license": "MIT", diff --git a/task/ListBlobs/src/index.ts b/task/ListBlobs/src/index.ts index 06b2f22..c889710 100644 --- a/task/ListBlobs/src/index.ts +++ b/task/ListBlobs/src/index.ts @@ -26,10 +26,11 @@ function parseBlobNames(xml: string): string[] { return names; } -function buildListUrl(storageAccountName: string, containerName: string, prefix: string): string { +function buildListUrl(storageAccountName: string, containerName: string, prefix: string, maxResults: number): string { const url = new URL(`https://${storageAccountName}.blob.core.windows.net/${encodeURIComponent(containerName)}`); url.searchParams.set('restype', 'container'); url.searchParams.set('comp', 'list'); + url.searchParams.set('maxresults', String(maxResults)); if (prefix) { url.searchParams.set('prefix', prefix); @@ -63,12 +64,18 @@ async function run(): Promise { const storageAccountName = requireInput('storageAccountName'); const containerName = requireInput('containerName'); const prefix = tl.getInput('prefix', false)?.trim() || ''; + const maxResultsRaw = tl.getInput('maxResults', false)?.trim() || '1000'; + const maxResults = Number.parseInt(maxResultsRaw, 10); + + if (!Number.isInteger(maxResults) || maxResults <= 0) { + throw new Error(`Invalid maxResults value: ${maxResultsRaw}. Expected a positive integer.`); + } console.log('Requesting storage access token from Microsoft Entra ID...'); const accessToken = await requestStorageAccessToken(endpointId); - const listUrl = buildListUrl(storageAccountName, containerName, prefix); - const blobNames = await listBlobs(listUrl, accessToken); + const listUrl = buildListUrl(storageAccountName, containerName, prefix, maxResults); + const blobNames = (await listBlobs(listUrl, accessToken)).slice(0, maxResults); const serialized = JSON.stringify(blobNames); tl.setVariable('LIST_BLOBS_JSON', serialized); diff --git a/task/ListBlobs/task.json b/task/ListBlobs/task.json index 1a6f2bb..76ac916 100644 --- a/task/ListBlobs/task.json +++ b/task/ListBlobs/task.json @@ -10,7 +10,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 0 + "Patch": 1 }, "instanceNameFormat": "List blobs: $(storageAccountName)/$(containerName)", "inputs": [ @@ -45,6 +45,14 @@ "defaultValue": "", "required": false, "helpMarkDown": "Optional blob name prefix used to filter results." + }, + { + "name": "maxResults", + "type": "string", + "label": "Maximum Blob Count", + "defaultValue": "1000", + "required": false, + "helpMarkDown": "Maximum number of blobs to return. Default is 1000." } ], "execution": { diff --git a/vss-extension.json b/vss-extension.json index b45f80e..83cf3c4 100644 --- a/vss-extension.json +++ b/vss-extension.json @@ -2,7 +2,7 @@ "manifestVersion": 1, "id": "sk-azure-devops-toolkit", "name": "SK Azure DevOps Toolkit", - "version": "1.0.3", + "version": "1.0.4", "publisher": "skoszewski-lab", "targets": [ {