Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
14 changes: 10 additions & 4 deletions eng/common/pipelines/templates/steps/create-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
GHTeamReviewersVariable: ''
# Multiple labels seperated by comma, e.g. "bug, APIView"
PRLabels: ''
SkipCheckingForChanges: false

steps:

Expand All @@ -35,15 +36,19 @@ steps:
echo "##vso[task.setvariable variable=HasChanges]$false"
echo "No changes so skipping code push"
}
displayName: Check for changes
condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false))
workingDirectory: ${{ parameters.WorkingDirectory }}
ignoreLASTEXITCODE: true

- pwsh: |
# Remove the repo owner from the front of the repo name if it exists there
$repoName = "${{ parameters.RepoName }}" -replace "^${{ parameters.RepoOwner }}/", ""
echo "##vso[task.setvariable variable=RepoNameWithoutOwner]$repoName"
echo "RepoName = $repName"

displayName: Check for changes
echo "RepoName = $repoName"
displayName: Remove Repo Owner from Repo Name
condition: succeeded()
workingDirectory: ${{ parameters.WorkingDirectory }}
ignoreLASTEXITCODE: true

- task: PowerShell@2
displayName: Push changes
Expand All @@ -57,6 +62,7 @@ steps:
-CommitMsg "${{ parameters.CommitMsg }}"
-GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.PROwner }}/$(RepoNameWithoutOwner).git"
-PushArgs "${{ parameters.PushArgs }}"
-SkipCommit $${{parameters.SkipCheckingForChanges}}

- task: PowerShell@2
displayName: Create pull request
Expand Down
53 changes: 53 additions & 0 deletions eng/common/scripts/Add-Issue-Comment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[string]$RepoOwner,

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

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

[Parameter(Mandatory = $false)]
[string]$CommentPrefix,

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

[Parameter(Mandatory = $false)]
[string]$CommentPostFix,

[Parameter(Mandatory = $true)]
[string]$AuthToken
)

. "${PSScriptRoot}\logging.ps1"

$headers = @{
Authorization = "bearer $AuthToken"
}

$apiUrl = "https://api.github.com/repos/$RepoOwner/$RepoName/issues/$IssueNumber/comments"

$commentPrefixValue = [System.Environment]::GetEnvironmentVariable($CommentPrefix)
$commentValue = [System.Environment]::GetEnvironmentVariable($Comment)
$commentPostFixValue = [System.Environment]::GetEnvironmentVariable($CommentPostFix)

if (!$commentPrefixValue) { $commentPrefixValue = $CommentPrefix }
if (!$commentValue) { $commentValue = $Comment }
if (!$commentPostFixValue) { $commentPostFixValue = $CommentPostFix }

$PRComment = "$commentPrefixValue $commentValue $commentPostFixValue"

$data = @{
body = $PRComment
}

try {
$resp = Invoke-RestMethod -Method POST -Headers $headers -Uri $apiUrl -Body ($data | ConvertTo-Json)
}
catch {
LogError "Invoke-RestMethod [ $apiUrl ] failed with exception:`n$_"
exit 1
}
56 changes: 56 additions & 0 deletions eng/common/scripts/Queue-Pipeline.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[string]$Organization,

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

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

[Parameter(Mandatory = $true)]
[int]$DefinitionId,

[Parameter(Mandatory = $false)]
[string]$VsoQueuedPipelines,

[Parameter(Mandatory = $true)]
[string]$AuthToken
)

. "${PSScriptRoot}\logging.ps1"

$headers = @{
Authorization = "Basic $AuthToken"
}

$apiUrl = "https://dev.azure.com/$Organization/$Project/_apis/build/builds?api-version=6.0"

$body = @{
sourceBranch = $SourceBranch
definition = @{ id = $DefinitionId }
}

Write-Verbose ($body | ConvertTo-Json)

try {
$resp = Invoke-RestMethod -Method POST -Headers $headers $apiUrl -Body ($body | ConvertTo-Json) -ContentType application/json
}
catch {
LogError "Invoke-RestMethod [ $apiUrl ] failed with exception:`n$_"
exit 1
}

LogDebug "Pipeline [ $($resp.definition.name) ] queued at [ $($resp._links.web.href) ]"

