Skip to content

Commit

Permalink
add guard clause to skip artifact with missing build associated (#1967)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandar Djurdjevic <[email protected]>
  • Loading branch information
adjurdjevic and Aleksandar Djurdjevic authored Aug 28, 2024
1 parent 5d78f0c commit 6d5eaea
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,11 @@ export async function restoreAzurePipelineArtifactsBuildInfo(artifactsInRelease:
const [packageId, packageVersion] = [artifactInRelease.buildDefinitionId, artifactInRelease.buildNumber];
const artifactPackageInfo = await packagingApi.getPackage(projectId, feedId, packageId, true);
const packageVersionId = (artifactPackageInfo.versions.find((version) => version.normalizedVersion === packageVersion) || {id: ""}).id;
const artifactBuildInfo = (await packagingApi.getPackageVersionProvenance(projectId, feedId, packageId, packageVersionId));

const artifactBuildInfo = await packagingApi.getPackageVersionProvenance(projectId, feedId, packageId, packageVersionId);
if (!artifactBuildInfo.provenance.data["Build.BuildId"]) {
agentApi.logInfo(`No build ID found for Azure Artifact [${artifactInRelease.artifactAlias}]. Skipping this artifact.`);
continue; // Guard clause for missing build ID
}
Object.assign(artifactInRelease, {
artifactType: "Build",
buildId: artifactBuildInfo.provenance.data["Build.BuildId"],
Expand Down

0 comments on commit 6d5eaea

Please sign in to comment.