Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ef24dfd
Add GetCredentialName() (#4428)
antkmsft Mar 14, 2023
6f2e39a
Sync eng/common directory with azure-sdk-tools for PR 5702 (#4453)
azure-sdk Mar 15, 2023
9f19a28
Use aka.ms link to Identity troubleshooting (#4449)
antkmsft Mar 15, 2023
acb8e3b
Undocument ChainedCred usage by DefaultAzCred & remove friend and pri…
antkmsft Mar 16, 2023
f8ae5d9
Sync eng/common directory with azure-sdk-tools for PR 5691 (#4450)
azure-sdk Mar 16, 2023
14677e9
fix cspell for readme.ms in libcurl sterss test (#4441)
gearama Mar 16, 2023
83f736d
Simpler identity logging (#4455)
antkmsft Mar 16, 2023
d5e4a5c
3rd Party Libs in Samples (#4408)
ronniegeraghty Mar 16, 2023
ade505d
Update changelog with issue link (#4458)
antkmsft Mar 17, 2023
43632eb
Tests: replace most `EXPECT_TRUE(a OP b)` with `EXPECT_OP(a, b)` (#4457)
antkmsft Mar 17, 2023
a087301
Revert "[check-spelling] Temporarily pin Node 18 to 18.13.0 (#5537)" …
azure-sdk Mar 17, 2023
ba08657
Fix potentially high CPU usage on Windows (#4448)
antkmsft Mar 20, 2023
c457e91
Ensure the comparison is unsigned to unsigned (#4464)
RickWinter Mar 21, 2023
bd98ee0
Sync eng/common directory with azure-sdk-tools for PR 5742 (#4465)
azure-sdk Mar 21, 2023
a91ff63
Update CODEOWNERS (#4461)
RickWinter Mar 22, 2023
2a39a34
Organize applying Identity log prefix (#4459)
antkmsft Mar 22, 2023
e9f900f
Explicitly set PSNativeCommandArgumentPassing to Legacy for git push …
azure-sdk Mar 24, 2023
ef5aec8
Fix unmatched parenthesis in doc (#4482)
Jinming-Hu Mar 25, 2023
42017bf
fix concurrent upload failures (#4484)
Jinming-Hu Mar 27, 2023
97c7630
Sync eng/common directory with azure-sdk-tools for PR 5726 (#4488)
azure-sdk Mar 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
###########

# PRLabel: %Attestation
/sdk/attestation/ @LarryOsterman @gkostal @anilba06 @kroshkina-ms @ahmadmsft @rickwinter @ahsonkhan @antkmsft @vhvb1989 @gearama
/sdk/attestation/ @LarryOsterman @gkostal @anilba06 @ahmadmsft @rickwinter @ahsonkhan @antkmsft @vhvb1989 @gearama

# PRLabel: %KeyVault
/sdk/keyvault/ @vhvb1989 @gearama @antkmsft @rickwinter
/sdk/keyvault/ @gearama @antkmsft @rickwinter @LarryOsterman

# PRLabel: %Storage
/sdk/storage/ @vinjiang @Jinming-Hu @EmmaZhu @antkmsft @vhvb1989 @gearama @LarryOsterman @microzchang
Expand Down
1 change: 0 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"*.a",
"*.lib",
"*.yaml",
"**/libcurl-stress-test/README.md",
".github/CODEOWNERS",
".gitignore",
".vscode/cspell.json",
Expand Down
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,23 @@ If the coverage data has been previously generated (for example, if you manually
### Visual Studio 2019

You can also build the project by simply opening the repo directory in Visual Studio. Visual Studio will detect the `CMake` file and will configure itself to generate, build and run tests.

## Samples

### Third-party dependencies

Third party libraries should only be included in samples when necessary to demonstrate usage of an Azure SDK package; they should not be suggested or endorsed as alternatives to the Azure SDK.

When code samples take dependencies, readers should be able to use the material without significant license burden or research on terms. This goal requires restricting dependencies to certain types of open source or commercial licenses.

Samples may take the following categories of dependencies:

- **Open-source** : Open source offerings that use an [Open Source Initiative (OSI) approved license](https://opensource.org/licenses). Any component whose license isn't OSI-approved is considered a commercial offering. Prefer OSS projects that are members of any of the [OSS foundations that Microsoft is part of](https://opensource.microsoft.com/ecosystem/). Prefer permissive licenses for libraries, like [MIT](https://opensource.org/licenses/MIT) and [Apache 2](https://opensource.org/licenses/Apache-2.0). Copy-left licenses like [GPL](https://opensource.org/licenses/gpl-license) are acceptable for tools, and OSs. [Kubernetes](https://github.com/kubernetes/kubernetes), [Linux](https://github.com/torvalds/linux), and [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) are examples of this license type. Links to open source components should be to where the source is hosted, including any applicable license, such as a GitHub repository (or similar).

- **Commercial**: Commercial offerings that enable readers to learn from our content without unnecessary extra costs. Typically, the offering has some form of a community edition, or a free trial sufficient for its use in content. A commercial license may be a form of dual-license, or tiered license. Links to commercial components should be to the commercial site for the software, even if the source software is hosted publicly on GitHub (or similar).

- **Dual licensed**: Commercial offerings that enable readers to choose either license based on their needs. For example, if the offering has an OSS and commercial license, readers can choose between them. [MySql](https://github.com/mysql/mysql-server) is an example of this license type.

- **Tiered licensed**: Offerings that enable readers to use the license tier that corresponds to their characteristics. For example, tiers may be available for students, hobbyists, or companies with defined revenue thresholds. For offerings with tiered licenses, strive to limit our use in tutorials to the features available in the lowest tier. This policy enables the widest audience for the article. [Docker](https://www.docker.com/), [IdentityServer](https://duendesoftware.com/products/identityserver), [ImageSharp](https://sixlabors.com/products/imagesharp/), and [Visual Studio](https://visualstudio.com) are examples of this license type.

In general, we prefer taking dependencies on licensed components in the order of the listed categories. In cases where the category may not be well known, we'll document the category so that readers understand the choice that they're making by using that dependency.
4 changes: 2 additions & 2 deletions eng/common/pipelines/templates/steps/check-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ steps:
- task: NodeTool@0
condition: and(succeededOrFailed(), ne(variables['Skip.SpellCheck'],'true'))
inputs:
versionSpec: 18.13.0
displayName: Use Node.js 18.13.0
versionSpec: 18.x
displayName: Use Node.js 18.x

- task: PowerShell@2
displayName: Check spelling (cspell)
Expand Down
1 change: 1 addition & 0 deletions eng/common/scripts/Test-SampleMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ begin {
"azure-genomics",
"azure-hdinsight",
"azure-hdinsight-rserver",
"azure-health-insights",
"azure-hpc-cache",
"azure-immersive-reader",
"azure-information-protection",
Expand Down
101 changes: 101 additions & 0 deletions eng/common/scripts/TypeSpec-Project-Generate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/TypeSpec-Project-Scripts.md

[CmdletBinding()]
param (
[Parameter(Position=0)]
[ValidateNotNullOrEmpty()]
[string] $ProjectDirectory,
[Parameter(Position=1)]
[string] $typespecAdditionalOptions ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
)

$ErrorActionPreference = "Stop"
. $PSScriptRoot/Helpers/PSModule-Helpers.ps1
. $PSScriptRoot/common.ps1
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module

function NpmInstallForProject([string]$workingDirectory) {
Push-Location $workingDirectory
try {
$currentDur = Resolve-Path "."
Write-Host "Generating from $currentDur"

if (Test-Path "package.json") {
Remove-Item -Path "package.json" -Force
}

if (Test-Path ".npmrc") {
Remove-Item -Path ".npmrc" -Force
}

if (Test-Path "node_modules") {
Remove-Item -Path "node_modules" -Force -Recurse
}

if (Test-Path "package-lock.json") {
Remove-Item -Path "package-lock.json" -Force
}

#default to root/eng/emitter-package.json but you can override by writing
#Get-${Language}-EmitterPackageJsonPath in your Language-Settings.ps1
$replacementPackageJson = "$PSScriptRoot/../../emitter-package.json"
if (Test-Path "Function:$GetEmitterPackageJsonPathFn") {
$replacementPackageJson = &$GetEmitterPackageJsonPathFn
}

Write-Host("Copying package.json from $replacementPackageJson")
Copy-Item -Path $replacementPackageJson -Destination "package.json" -Force
npm install --no-lock-file
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
finally {
Pop-Location
}
}

$resolvedProjectDirectory = Resolve-Path $ProjectDirectory
$emitterName = &$GetEmitterNameFn
$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/tsp-location.yaml"

Write-Host "Reading configuration from $typespecConfigurationFile"
$configuration = Get-Content -Path $typespecConfigurationFile -Raw | ConvertFrom-Yaml

$specSubDirectory = $configuration["directory"]
$innerFolder = Split-Path $specSubDirectory -Leaf

$tempFolder = "$ProjectDirectory/TempTypeSpecFiles"
$npmWorkingDir = Resolve-Path $tempFolder/$innerFolder
$mainTypeSpecFile = If (Test-Path "$npmWorkingDir/client.*") { Resolve-Path "$npmWorkingDir/client.*" } Else { Resolve-Path "$npmWorkingDir/main.*"}

try {
Push-Location $npmWorkingDir
NpmInstallForProject $npmWorkingDir

if ($LASTEXITCODE) { exit $LASTEXITCODE }

if (Test-Path "Function:$GetEmitterAdditionalOptionsFn") {
$emitterAdditionalOptions = &$GetEmitterAdditionalOptionsFn $resolvedProjectDirectory
if ($emitterAdditionalOptions.Length -gt 0) {
$emitterAdditionalOptions = " $emitterAdditionalOptions"
}
}
$typespecCompileCommand = "npx tsp compile $mainTypeSpecFile --emit $emitterName$emitterAdditionalOptions"
if ($typespecAdditionalOptions) {
$options = $typespecAdditionalOptions.Split(";");
foreach ($option in $options) {
$typespecCompileCommand += " --option $emitterName.$option"
}
}
Write-Host($typespecCompileCommand)
Invoke-Expression $typespecCompileCommand

if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
finally {
Pop-Location
}

$shouldCleanUp = $configuration["cleanup"] ?? $true
if ($shouldCleanUp) {
Remove-Item $tempFolder -Recurse -Force
}
127 changes: 127 additions & 0 deletions eng/common/scripts/TypeSpec-Project-Sync.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/TypeSpec-Project-Scripts.md

[CmdletBinding()]
param (
[Parameter(Position=0)]
[ValidateNotNullOrEmpty()]
[string] $ProjectDirectory
)

$ErrorActionPreference = "Stop"
. $PSScriptRoot/Helpers/PSModule-Helpers.ps1
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module
$sparseCheckoutFile = ".git/info/sparse-checkout"

function AddSparseCheckoutPath([string]$subDirectory) {
if (!(Test-Path $sparseCheckoutFile) -or !((Get-Content $sparseCheckoutFile).Contains($subDirectory))) {
Write-Output $subDirectory >> .git/info/sparse-checkout
}
}

function CopySpecToProjectIfNeeded([string]$specCloneRoot, [string]$mainSpecDir, [string]$dest, [string[]]$specAdditionalSubDirectories) {
$source = "$specCloneRoot/$mainSpecDir"
Copy-Item -Path $source -Destination $dest -Recurse -Force
Write-Host "Copying spec from $source to $dest"

foreach ($additionalDir in $specAdditionalSubDirectories) {
$source = "$specCloneRoot/$additionalDir"
Write-Host "Copying spec from $source to $dest"
Copy-Item -Path $source -Destination $dest -Recurse -Force
}
}

function UpdateSparseCheckoutFile([string]$mainSpecDir, [string[]]$specAdditionalSubDirectories) {
AddSparseCheckoutPath $mainSpecDir
foreach ($subDir in $specAdditionalSubDirectories) {
AddSparseCheckoutPath $subDir
}
}

function GetGitRemoteValue([string]$repo) {
Push-Location $ProjectDirectory
$result = ""
try {
$gitRemotes = (git remote -v)
foreach ($remote in $gitRemotes) {
if ($remote.StartsWith("origin")) {
if ($remote -match 'https://github.com/\S+') {
$result = "https://github.com/$repo.git"
break
} elseif ($remote -match "git@github.com:\S+"){
$result = "git@github.com:$repo.git"
break
} else {
throw "Unknown git remote format found: $remote"
}
}
}
}
finally {
Pop-Location
}

return $result
}

function InitializeSparseGitClone([string]$repo) {
git clone --no-checkout --filter=tree:0 $repo .
if ($LASTEXITCODE) { exit $LASTEXITCODE }
git sparse-checkout init
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Remove-Item $sparseCheckoutFile -Force
}

function GetSpecCloneDir([string]$projectName) {
Push-Location $ProjectDirectory
try {
$root = git rev-parse --show-toplevel
}
finally {
Pop-Location
}

$sparseSpecCloneDir = "$root/../sparse-spec/$projectName"
New-Item $sparseSpecCloneDir -Type Directory -Force | Out-Null
$createResult = Resolve-Path $sparseSpecCloneDir
return $createResult
}

$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/tsp-location.yaml"
Write-Host "Reading configuration from $typespecConfigurationFile"
$configuration = Get-Content -Path $typespecConfigurationFile -Raw | ConvertFrom-Yaml

$pieces = $typespecConfigurationFile.Path.Replace("\","/").Split("/")
$projectName = $pieces[$pieces.Count - 2]

$specSubDirectory = $configuration["directory"]

if ( $configuration["repo"] -and $configuration["commit"]) {
$specCloneDir = GetSpecCloneDir $projectName
$gitRemoteValue = GetGitRemoteValue $configuration["repo"]

Write-Host "Setting up sparse clone for $projectName at $specCloneDir"

Push-Location $specCloneDir.Path
try {
if (!(Test-Path ".git")) {
InitializeSparseGitClone $gitRemoteValue
UpdateSparseCheckoutFile $specSubDirectory $configuration["additionalDirectories"]
}
git checkout $configuration["commit"]
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
finally {
Pop-Location
}
} elseif ( $configuration["spec-root-dir"] ) {
$specCloneDir = $configuration["spec-root-dir"]
}


$tempTypeSpecDir = "$ProjectDirectory/TempTypeSpecFiles"
New-Item $tempTypeSpecDir -Type Directory -Force | Out-Null
CopySpecToProjectIfNeeded `
-specCloneRoot $specCloneDir `
-mainSpecDir $specSubDirectory `
-dest $tempTypeSpecDir `
-specAdditionalSubDirectories $configuration["additionalDirectories"]
4 changes: 4 additions & 0 deletions eng/common/scripts/git-branch-push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ param(
[boolean] $AmendCommit = $false
)

# Explicit set arg parsing to Legacy mode because some of the git calls in this script depend on empty strings being empty and not passing a "" git.
# more info https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3#psnativecommandargumentpassing
$PSNativeCommandArgumentPassing = "Legacy"

# This is necessary because of the git command output writing to stderr.
# Without explicitly setting the ErrorActionPreference to continue the script
# would fail the first time git wrote command output.
Expand Down
2 changes: 2 additions & 0 deletions eng/common/scripts/stress-testing/deploy-stress-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ param(
# Renders chart templates locally without deployment
[Parameter(Mandatory=$False)][switch]$Template,

[Parameter(Mandatory=$False)][switch]$RetryFailedTests,

# Matrix generation parameters
[Parameter(Mandatory=$False)][string]$MatrixFileName,
[Parameter(Mandatory=$False)][string]$MatrixSelection,
Expand Down
Loading