Skip to content

Commit

Permalink
Update with the latest changes in JS PR
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek authored and azure-sdk committed Jun 29, 2021
1 parent 91390fb commit ce98121
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 129 deletions.
20 changes: 0 additions & 20 deletions eng/common/pipelines/templates/steps/start-devops-build.yml

This file was deleted.

7 changes: 5 additions & 2 deletions eng/common/scripts/Invoke-DevOpsAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ function Start-DevOpsBuild {
$DefinitionId,
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$Base64EncodedAuthToken
$Base64EncodedAuthToken,
[Parameter(Mandatory = $false)]
[string]$BuildParametersJson
)

$uri = "$DevOpsAPIBaseURI" -F $Organization, $Project , "build" , "builds", ""

$parameters = @{
sourceBranch = $SourceBranch
definition = @{ id = $DefinitionId }
parameters = $BuildParametersJson
}

return Invoke-RestMethod `
Expand Down Expand Up @@ -157,4 +160,4 @@ function Add-RetentionLease {
-MaximumRetryCount 3 `
-ContentType "application/json"

}
}
1 change: 1 addition & 0 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class PackageProps
{
[string]$Name
[string]$Version
[string]$DevVersion
[string]$DirectoryPath
[string]$ServiceDirectory
[string]$ReadMePath
Expand Down
15 changes: 12 additions & 3 deletions eng/common/scripts/Queue-Pipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ param(
[string]$VsoQueuedPipelines,

[Parameter(Mandatory = $true)]
[string]$Base64EncodedAuthToken
[string]$Base64EncodedAuthToken,

[Parameter(Mandatory = $false)]
[string]$BuildParametersJson
)

. (Join-Path $PSScriptRoot common.ps1)
Expand Down Expand Up @@ -46,7 +49,13 @@ if ($CancelPreviousBuilds)
}

try {
$resp = Start-DevOpsBuild -SourceBranch $SourceBranch -DefinitionId $DefinitionId -Base64EncodedAuthToken $Base64EncodedAuthToken
$resp = Start-DevOpsBuild `
-Organization $Organization `
-Project $Project `
-SourceBranch $SourceBranch `
-DefinitionId $DefinitionId `
-Base64EncodedAuthToken $Base64EncodedAuthToken `
-BuildParametersJson $BuildParametersJson
}
catch {
LogError "Start-DevOpsBuild failed with exception:`n$_"
Expand All @@ -64,4 +73,4 @@ if ($VsoQueuedPipelines) {
}
$QueuedPipelineLinks
Write-Host "##vso[task.setvariable variable=$VsoQueuedPipelines]$QueuedPipelineLinks"
}
}
8 changes: 2 additions & 6 deletions eng/common/scripts/Save-Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,11 @@ Param (

function SetOutput($outputPath, $incomingPackageSpec) {
$outputObject = $incomingPackageSpec

if ($addDevVersion) {
# Use the "Version" property which was provided by the incoming package spec
# as the DevVersion. This may be overridden later.
Add-Member `
-InputObject $outputObject `
-NotePropertyName DevVersion `
-NotePropertyValue $incomingPackageSpec.Version `
-Force
$outputObject.DevVersion = $incomingPackageSpec.Version

# If there is an exsiting package info json file read that and set the
# Version property from that JSON file.
Expand Down
55 changes: 0 additions & 55 deletions eng/common/scripts/Start-DevOpsBuild.ps1

This file was deleted.

4 changes: 3 additions & 1 deletion eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) {
# If the package is of a dev version there may be language-specific needs to
# specify the appropriate version. For example, in the case of JS, the dev
# version is always 'dev' when interacting with NPM.
$packageInfo = &$GetDocsMsLanguageSpecificPackageInfo $packageInfo
if ($GetDocsMsLanguageSpecificPackageInfo -and (Test-Path "Function:$GetDocsMsLanguageSpecificPackageInfo")) {
$packageInfo = &$GetDocsMsLanguageSpecificPackageInfo $packageInfo
}
}

$packageMetadataArray = (Get-CSVMetadata).Where({ $_.Package -eq $packageInfo.Name })
Expand Down
43 changes: 1 addition & 42 deletions eng/common/scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,53 +35,12 @@ if (!(Get-Variable -Name "LanguageDisplayName" -ValueOnly -ErrorAction "Ignore")
$LanguageDisplayName = $Language
}

# Create a function with the given FunctionName which may or may not be
# implemented in a language specific way (e.g. in Language-settings.ps1). There
# are two major advantages to this approach:
# 1. With a default implementation, language-specific implementations are
# optional
# 2. No more need to write logic in functions to check whether a given function
# exists.
# Warning: Once a default implementation is created and used, changes to the
# default implementation might break code which depends on the implementation.
# Sample usage:
# DefaultImplementation `
# -FunctionName "Get-${Language}-LanguageSpecificMetadata" `
# -DefaultImplementation { param($input) $input }
#
# Language specific implementation:
# Get-javascript-LanguageSpecificMetadata { param($input) $input.Version = 'dev'; $input }
#
# If a language specific implementation is not provided this returns the $input
# object unaltered, but in the case of JS, this returns a $input object with the
# Version property set to 'dev'. There is no need to write implementation for
# any other languages.
function DefaultImplementation() {
param(
[Parameter(Mandatory = $true)]
[string]$FunctionName,

[Parameter(Mandatory = $true)]
[scriptblock]$DefaultImplementation
)

if (Test-Path "Function:$FunctionName") {
return Get-Item "Function:$FunctionName"
} else {
return $DefaultImplementation
}
}

# Functions with default implementations
$GetDocsMsLanguageSpecificPackageInfo = DefaultImplementation `
-FunctionName "Get-${Language}-DocsMsVersionForPackage" `
-DefaultImplementation { param($packageInfo) $packageInfo }

# Transformed Functions
$GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo"
$GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile"
$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs"
$UpdateDocsMsPackagesFn = "Update-${Language}-DocsMsPackages"
$GetDocsMsMetadataForPackageFn = "Get-${Language}-DocsMsMetadataForPackage"
$GetDocsMsLanguageSpecificPackageInfo = "Get-${Language}-DocsMsLanguageSpecificPackageInfo"
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"
$FindArtifactForApiReviewFn = "Find-${Language}-Artifacts-For-Apireview"

0 comments on commit ce98121

Please sign in to comment.