if ($VsoQueuedPipelines) {
$enVarValue = [System.Environment]::GetEnvironmentVariable($VsoQueuedPipelines)
$QueuedPipelineLinks = if ($enVarValue) {
"$enVarValue<br>[$($resp.definition.name)]($($resp._links.web.href))"
}else {
"[$($resp.definition.name)]($($resp._links.web.href))"
}
$QueuedPipelineLinks
Write-Host "##vso[task.setvariable variable=$VsoQueuedPipelines]$QueuedPipelineLinks"
}
22 changes: 15 additions & 7 deletions eng/common/scripts/git-branch-push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ param(
[string] $GitUrl,

[Parameter(Mandatory = $false)]
[string] $PushArgs = ""
[string] $PushArgs = "",

[Parameter(Mandatory = $false)]
[boolean] $SkipCommit = $false
)

# This is necessay because of the janky git command output writing to stderr.
Expand Down Expand Up @@ -57,12 +60,17 @@ if ($LASTEXITCODE -ne 0)
exit $LASTEXITCODE
}

Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -am `"$($CommitMsg)`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit -am "$($CommitMsg)"
if ($LASTEXITCODE -ne 0)
{
Write-Error "Unable to add files and create commit LASTEXITCODE=$($LASTEXITCODE), see command output above."
exit $LASTEXITCODE
if (!$SkipCommit) {
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -am `"$($CommitMsg)`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit -am "$($CommitMsg)"
if ($LASTEXITCODE -ne 0)
{
Write-Error "Unable to add files and create commit LASTEXITCODE=$($LASTEXITCODE), see command output above."
exit $LASTEXITCODE
}
}
else {
Write-Host "Skipped applying commit"
}

# The number of retries can be increased if necessary. In theory, the number of retries
Expand Down
1 change: 0 additions & 1 deletion eng/common/scripts/modules/ChangeLog-Operations.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Common Changelog Operations

$RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+.*(?<version>\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s(?<releaseStatus>\(Unreleased\)|\(\d{4}-\d{2}-\d{2}\)))?)"

# Returns a Collection of changeLogEntry object containing changelog info for all version present in the gived CHANGELOG
Expand Down
1 change: 1 addition & 0 deletions eng/common/scripts/modules/Package-Properties.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Files has been retired
# Helper functions for retireving useful information from azure-sdk-for-* repo
# Example Use : Import-Module .\eng\common\scripts\modules
class PackageProps
Expand Down
2 changes: 2 additions & 0 deletions sdk/communication/communication-administration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

## 1.0.0-beta.2 (2020-10-06)

Added support for phone number administration.
Expand Down
4 changes: 2 additions & 2 deletions sdk/communication/communication-administration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/communication-administration",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "SDK for Azure Communication service which facilitates user token administration.",
"sdk-type": "client",
"main": "dist/index.js",
Expand Down Expand Up @@ -60,7 +60,7 @@
"sideEffects": false,
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/communication-common": "1.0.0-beta.2",
"@azure/communication-common": "1.0.0-beta.3",
"@azure/core-auth": "^1.1.3",
"@azure/core-http": "^1.1.6",
"@azure/core-paging": "^1.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import * as coreHttp from "@azure/core-http";

const packageName = "azure-communication-administration-identity";
const packageVersion = "1.0.0-beta.2";
const packageVersion = "1.0.0-beta.3";

export class GeneratedCommunicationIdentityClientContext extends coreHttp.ServiceClient {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package-name: azure-communication-administration-identity
title: CommunicationIdentityConfigurationClient
override-client-name: GeneratedCommunicationIdentityClient
description: Communication identity configuration client
package-version: 1.0.0-beta.2
package-version: 1.0.0-beta.3
generate-metadata: false
license-header: MICROSOFT_MIT_NO_VERSION
output-folder: ../src/communicationIdentity/generated
Expand Down
2 changes: 2 additions & 0 deletions sdk/communication/communication-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

## 1.0.0-beta.2 (2020-10-06)

Updated `@azure/communication-chat` version
Expand Down
10 changes: 5 additions & 5 deletions sdk/communication/communication-chat/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@azure/communication-chat",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Azure client library for Azure Communication Chat services",
"sdk-type": "client",
"main": "dist/index.js",
"module": "dist-esm/src/index.js",
"types": "types/communication-chat.d.ts",
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:autorest": "autorest ./swagger/README.md --typescript --version=3.0.6267 --v3 --package-version=1.0.0-beta.2 && rushx format",
"build:autorest": "autorest ./swagger/README.md --typescript --version=3.0.6267 --v3 --package-version=1.0.0-beta.3 && rushx format",
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:samples": "cd samples && tsc -p .",
Expand All @@ -21,7 +21,7 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace -t 300000 dist-esm/test/*.spec.js dist-esm/test/node/*.spec.js",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json tsconfig.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json tsconfig.json api-extractor.json src test --ext .ts -f html -o communication-chat-lintReport.html || exit 0",
"pack": "npm pack 2>&1",
Expand Down Expand Up @@ -65,7 +65,7 @@
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/communication-common": "1.0.0-beta.2",
"@azure/communication-common": "1.0.0-beta.3",
"@azure/communication-signaling": "1.0.0-beta.1",
"@azure/core-auth": "^1.1.3",
"@azure/core-http": "^1.1.6",
Expand All @@ -77,7 +77,7 @@
"@azure/core-paging": "^1.1.1"
},
"devDependencies": {
"@azure/communication-administration": "1.0.0-beta.2",
"@azure/communication-administration": "1.0.0-beta.3",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/test-utils-recorder": "^1.0.0",
"@microsoft/api-extractor": "7.7.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http";
import { ChatApiClientOptionalParams } from "./models";

const packageName = "azure-communication-chat";
const packageVersion = "1.0.0-beta.2";
const packageVersion = "1.0.0-beta.3";

export class ChatApiClientContext extends coreHttp.ServiceClient {
endpoint: string;
Expand Down
2 changes: 2 additions & 0 deletions sdk/communication/communication-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

## 1.0.0-beta.2 (2020-10-06)

Updated `@azure/communication-common` version
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/communication-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/communication-common",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Common package for Azure Communication services.",
"sdk-type": "client",
"main": "dist/index.js",
Expand Down
2 changes: 2 additions & 0 deletions sdk/communication/communication-sms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

## 1.0.0-beta.2 (2020-10-06)

Updated `@azure/communication-sms` version
Expand Down
6 changes: 3 additions & 3 deletions sdk/communication/communication-sms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/communication-sms",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "SDK for Azure Communication SMS service which facilitates the sending of SMS messages.",
"sdk-type": "client",
"main": "dist/index.js",
Expand All @@ -12,7 +12,7 @@
"types": "types/communication-sms.d.ts",
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:autorest": "autorest ./swagger/README.md --typescript --v3 --package-version=1.0.0-beta.2 && rushx format",
"build:autorest": "autorest ./swagger/README.md --typescript --v3 --package-version=1.0.0-beta.3 && rushx format",
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:samples": "cd samples && tsc -p .",
Expand Down Expand Up @@ -65,7 +65,7 @@
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/communication-common": "1.0.0-beta.2",
"@azure/communication-common": "1.0.0-beta.3",
"@azure/core-auth": "^1.1.3",
"@azure/core-http": "^1.1.6",
"@azure/core-tracing": "1.0.0-preview.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import * as coreHttp from "@azure/core-http";

const packageName = "azure-communication-sms";
const packageVersion = "1.0.0-beta.2";
const packageVersion = "1.0.0-beta.3";

export class SmsApiClientContext extends coreHttp.ServiceClient {
endpoint: string;
Expand Down
1 change: 1 addition & 0 deletions sdk/cosmosdb/cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.9.3 (Unreleased)

- BUGFIX: Fixes bulk operations with top level partitionKey values that are undefined or null.

## 3.9.2 (2020-09-16)

Expand Down
5 changes: 3 additions & 2 deletions sdk/cosmosdb/cosmos/src/utils/batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export function hasResource(
export function getPartitionKeyToHash(operation: Operation, partitionProperty: string) {
const toHashKey = hasResource(operation)
? (operation.resourceBody as any)[partitionProperty]
: operation.partitionKey.replace(/[\[\]\"\']/g, "");
: (operation.partitionKey && operation.partitionKey.replace(/[\[\]\"\']/g, "")) ||
operation.partitionKey;
// We check for empty object since replace will stringify the value
// The second check avoids cases where the partitionKey value is actually the string '{}'
if (toHashKey === "{}" && operation.partitionKey === "[{}]") {
Expand All @@ -151,7 +152,7 @@ export function decorateOperation(
operation.resourceBody.id = uuid();
}
}
if (operation.partitionKey) {
if ("partitionKey" in operation) {
const extracted = extractPartitionKey(operation, { paths: ["/partitionKey"] });
return { ...operation, partitionKey: JSON.stringify(extracted) } as Operation;
} else if (
Expand Down
Loading