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

Chore: Use 'AYON_USE_STAGING' #124

Merged
merged 8 commits into from
Feb 12, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class CollectDeadlineJobEnvVars(pyblish.api.ContextPlugin):

# Not sure how this is usefull for farm, scared to remove
"PYBLISHPLUGINPATH",

# NOTE still required by GlobalPreLoadJob.py, but might not be set by
# ayon-core anymore
"AYON_DEFAULT_SETTINGS_VARIANT",
]

def process(self, context):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def _submit_deadline_post_job(
"--targets", "deadline",
"--targets", "farm",
]
# TODO remove when AYON launcher respects environment variable
# 'AYON_DEFAULT_SETTINGS_VARIANT'
# TODO remove settings variant handling when not needed anymore
# which should be when package.py defines 'core>1.1.1' .
settings_variant = os.environ["AYON_DEFAULT_SETTINGS_VARIANT"]
if settings_variant == "staging":
args.append("--use-staging")
Expand Down
18 changes: 12 additions & 6 deletions client/ayon_deadline/repository/custom/plugins/GlobalJobPreLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
FileUtils,
DirectoryUtils,
)
__version__ = "1.2.0"
__version__ = "1.2.1"
VERSION_REGEX = re.compile(
r"(?P<major>0|[1-9]\d*)"
r"\.(?P<minor>0|[1-9]\d*)"
Expand Down Expand Up @@ -558,8 +558,12 @@ def inject_ayon_environment(deadlinePlugin):
]

# staging requires passing argument
# TODO could be switched to env var after https://github.com/ynput/ayon-launcher/issues/123
settings_variant = job.GetJobEnvironmentKeyValue("AYON_DEFAULT_SETTINGS_VARIANT") # noqa
# TODO could be removed when PR in ayon-core starts to fill
# 'AYON_USE_STAGING' (https://github.com/ynput/ayon-core/pull/1130)
# - add requirement for "core>=1.1.1" to 'package.py' when removed
settings_variant = job.GetJobEnvironmentKeyValue(
"AYON_DEFAULT_SETTINGS_VARIANT"
)
if settings_variant == "staging":
args.append("--use-staging")

Expand All @@ -583,9 +587,11 @@ def inject_ayon_environment(deadlinePlugin):
"AYON_BUNDLE_NAME": ayon_bundle_name,
}

automatic_tests = job.GetJobEnvironmentKeyValue("AYON_IN_TESTS")
if automatic_tests:
environment["AYON_IN_TESTS"] = automatic_tests
for key in ("AYON_USE_STAGING", "AYON_IN_TESTS"):
value = job.GetJobEnvironmentKeyValue(key)
if value:
environment[key] = value

for env, val in environment.items():
# Add the env var for the Render Plugin that is about to render
deadlinePlugin.SetEnvironmentVariable(env, val)
Expand Down
Loading