Skip to content

Commit

Permalink
Merge pull request #2 from koen-mertens/radiology-insights-GA
Browse files Browse the repository at this point in the history
Radiology insights ga
  • Loading branch information
koen-mertens authored Apr 19, 2024
2 parents 38a9659 + f0a3ab2 commit 8fc344b
Show file tree
Hide file tree
Showing 262 changed files with 3,154 additions and 3,928 deletions.
5 changes: 2 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
/sdk/eventhub/ @annatisch @kashifkhan @swathipil @l0lawrence

# ServiceLabel: %Storage
# ServiceOwners: @jalauzon-msft @vincenttran-msft

# PRLabel: %Storage
/sdk/storage/ @annatisch @jalauzon-msft @vincenttran-msft @weirongw23-msft

Expand Down Expand Up @@ -873,9 +875,6 @@
# ServiceLabel: %Service Attention %SQL - Replication & Failover
#/<NotInRepo>/ @azureSQLGitHub

# ServiceLabel: %Service Attention %Storage
#/<NotInRepo>/ @xgithubtriage

# ServiceLabel: %Service Attention %Storsimple
#/<NotInRepo>/ @anoobbacker @ganzee @manuaery @patelkunal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
-RepoFullName $(Build.Repository.Name)
-APIViewUri $(ApiChangeDetectRequestUrl)
-ArtifactName ${{ parameters.ArtifactName }}
-DevopsProject $(System.TeamProject)
pwsh: true
displayName: Detect API changes
condition: and(succeededOrFailed(), eq(variables['Build.Reason'],'PullRequest'))
18 changes: 12 additions & 6 deletions eng/common/pipelines/templates/steps/policheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ parameters:
ExclusionDataBaseFileName: ''
TargetDirectory: ''
PublishAnalysisLogs: false
PoliCheckBlobSAS: "$(azuresdk-policheck-blob-SAS)"
ExclusionFilePath: "$(Build.SourcesDirectory)/eng/guardian-tools/policheck/PolicheckExclusions.xml"

