Skip to content

Support using git addon version in makefile manage#114

Open
MustafaJafar wants to merge 4 commits intodevelopfrom
support-using-git-addon-version-in-makefile-manage
Open

Support using git addon version in makefile manage#114
MustafaJafar wants to merge 4 commits intodevelopfrom
support-using-git-addon-version-in-makefile-manage

Conversation

@MustafaJafar
Copy link
Copy Markdown
Member

@MustafaJafar MustafaJafar commented Aug 11, 2025

Changelog Description

An alternative to #94

This PR adds support for AYON_USE_GIT_SUFFIX_FOR_ADDONS env var for initializing the processor services with addon version with the +git suffix. This is the same env var used on the ayon-docker server.

AYON_SERVER_URL=http://localhost:5000/
AYON_API_KEY=veryinsecureapikey
AYON_USE_GIT_SUFFIX_FOR_ADDONS=True

Additional details

when working with kitsu addon development, it's possible to develop from within the ayon-docker directly or from a separate directory.

Although, developing from within the ayon-docker/addons directly, if someone does, running servies live from source code won't work becasue the service is not initialized to work with the +git vesion. so, it fails to fetch settings.

I think such a solution can be adapted in other addons with services.

Testing notes:

  1. when setting AYON_USE_GIT_SUFFIX_FOR_ADDONS to true it should set the addon version to +git.
  2. when no setting it or setting it to false, the actual addon version should be used.

@MustafaJafar MustafaJafar self-assigned this Aug 11, 2025
@MustafaJafar MustafaJafar added the type: enhancement Improvement of existing functionality or minor addition label Aug 11, 2025
Comment on lines +73 to +78
if ($env:AYON_USE_GIT_SUFFIX_FOR_ADDONS -eq "True") {
$AYON_ADDON_VERSION = Invoke-Expression -Command "python -c ""print('$($AYON_ADDON_VERSION)'.split('-')[0].split('+')[0] + '+git')"""
}
# Running Kitsu processor service script live requires the following environment variables to be set.
$env:AYON_ADDON_NAME = $AYON_ADDON_NAME
$env:AYON_ADDON_VERSION = $AYON_ADDON_VERSION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why to re-run the code and re-assign the variable

Suggested change
if ($env:AYON_USE_GIT_SUFFIX_FOR_ADDONS -eq "True") {
$AYON_ADDON_VERSION = Invoke-Expression -Command "python -c ""print('$($AYON_ADDON_VERSION)'.split('-')[0].split('+')[0] + '+git')"""
}
# Running Kitsu processor service script live requires the following environment variables to be set.
$env:AYON_ADDON_NAME = $AYON_ADDON_NAME
$env:AYON_ADDON_VERSION = $AYON_ADDON_VERSION
$addon_version = $AYON_ADDON_VERSION
if ($env:AYON_USE_GIT_SUFFIX_FOR_ADDONS -eq "True") {
$addon_version = "($AYON_ADDON_VERSION)+git"
}
# Running Kitsu processor service script live requires the following environment variables to be set.
$env:AYON_ADDON_NAME = $AYON_ADDON_NAME
$env:AYON_ADDON_VERSION = $addon_version

BTW we usually set AYON_ADDON_NAME and AYON_ADDON_VERSION ahead so you can define different version from .env file (which I think is what you should do to add the +git TBH).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. in ftrack it is set before any command is started, so e.g. RunDocker can also use custom version from .env file if needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this one works.

$addon_version = "($AYON_ADDON_VERSION)+git"

because addon version according to the this line

$AYON_ADDON_VERSION = Invoke-Expression -Command "python -c ""import os;import sys;content={};f=open(r'$($script_dir)/../../package.py');exec(f.read(),content);f.close();print(content['version'])"""

will be 1.2.6+dev and AYON expects the name to be 1.2.6+git not 1.2.6+dev+git

image

Copy link
Copy Markdown
Member Author

@MustafaJafar MustafaJafar Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. in ftrack it is set before any command is started, so e.g. RunDocker can also use custom version from .env file if needed.

I see.
https://github.com/ynput/ayon-ftrack/blob/276e4c957c0920329355f794c92903b5b8a80aa7/service_tools/manage.ps1#L89-L91

Which function I should move this piece of code to?

  • main
  • RunDocker
  • RunService

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I see, both main.sh and manage.ps1 are already reading .env file, so set AYON_ADDON_VERSION env only if is not set yet after load-env (include .env).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Improvement of existing functionality or minor addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants