Skip to content

Conversation

@chidozieononiwu
Copy link
Member

@chidozieononiwu chidozieononiwu commented Sep 24, 2020

Get creator of Tools PR
Add the Tools PR creator alias as a reviewer and assignee.
Move logic for adding members (labels, reviewers and assignees) into the eng\common\scripts\Submit-PullRequest.ps1 sctipt
Update logging.ps1

-GitHubUsers "$(${{ parameters.GHReviewersVariable }})"
-GitHubTeams "$(${{ parameters.GHTeamReviewersVariable }})"
-PRNumber "$(Submitted.PullRequest.Number)"
-UserReviewers "$(${{ parameters.GHReviewersVariable }})"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-UserReviewers "$(${{ parameters.GHReviewersVariable }})"
-UserReviewers "$env:${{ parameters.GHReviewersVariable }}"

-GitHubTeams "$(${{ parameters.GHTeamReviewersVariable }})"
-PRNumber "$(Submitted.PullRequest.Number)"
-UserReviewers "$(${{ parameters.GHReviewersVariable }})"
-TeamReviewers "$(${{ parameters.GHTeamReviewersVariable }})"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-TeamReviewers "$(${{ parameters.GHTeamReviewersVariable }})"
-TeamReviewers "$env:${{ parameters.GHTeamReviewersVariable }}"

-PRNumber "$(Submitted.PullRequest.Number)"
-UserReviewers "$(${{ parameters.GHReviewersVariable }})"
-TeamReviewers "$(${{ parameters.GHTeamReviewersVariable }})"
-Assignees "$(${{ parameters.GHAssignessVariable }})" No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-Assignees "$(${{ parameters.GHAssignessVariable }})"
-Assignees "$env:${{ parameters.GHAssignessVariable }}"

$baseURI = "https://api.github.com/repos"
function SplitMembers ($membersString)
{
return @($membersString.Split(",") | % { $_.Trim() } | ? { return $_ })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding a check for empty like:

if (!$memberString) { return $null }

That prevents any cases were we have an empty/null value and turn it into and empty array.

function AddReviewers ($prNumber, $users, $teams) {
if (!$users -and !$teams)
{
LogWarning "No users or teams provided for addition, exiting."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be a warning, as we don't always pass in reviewers to this script. We should simply make it a no-op.

function AddLabelsAndOrAssignees ($prNumber, $labels, $assignees) {
if (!$labels -and !$assignees)
{
LogWarning "No labels or assignees provided for addition, exiting."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suggest we log a warning here. Just make it a noop or a standard log message.

[string]$Assignees
)

. "${PSScriptRoot}\logging.ps1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not import common.ps1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far we only need the logging logic here, so I did not feel the need to import common.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'm fine with this for now but at some point we might want to consider always importing common.ps1 just to avoid any differences for scripts we use in our eng-system. The only time we should avoid it is if we want to limit our dependencies in a script to use it in other contexts.

if ($resp.Count -gt 0) {
Write-Host -f green "Pull request already exists $($resp[0].html_url)"
try {
LogDebug "Pull request already exists $($resp[0].html_url)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this a normal log message otherwise it will not show up in Devops logging unless you set System.Debug = true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Body ($data | ConvertTo-Json)

$resp | Write-Verbose
LogDebug "Pull request created https://github.com/$RepoOwner/$RepoName/pull/$($resp.number)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep this a normal log

if ($isDevOpsRun)
{
Write-Host "##vso[task.LogIssue type=debug;]$args"
Write-Host "[debug]$args"
Copy link
Member

@weshaggard weshaggard Sep 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh on my other comments I assume this was still debug logging. I think I would keep this as is so we have support for that debug logging. Perhaps we need a LogInfo or something similar that will just do a Write-Host.

@weshaggard weshaggard changed the title Assign sync p rs Assign sync prs Sep 25, 2020
@weshaggard
Copy link
Member

@chidozieononiwu I assume this is outdated based on your other PR work and there is still some outstanding feedback so I'm not going to review this further until you tell me it is ready for review again.

@chidozieononiwu chidozieononiwu added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Oct 13, 2020
@chidozieononiwu
Copy link
Member Author

Replaced by #1091

sima-zhu pushed a commit to sima-zhu/azure-sdk-tools that referenced this pull request Dec 3, 2020
…een preview 3 and 4. (Azure#1043)

`az_allocator_context` was added after preview3 shipped so renaming it to `az_span_allocator_context` isn't breaking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team. EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants