Skip to content

Commit

Permalink
Added VerifyAgentOS script
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Apr 3, 2019
1 parent ef37a0c commit 3d0c779
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/python/verify_agent_os.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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 name of the os to verfy against

import sys
import platform
osparameter = sys.argv[1]
print ("Parameter passed by matrix -", osparameter)
osparameter = 'Darwin' if(osparameter.lower() == 'MacOS'.lower()) else osparameter
agentos = platform.system()
if (agentos.lower().startswith(osparameter.lower()[:3])):
print ('Job ran on %s OS' %agentos)
else:
raise Exception('Job ran on the Wrong OS: %s' %agentos)

0 comments on commit 3d0c779

Please sign in to comment.