forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove OSName variable since its is being set in the verifyagentOS Sc…
…ript (#11100)
- Loading branch information
1 parent
66ee8c3
commit 936685d
Showing
7 changed files
with
43 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Template for all Python Scripts in this repository | ||
parameters: | ||
OSVmImage: $(OSVmImage) | ||
|
||
steps: | ||
- task: PythonScript@0 | ||
displayName: Verify Agent OS | ||
inputs: | ||
scriptSource: inline | ||
script: | | ||
# Script verifies the operating system for the platform on which it is being run | ||
# Used in build pipelines to verify the build agent os | ||
# Variable: The friendly name or image name of the os to verfy against | ||
from __future__ import print_function | ||
import sys | ||
import platform | ||
os_parameter = "${{ parameters.OSVmImage }}".lower() | ||
if os_parameter.startswith('mac') or os_parameter.startswith('darwin'): | ||
os_parameter = 'macOS' | ||
elif os_parameter.startswith('ubuntu') or os_parameter.startswith('linux'): | ||
os_parameter = 'Linux' | ||
elif os_parameter.startswith('vs') or os_parameter.startswith('win'): | ||
os_parameter = 'Windows' | ||
else: | ||
raise Exception('Variable OSVmImage is empty or has an unexpected value') | ||
print("Job requested to run on OS: %s" % (os_parameter)) | ||
agent_os = platform.system() | ||
agent_os = 'macOS' if agent_os == 'Darwin' else agent_os | ||
if (agent_os.lower() == os_parameter.lower()): | ||
print('Job ran on OS: %s' % (agent_os)) | ||
print('##vso[task.setvariable variable=OSName]%s' % (agent_os)) | ||
else: | ||
raise Exception('Job ran on the wrong OS: %s' % (agent_os)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.