Skip to content

Initial scripts to create and tear down test resources#9029

Merged
heaths merged 6 commits intoAzure:masterfrom
heaths:test-resources
Dec 13, 2019
Merged

Initial scripts to create and tear down test resources#9029
heaths merged 6 commits intoAzure:masterfrom
heaths:test-resources

Conversation

@heaths
Copy link
Copy Markdown
Member

@heaths heaths commented Dec 7, 2019

These are the initial scripts to set up and tear down test resources based on a convention we decided. These were testing on Windows and linux using bash, cmd, and pwsh.

@heaths heaths added Client This issue is related to a non-management package EngSys This issue is impacting the engineering system. labels Dec 7, 2019
@heaths heaths requested review from danieljurek and pakrym December 7, 2019 03:43
@pakrym
Copy link
Copy Markdown
Contributor

pakrym commented Dec 7, 2019

Can we enable dot-sourcing the script so environment variables are set automatically in current powershell terminal?

. .\eng\New-TestResource.ps1 ...

@heaths
Copy link
Copy Markdown
Member Author

heaths commented Dec 8, 2019

Can we enable dot-sourcing the script so environment variables are set automatically in current powershell terminal?

. .\eng\New-TestResource.ps1 ...

Because setting the environment variables in the current session won't persist, though I suppose that doesn't preclude doing both. But the idea we discussed was to save these to a file anyway. Let's sync back up on that and determine if we're ready for that given the other work going on with credentials. If not, I agree doing both would be great.

That said, I still wouldn't allow for it to be sourced. I can just as easily set environment variables in teh script. Sourcing it makes all variables and functions global, and you have to declare the body as a function itself, nor could you support bootstrapping PowerShell from cmd or bash (or other shells) like we plan to (next iteration). In general, you shouldn't source anything other than $profile. If you want to allow people to import into the global namespace (or any other declared namespace), use modules, which can be unloaded.

@heaths heaths requested a review from pakrym December 11, 2019 01:04
@pakrym
Copy link
Copy Markdown
Contributor

pakrym commented Dec 11, 2019

I like it. Very clean!

@heaths heaths merged commit f21f587 into Azure:master Dec 13, 2019
@heaths heaths deleted the test-resources branch December 13, 2019 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client This issue is related to a non-management package EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants