Created
July 7, 2019 16:14
-
-
Save willianantunes/78eb26943c634973d9920ba23c546270 to your computer and use it in GitHub Desktop.
Sample logic about how to set variable on Azure DevOps
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
import os | |
import sys | |
branch_name: str = sys.argv[1] | |
print(f"Received argument: {branch_name}") | |
env_image_type = "ENV_IMAGE_TYPE" | |
def set_value(key, value): | |
print(f"Set key {key} as {value}") | |
print(f"##vso[task.setvariable variable={key};]{value}") | |
if "develop" in branch_name: | |
set_value(env_image_type, "dev") | |
elif "release" in branch_name: | |
set_value(env_image_type, "qa") | |
elif "master" in branch_name: | |
set_value(env_image_type, "prd") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment