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

Use arm template parameters as sole input for live test environment variables #2247

Merged
merged 1 commit into from
Nov 12, 2021

Conversation

benbp
Copy link
Member

@benbp benbp commented Nov 10, 2021

For sovereign cloud testing, many cloud-specific arm template parameters and environment variables get passed in from an external keyvault source. This makes them hard to manage and track. This PR moves some common live testing values into source control for easier management. Some values are service-specific (like formRecognizerLocation), so perhaps we could consider a service-specific location for them, but I don't want the config layering to get too complex either.

Related:
Azure/azure-sdk-for-java#25301
Azure/azure-sdk-for-net#25250
Azure/azure-sdk-for-python#21693

@benbp benbp added the Central-EngSys This issue is owned by the Engineering System team. label Nov 10, 2021
@benbp benbp self-assigned this Nov 10, 2021
@benbp benbp requested a review from ckairen November 10, 2021 19:32
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@@ -84,11 +84,13 @@ if (!$PSBoundParameters.ContainsKey('ErrorAction')) {
$ErrorActionPreference = 'Stop'
}

function Log($Message) {
function Log($Message)
{
Copy link
Member

@heaths heaths Nov 10, 2021

Choose a reason for hiding this comment

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

Could we leave as-is? I've long practiced JavaScript-like bracketing because for pipelines like when using ForEach-Object, putting a { on the same line means you don't need to use a continuation character. For people who don't know PowerShell as well, this can be very confusing why a script does things differently in different places. Using a consistent bracketing style eliminates that confusion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was trying to buy goodwill from @weshaggard because he likes net-style function syntax and usually makes these comments on my powershell PRs 😄 I don't have a strong opinion either way so I'll let you two duke it out.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think your point about script accessibility for powershell newcomers is a good one.

Copy link
Member

Choose a reason for hiding this comment

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

Basically, to highlight the difference:

filter Foo ([scriptblock] $Script) # filter is like function but defaults to `process {}` instead of `end {}` of pipelines
{
  &$Script $_
}

1..10 | Foo {
  Write-Host "Got $_"
}

# Or

1..10 | Foo `
{
  Write-Host "Got $_"
}

Notice the backtick above. Without it, errors abound. So for the sake of consistency and readability, I've gone with JavaScript-style bracing.

Copy link
Member

Choose a reason for hiding this comment

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

Still, this isn't blocking so I'll unblock, but I think it's worth changing back, @weshaggard. You have previously mentioned about newcomers to the script and why a lot of my PowerShelly shortcuts weren't the best for approachability. I think the same is true here.

Copy link
Member

Choose a reason for hiding this comment

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

There is definitely some brace issues in PS. I still like having the braces on there own lines for larger blocks, except for when you cannot like the pipelines. I'm also pushing us to not depend on the pipeline syntax in most of our scripts as well as I think they cause more issues then they help with, they are nice at the command line but less so in script files.

As for consistency there is not a great way to be fully consistent but I do want to get some coding style configurations setup for our PS scripts at some point, I believe we have an issue on the backlog for that.

Copy link
Member

Choose a reason for hiding this comment

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

The pipeline syntax has been there since the beginning. If there are scenarios you'd like me to help with, please point them out. It's been my daily driver - and I'm live in a terminal - since pre-1.0 days, when it was just "Monad". Never had a problem if functions are written correctly.

Copy link
Member

Choose a reason for hiding this comment

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

Pipelines main goal are for doing things on a single line from the command shell which is great, however when using them in a scripting context they can complicate things. One example is the returning of null, single or list of items when you are filtering. That causes a lot of redundant code and errors when trying to work with lists in different contexts from scripting. That is why I recommend we use the ".Where(...)" on an array over using a pipeline with Where-Object. That ensures that you are always working with a list and you don't end up switching data types in different contexts.

For what it's worth I to have been using PS since it was called monad as my daily shell. At any rate probably not worth having this debate on this particular PR.

@ghost
Copy link

ghost commented Nov 12, 2021

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@benbp benbp merged commit 55b4b3f into Azure:main Nov 12, 2021
@benbp benbp deleted the benbp/live-test-vars branch November 12, 2021 18:40
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants