Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR @azure/arm-attestation] attestation track2 configure #4009

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
104 changes: 45 additions & 59 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,41 +78,20 @@ function Get-PkgProperties
(
[Parameter(Mandatory = $true)]
[string]$PackageName,
[Parameter(Mandatory = $true)]
[string]$ServiceDirectory
)

$pkgDirectoryPath = $null
$serviceDirectoryPath = Join-Path $RepoRoot "sdk" $ServiceDirectory
if (!(Test-Path $serviceDirectoryPath))
{
LogError "Service Directory $ServiceDirectory does not exist"
return $null
}
$AllPkgProps = Get-AllPkgProperties -ServiceDirectory $ServiceDirectory

$directoriesPresent = Get-ChildItem $serviceDirectoryPath -Directory

foreach ($directory in $directoriesPresent)
foreach ($pkgProp in $AllPkgProps)
{
$pkgDirectoryPath = Join-Path $serviceDirectoryPath $directory.Name

if ($GetPackageInfoFromRepoFn -and (Test-Path "Function:$GetPackageInfoFromRepoFn"))
{
$pkgProps = &$GetPackageInfoFromRepoFn -pkgPath $pkgDirectoryPath -serviceDirectory $ServiceDirectory -pkgName $PackageName
}
else
if(($pkgProp.Name -eq $PackageName) -or ($pkgProp.ArtifactName -eq $PackageName))
{
LogError "The function for '$GetPackageInfoFromRepoFn' was not found.`
Make sure it is present in eng/scripts/Language-Settings.ps1 and referenced in eng/common/scripts/common.ps1.`
See https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md#code-structure"
}

if ($pkgProps -ne $null)
{
return $pkgProps
return $pkgProp
}
}
LogWarning "Failed to retrive Properties for $PackageName"

LogError "Failed to retrive Properties for [ $PackageName ]"
return $null
}

Expand All @@ -123,33 +102,22 @@ function Get-AllPkgProperties ([string]$ServiceDirectory = $null)
{
$pkgPropsResult = @()

if ([string]::IsNullOrEmpty($ServiceDirectory))
if (Test-Path "Function:Get-AllPackageInfoFromRepo")
{
$searchDir = Join-Path $RepoRoot "sdk"
foreach ($dir in (Get-ChildItem $searchDir -Directory))
{
$serviceDir = Join-Path $searchDir $dir.Name

if (Test-Path (Join-Path $serviceDir "ci.yml"))
{
$activePkgList = Get-PkgListFromYml -ciYmlPath (Join-Path $serviceDir "ci.yml")
if ($activePkgList -ne $null)
{
$pkgPropsResult = Operate-OnPackages -activePkgList $activePkgList -ServiceDirectory $dir.Name -pkgPropsResult $pkgPropsResult
}
}
}
}
$pkgPropsResult = Get-AllPackageInfoFromRepo -ServiceDirectory $serviceDirectory
}
else
{
$serviceDir = Join-Path $RepoRoot "sdk" $ServiceDirectory
if (Test-Path (Join-Path $serviceDir "ci.yml"))
if ([string]::IsNullOrEmpty($ServiceDirectory))
{
$activePkgList = Get-PkgListFromYml -ciYmlPath (Join-Path $serviceDir "ci.yml")
if ($activePkgList -ne $null)
foreach ($dir in (Get-ChildItem (Join-Path $RepoRoot "sdk") -Directory))
{
$pkgPropsResult = Operate-OnPackages -activePkgList $activePkgList -ServiceDirectory $ServiceDirectory -pkgPropsResult $pkgPropsResult
$pkgPropsResult += Get-PkgPropsForEntireService -serviceDirectoryPath $dir.FullName
}
}
else
{
$pkgPropsResult = Get-PkgPropsForEntireService -serviceDirectoryPath (Join-Path $RepoRoot "sdk" $ServiceDirectory)
}
}

Expand All @@ -164,21 +132,43 @@ function Get-CSVMetadata ([string]$MetadataUri=$MetadataUri)
return $metadataResponse
}

function Operate-OnPackages ($activePkgList, $ServiceDirectory, [Array]$pkgPropsResult)
function Get-PkgPropsForEntireService ($serviceDirectoryPath)
{
foreach ($pkg in $activePkgList)
$projectProps = @() # Properties from very project inthe service
$packageProps = @() # Properties for artifacts specified in ci.yml
$serviceDirectory = (Split-Path -Path $serviceDirectoryPath -Leaf)

if (!$GetPackageInfoFromRepoFn -or !(Test-Path "Function:$GetPackageInfoFromRepoFn"))
{
LogDebug "Operating on $($pkg["name"])"
$pkgProps = Get-PkgProperties -PackageName $pkg["name"] -ServiceDirectory $ServiceDirectory
LogError "The function for '$GetPackageInfoFromRepoFn' was not found.`
Make sure it is present in eng/scripts/Language-Settings.ps1 and referenced in eng/common/scripts/common.ps1.`
See https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md#code-structure"
}

foreach ($directory in (Get-ChildItem $serviceDirectoryPath -Directory))
{
$pkgDirectoryPath = Join-Path $serviceDirectoryPath $directory.Name
$pkgProps = &$GetPackageInfoFromRepoFn $pkgDirectoryPath $serviceDirectory
if ($null -ne $pkgProps)
{
$pkgPropsResult += $pkgProps
$projectProps += $pkgProps
}
}
return $pkgPropsResult

$ciYmlFiles = Get-ChildItem $serviceDirectoryPath -filter "ci.*yml"
foreach($ciYmlFile in $ciYmlFiles)
{
$activeArtifactList = Get-ArtifactListFromYml -ciYmlPath $ciYmlFile.FullName
foreach ($artifact in $activeArtifactList)
{
$packageProps += $projectProps | Where-Object { $_.ArtifactName -eq $artifact["name"] -and $_.Group -eq $artifact["groupId"] }
}
}

return $packageProps
}

function Get-PkgListFromYml ($ciYmlPath)
function Get-ArtifactListFromYml ($ciYmlPath)
{
$ProgressPreference = "SilentlyContinue"
if ((Get-PSRepository | ?{$_.Name -eq "PSGallery"}).Count -eq 0)
Expand All @@ -201,9 +191,5 @@ function Get-PkgListFromYml ($ciYmlPath)
{
$artifactsInCI = $ciYmlObj["extends"]["parameters"]["Artifacts"]
}
if ($artifactsInCI -eq $null)
{
LogError "Failed to retrive package names in ci $ciYmlPath"
}
return $artifactsInCI
}
8 changes: 4 additions & 4 deletions eng/common/scripts/Prepare-Release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Get-ReleaseDay($baseDate)

$ErrorPreference = 'Stop'

$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $serviceDirectory
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory

if (!$packageProperties)
{
Expand All @@ -36,7 +36,7 @@ if (!$packageProperties)
}

Write-Host "Package Name [ $($packageProperties.Name) ]"
Write-Host "Source directory [ $serviceDirectory ]"
Write-Host "Source directory [ $($packageProperties.ServiceDirectory) ]"

if (!$ReleaseDate)
{
Expand Down Expand Up @@ -89,7 +89,7 @@ if ($null -eq $newVersionParsed)

if (Test-Path "Function:SetPackageVersion")
{
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion -ServiceDirectory $serviceDirectory -ReleaseDate $releaseDateString `
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion -ServiceDirectory $packageProperties.ServiceDirectory -ReleaseDate $releaseDateString `
-PackageProperties $packageProperties
}
else
Expand All @@ -105,7 +105,7 @@ else
-packageName $packageProperties.Name `
-version $newVersion `
-plannedDate $releaseDateString `
-packageRepoPath $packageProperties.serviceDirectory `
-packageRepoPath $packageProperties.ServiceDirectory `
-packageType $packageProperties.SDKType `
-packageNewLibrary $packageProperties.IsNewSDK

Expand Down
1 change: 0 additions & 1 deletion eng/common/scripts/Update-ChangeLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ if ($null -eq [AzureEngSemanticVersion]::ParseVersionString($Version))
$PkgProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory
$ChangeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $PkgProperties.ChangeLogPath


if ($ChangeLogEntries.Contains($Version))
{
if ($ChangeLogEntries[$Version].ReleaseStatus -eq $ReleaseStatus)
Expand Down
2 changes: 1 addition & 1 deletion sdk/attestation/arm-attestation/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Microsoft
Copyright (c) 2021 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 4 additions & 5 deletions sdk/attestation/arm-attestation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @azure/arm-attestation

### How to use

#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
#### nodejs - client creation and list operations as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

Expand All @@ -26,11 +26,10 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0"

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { AttestationManagementClient, AttestationManagementModels, AttestationManagementMappers } from "@azure/arm-attestation";
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { AttestationManagementClient } = require("@azure/arm-attestation");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
Expand Down
4 changes: 2 additions & 2 deletions sdk/attestation/arm-attestation/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const config = {
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand All @@ -19,6 +18,7 @@ class AttestationManagementClient extends AttestationManagementClientContext {
// Operation groups
operations: operations.Operations;
attestationProviders: operations.AttestationProviders;
privateEndpointConnections: operations.PrivateEndpointConnections;

/**
* Initializes a new instance of the AttestationManagementClient class.
Expand All @@ -30,6 +30,7 @@ class AttestationManagementClient extends AttestationManagementClientContext {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.attestationProviders = new operations.AttestationProviders(this);
this.privateEndpointConnections = new operations.PrivateEndpointConnections(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -17,6 +17,7 @@ export {
CloudError,
JSONWebKey,
JSONWebKeySet,
PrivateEndpointConnection,
ProxyResource,
Resource,
SystemData,
Expand Down
Loading