Skip to content

Commit

Permalink
Create metadata.json file in conslidated artifacts intermediate pipel…
Browse files Browse the repository at this point in the history
…ine (#3884)

* adding generate metadata file

* remove code mirror

* get correct inproc version

* print out metadata file

* fixing zip issue

* fixing release number

* fixing release number again

* removing zip artifact script and fixing code mirror
  • Loading branch information
aishwaryabh authored Oct 17, 2024
1 parent ca526b9 commit c44e837
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
param (
[string]$StagingDirectory
)

# Define paths using the provided StagingDirectory
$stagingCoreToolsCli = Join-Path $StagingDirectory "coretools-cli"
$stagingCoreToolsVisualStudio = Join-Path $StagingDirectory "coretools-visualstudio"

# Get OOP Artifact Version
$oopVersion = (Get-ChildItem $stagingCoreToolsCli | Where-Object { $_.Name -match "^Azure\.Functions\.Cli\..*\.(\d+\.\d+\.\d+)$" } | Select-Object -First 1).Name -replace "^Azure\.Functions\.Cli\..*\.(\d+\.\d+\.\d+)$", '$1'

# Get inProc Artifact Version
$inProcVersion = (Get-ChildItem $stagingCoreToolsVisualStudio -Filter "*.zip" | Where-Object { $_.Name -match "^Azure\.Functions\.Cli\.min\.win.*\.(\d+\.\d+\.\d+)\.zip$" } | Select-Object -First 1).Name -replace "^Azure\.Functions\.Cli\.min\.win.*\.(\d+\.\d+\.\d+)\.zip$", '$1'

# Get the current release number from ADO
$releaseNumberFull = $env:RELEASE_RELEASENAME
$releaseNumber = ($releaseNumberFull -replace '\D', '')

# Create the JSON file
$metadata = @{
defaultArtifactVersion = $oopVersion
inProcArtifactVersion = $inProcVersion
consolidatedBuildId = $releaseNumber
}

# Set the output path for the JSON file in the StagingDirectory
$jsonOutputPath = Join-Path $StagingDirectory "metadata.json"

# Convert to JSON and save to file
$metadata | ConvertTo-Json | Set-Content -Path $jsonOutputPath

Write-Host "Metadata file generated successfully at $jsonOutputPath"

# Read and print the JSON content
$jsonContent = Get-Content -Path $jsonOutputPath
Write-Host "Contents of metadata.json:"
Write-Host $jsonContent

This file was deleted.

0 comments on commit c44e837

Please sign in to comment.