steps:
- pwsh: |
azcopy copy "https://azuresdkartifacts.blob.core.windows.net/policheck/${{ parameters.ExclusionDataBaseFileName }}.mdb?${{ parameters.PoliCheckBlobSAS }}" `
"$(Build.BinariesDirectory)"
displayName: 'Download PoliCheck Exclusion Database'
- task: AzurePowerShell@5
displayName: 'Download Policheck Exclusion Database'
inputs:
azureSubscription: 'Azure SDK Artifacts'
ScriptType: 'InlineScript'
azurePowerShellVersion: LatestVersion
pwsh: true
Inline: |
azcopy copy "https://azuresdkartifacts.blob.core.windows.net/policheck/${{ parameters.ExclusionDataBaseFileName }}.mdb" "$(Build.BinariesDirectory)"
env:
AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED'

- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2
displayName: 'Run PoliCheck'
Expand All @@ -33,4 +39,4 @@ steps:

- ${{ if eq(parameters.PublishAnalysisLogs, 'true') }}:
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
displayName: 'Publish Security Analysis Logs'
displayName: 'Publish Security Analysis Logs'
2 changes: 2 additions & 0 deletions eng/common/scripts/Create-APIReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
try
{
$Response = Invoke-WebRequest -Method 'POST' -Uri $uri -Body $multipartContent -Headers $headers
Write-Host "API review: $($Response.Content)"
$StatusCode = $Response.StatusCode
}
catch
Expand Down Expand Up @@ -114,6 +115,7 @@ function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $review
try
{
$Response = Invoke-WebRequest -Method 'GET' -Uri $uri -Headers $headers
Write-Host "API review: $($Response.Content)"
$StatusCode = $Response.StatusCode
}
catch
Expand Down
5 changes: 4 additions & 1 deletion eng/common/scripts/Detect-Api-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Param (
[string] $APIViewUri,
[string] $RepoFullName = "",
[string] $ArtifactName = "packages",
[string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/")
[string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/"),
[string] $DevopsProject = "internal"
)

. (Join-Path $PSScriptRoot common.ps1)
Expand All @@ -37,6 +38,7 @@ function Submit-Request($filePath, $packageName)
$query.Add('pullRequestNumber', $PullRequestNumber)
$query.Add('packageName', $packageName)
$query.Add('language', $LanguageShort)
$query.Add('project', $DevopsProject)
$reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName
if (Test-Path $reviewFileFullName)
{
Expand Down Expand Up @@ -87,6 +89,7 @@ function Log-Input-Params()
Write-Host "Language: $($Language)"
Write-Host "Commit SHA: $($CommitSha)"
Write-Host "Repo Name: $($RepoFullName)"
Write-Host "Project: $($DevopsProject)"
}

Log-Input-Params
Expand Down
7 changes: 6 additions & 1 deletion eng/common/scripts/Update-DevOps-Release-WorkItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ Write-Host "Updated or created a release work item for a package release with th
Write-Host " Lanuage: $($workItem.fields['Custom.Language'])"
Write-Host " Version: $($workItem.fields['Custom.PackageVersionMajorMinor'])"
Write-Host " Package: $($workItem.fields['Custom.Package'])"
Write-Host " AssignedTo: $($workItem.fields['System.AssignedTo']["uniqueName"])"
if ($workItem.fields['System.AssignedTo']) {
Write-Host " AssignedTo: $($workItem.fields['System.AssignedTo']["uniqueName"])"
}
else {
Write-Host " AssignedTo: unassigned"
}
Write-Host " PackageDisplayName: $($workItem.fields['Custom.PackageDisplayName'])"
Write-Host " ServiceName: $($workItem.fields['Custom.ServiceName'])"
Write-Host " PackageType: $($workItem.fields['Custom.PackageType'])"
Expand Down
9 changes: 9 additions & 0 deletions eng/pipelines/templates/stages/archetype-python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ stages:
echo "Uploaded sdist to devops feed"
displayName: 'Publish package to feed: ${{parameters.DevFeedName}}'
- template: /eng/common/pipelines/templates/steps/create-apireview.yml
parameters:
ArtifactPath: $(Pipeline.Workspace)/${{parameters.ArtifactName}}
Artifacts: ${{parameters.Artifacts}}
ConfigFileDir: $(Pipeline.Workspace)/${{parameters.ArtifactName}}/PackageInfo
MarkPackageAsShipped: true
ArtifactName: ${{parameters.ArtifactName}}
PackageName: ${{artifact.name}}

- ${{if ne(artifact.skipPublishDocs, 'true')}}:
- deployment: PublishGitHubIODocs
displayName: Publish Docs to GitHubIO Blob Storage
Expand Down
1 change: 1 addition & 0 deletions eng/tox/install_depend_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"six": "1.12.0",
"cryptography": "3.3.2",
"msal": "1.23.0",
"azure-storage-file-datalake": "12.2.0",
}

MAXIMUM_VERSION_GENERIC_OVERRIDES = {}
Expand Down
2 changes: 1 addition & 1 deletion scripts/auto_release/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def check_file_with_packaging_tool(self):
print_check(f"pip install {self.get_whl_package} --force-reinstall")
module = importlib.import_module(self.whole_package_name.replace("-", "."))
title = ""
for item in getattr(module, "__all__"):
for item in getattr(module, "__all__", []):
if item.endswith("Client"):
title = item
break
Expand Down
56 changes: 46 additions & 10 deletions scripts/release_helper/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import re
import json
import logging
import time
import urllib.parse
Expand All @@ -11,19 +12,19 @@
from github.Repository import Repository

from utils import IssuePackage, REQUEST_REPO, AUTO_ASSIGN_LABEL, AUTO_PARSE_LABEL, get_origin_link_and_tag,\
MULTI_LINK_LABEL, INCONSISTENT_TAG
MULTI_LINK_LABEL, INCONSISTENT_TAG, TYPESPEC_LABEL

_LOG = logging.getLogger(__name__)

# assignee dict which will be assigned to handle issues
_LANGUAGE_OWNER = {'msyyc'}

# 'github assignee': 'token'
_BOT_NAME = 'azure-sdk'
_ASSIGNEE_TOKEN = os.getenv('AZURESDK_BOT_TOKEN')

_SWAGGER_URL = 'https://github.com/Azure/azure-rest-api-specs/blob/main/specification'
_SWAGGER_PULL = 'https://github.com/Azure/azure-rest-api-specs/pull'
_HINTS = ["FirstGA", "FirstBeta", "HoldOn", "OnTime", "ForCLI", TYPESPEC_LABEL]


class IssueProcess:
Expand Down Expand Up @@ -67,6 +68,17 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.is_open = True
self.issue_title = issue_package.issue.title.split(": ", 1)[-1]
self.spec_repo = Path(os.getenv('SPEC_REPO'))
self.typespec_json = Path(os.getenv('TYPESPEC_JSON'))
self.language_name = "common"

@property
def for_typespec(self) -> bool:
with open(str(self.typespec_json), "r") as file:
data = json.load(file)
return self.package_name in data.get(self.language_name, [])

def has_label(self, label: str) -> bool:
return label in self.issue_package.labels_name

@property
def created_date_format(self) -> str:
Expand Down Expand Up @@ -199,8 +211,16 @@ def check_tag_consistency(self) -> None:
f'it is still `{self.default_readme_tag}`, please modify the readme.md or your '
f'**Readme Tag** above ')

def get_package_name(self) -> None:
issue_body_list = self.get_issue_body()
for line in issue_body_list:
if line.strip('\r\n ').startswith('package-name:'):
self.package_name = line.split(':')[-1].strip('\r\n ')
break

def auto_parse(self) -> None:
if AUTO_PARSE_LABEL in self.issue_package.labels_name:
if self.has_label(AUTO_ASSIGN_LABEL):
self.get_package_name()
return

self.add_label(AUTO_PARSE_LABEL)
Expand All @@ -221,8 +241,9 @@ def auto_parse(self) -> None:
self.edit_issue_body()

def add_label(self, label: str) -> None:
self.issue_package.issue.add_to_labels(label)
self.issue_package.labels_name.add(label)
if not self.has_label(label):
self.issue_package.issue.add_to_labels(label)
self.issue_package.labels_name.add(label)

def update_assignee(self, assignee_to_del: str, assignee_to_add: str) -> None:
if assignee_to_del:
Expand All @@ -245,7 +266,7 @@ def auto_assign_policy(self) -> str:
return assignees[random_idx]

def auto_assign(self) -> None:
if AUTO_ASSIGN_LABEL in self.issue_package.labels_name:
if self.has_label(AUTO_PARSE_LABEL):
self.update_issue_instance()
return
# assign averagely
Expand Down Expand Up @@ -283,12 +304,12 @@ def new_comment_policy(self):
self.bot_advice.append('new comment.')

def multi_link_policy(self):
if MULTI_LINK_LABEL in self.issue_package.labels_name:
if self.has_label(MULTI_LINK_LABEL):
self.bot_advice.append('multi readme link!')

def inconsistent_tag_policy(self):
if INCONSISTENT_TAG in self.issue_package.labels_name:
self.bot_advice.append('Attention to inconsistent tag')
if self.has_label(INCONSISTENT_TAG):
self.bot_advice.append('Attention to inconsistent tag.')

def remind_logic(self) -> bool:
return abs(self.date_from_target) <= 2
Expand All @@ -298,14 +319,25 @@ def print_date_from_target_date(self) -> str:

def date_remind_policy(self):
if self.remind_logic():
self.bot_advice.append('close to release date. ')
self.bot_advice.append('close to release date.')

def hint_policy(self):
for item in _HINTS:
if self.has_label(item):
self.bot_advice.append(f"{item}.")

def typespec_policy(self):
if self.for_typespec:
self.add_label(TYPESPEC_LABEL)

def auto_bot_advice(self):
self.new_issue_policy()
self.typespec_policy()
self.new_comment_policy()
self.multi_link_policy()
self.date_remind_policy()
self.inconsistent_tag_policy()
self.hint_policy()

def get_target_date(self):
body = self.get_issue_body()
Expand Down Expand Up @@ -351,6 +383,10 @@ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
for assignee in self.assignee_candidates:
self.request_repo_dict[assignee] = Github(assignee_token).get_repo(REQUEST_REPO)

@staticmethod
def for_test():
return bool(os.getenv("TEST_ISSUE_NUMBER"))

def log_error(self, message: str) -> None:
_LOG.error(message)

Expand Down
7 changes: 5 additions & 2 deletions scripts/release_helper/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@


class IssueProcessGo(IssueProcess):
pass
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.language_name = 'go'


class Go(Common):
def __init__(self, issues, language_owner, sdk_assignees):
super(Go, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_go_status.md'
if not self.for_test():
self.file_out_name = 'release_go_status.md'


def go_process(issues: List[Any]) -> Go:
Expand Down
11 changes: 7 additions & 4 deletions scripts/release_helper/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@

# assignee dict which will be assigned to handle issues
_JAVA_OWNER = {'azure-sdk'}
_JS_ASSIGNEE = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao'}
_JAVA_ASSIGNEE = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao', 'v-hongli1'}


class IssueProcessJava(IssueProcess):
pass
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.language_name = 'java'


class Java(Common):
def __init__(self, issues, language_owner, sdk_assignees):
super(Java, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_java_status.md'
if not self.for_test():
self.file_out_name = 'release_java_status.md'


def java_process(issues: List[Any]) -> Java:
return Java(issues, _JAVA_OWNER, _JS_ASSIGNEE)
return Java(issues, _JAVA_OWNER, _JAVA_ASSIGNEE)
8 changes: 6 additions & 2 deletions scripts/release_helper/js.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@


class IssueProcessJs(IssueProcess):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.language_name = 'js'

def auto_assign_policy(self) -> str:
weeks = datetime.datetime.now().isocalendar()[1]
assignees = list(self.assignee_candidates)
Expand All @@ -19,9 +23,9 @@ def auto_assign_policy(self) -> str:
class Js(Common):
def __init__(self, issues, language_owner, sdk_assignees):
super(Js, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_js_status.md'
self.issue_process_function = IssueProcessJs

if not self.for_test():
self.file_out_name = 'release_js_status.md'

def js_process(issues: List[Any]) -> Js:
return Js(issues, _JS_OWNER, _JS_ASSIGNEE)
6 changes: 5 additions & 1 deletion scripts/release_helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def collect_open_issues() -> List[IssuePackage]:
hub = Github(os.getenv('AZURESDK_BOT_TOKEN'))
request_repo = hub.get_repo(REQUEST_REPO)
mgmt_label = request_repo.get_label('ManagementPlane')
open_issues = request_repo.get_issues(state='open', labels=[mgmt_label])
issue_number = os.getenv("TEST_ISSUE_NUMBER")
if issue_number:
open_issues = [request_repo.get_issue(int(issue_number))]
else:
open_issues = request_repo.get_issues(state='open', labels=[mgmt_label])
rest_repo = hub.get_repo(REST_REPO)
issues = [IssuePackage(issue, rest_repo) for issue in open_issues]
_LOG.info(f'collect {len(issues)} open issues')
Expand Down
Loading

0 comments on commit 8fc344b

Please sign in to comment.