Ayon nuke publish shotgrid login error

I passed this info to IT.

We will define next steps for this needed feature, mean while thank you again Matteo,

1 Like

Do we get any benefit on creating the SG session with the user login/password as opposed to how it is in OP with the sudo_as_login arg and passing a script name and API key? With the OP approach there’s no need for the user to type yet another password (the SG password is already being requested on logging in to SG or RV) and it doesn’t care if it’s 2FA or the legacy login, you just need the SG user name when creating the SG session (which in our case is the same as $USER on the machine so they don’t even need to type anything). In fact in OP I completely removed the login dialog as it wasn’t used at all

I guess it is matter of security and client requirements/audits which in our case matters way too much, but I got a question for you @fabiaserra, do you have the “Enforce 2FA for autodesk ID” enabled for your shotgrid site?, if it enabled, can you login as you described?, it sounds interesting to me, so just want to see if that would be an option.

Yeah we have 2FA enabled in our SG and we are also TPN compliant. This is just for the SG integration from OP/Ayon so our users are already working within our secure environment, I think on this case the only problem would be someone from inside knowing how to use the SG API to write stuff to SG as someone else but I’m not really that concerned about that, I think I rather have them work this way than having to change their login method.

Alternatively, I think we should add support for SSO so they don’t need to login in the SG addon, but we are probably constrained by this one SSO / Active Directory integration - #12 by emiliano

On the collect_shotgrid_session plugin we are basically creating it like this (the only modification from the OP code being that we pass the proxy to the session)

        proxy = os.environ.get("HTTPS_PROXY", "").lstrip("https://")
        session = shotgun_api3.Shotgun(
            base_url=shotgrid_url,
            script_name=shotgrid_script_name,
            http_proxy=proxy,
            api_key=shotgrid_script_key,
            sudo_as_login=login,
        )

Thank you @fabiaserra, this looks promising, we will give it a go and feedback.

Once again thank you @fabiaserra
I tried and it seems to work so far I do not see issues even the a question, will I get the script name or artist name in the version and publish file, got artist name, then it worked nicely.

Thank you @matteo
We just need to define what we need to customize for our publishes and versions.

All good so far.

@Brno & @fabiaserra Glad you guys both got it to work within your requirements, whilst the IP whitelisting that we use is great and still accomplishes TPN regs I would too prefer to just use Autodesk SSO.

For everything else please feel free guys to add to issues on the GitHub, it’s currently a lot of me :sweat_smile:

@Brno I would love to know if you manage to get playable media into ShotGrid from AYON render/image publishes. Currently I can get a new version made in SG but not with playable media, seems like FFmpeg runs but nothing uploads

Will do @matteo
This may answer the question. if you use “Linking Local Files”.
Help | Linking to local files | Autodesk

So the ffmpeg runs and creates and mp4 and a jpg under the (ayon) publish path but it is not uploaded automatically, in our case we are using the Linking Local Files so We will implement it as required, or maybe I am missing something :), always a possibility but the docs make sense of what is going on.

Yeah so the errors I’ve been getting seem to suggest it’s related to link local, we don’t have that setup on our site though which is strange.

I’ll try and find some time to work out what’s going on, ideally I would want to upload media to get thumbnails and web playback

yep!, we will be doing something similar but for now It is just another TODO in our list of things.

Just checking, so I tried turning Link Local back on and ran a test publish, this time the publisher completes and I see a publish entity in ShotGrid linked to the Version.
That publish entity has a linked path, though when I click it it’s of course asking for a browser integration, the only one of which seems to be having to run ShotGrid Desktop…

Do you guys have a workaround for that? Would love to not have to install SG Desktop inc. toolkit and all that crap

Hi @matteo
yeah We got the same result, there is a linked path under “path” field and got the same message about the browser integration.
I have not checked how to “handle” it but for sure we will need to do something about it.

1 Like

@matteo we have had playable media working in OP with the SG plugin for a while (I’m still on the process of setting up Ayon so I can start testing the addon). Make sure that the shotgridreview tag exists in your instance and that this part on the integrate_shotgrid_version plugin is executed:

            local_path = get_publish_repre_path(
                instance, representation, False
            )

            if representation["ext"] in ["mov", "avi"]:
                self.log.info(
                    "Upload review: {} for version shotgrid {}".format(
                        local_path, sg_version.get("id")
                    )
                )
                self.sg_session.upload(
                    "Version",
                    sg_version.get("id"),
                    local_path,
                    field_name="sg_uploaded_movie",
                )

                data_to_update["sg_path_to_movie"] = local_path

SG then does an internal automatic transcoding on the uploaded video (unless you have it disabled DIY Transcoding - how to disable automatic transcoding - ShotGrid - Community @ ShotGrid or set the required fields manually) but that should be what then creates an automatic thumbnail and allows you to play the video from the web portal

Hey @fabiaserra

First… THANK YOU, this is the first place I’ve seen any reference of needing to tag the extract review versions as shotgridreview.
But… I got a very odd error.

Okay, so to be clear first, I have already managed to perform a successful publish of a test plate asset without the shotgridreview tag added. It made a version in SG along with a published file and worked just fine, of course it didn’t upload the movie though.

All I changed in this variable is adding that tag but this is the error on the “ShotGrid Version” integrate stage:

INFO: Create Shotgrid version: {'id': 8498, 'project': {'id': 155, 'name': 'LibraryTest', 'type': 'Project'}, 'entity': {'id': 1445, 'name': 'TestAsset', 'type': 'Asset'}, 'code': 'LIBTST_LibraryTest_TestAsset_Concept_v008', 'sg_task': {'id': 6295, 'name': 'Concept', 'type': 'Task'}, 'type': 'Version'}
INFO: Upload review: O:\Projects\LibraryTest\TestAsset\publish\plate\plateMain\v008\LIBTST_TestAsset_plateMain_v008_h264.mov for version shotgrid 8498
Traceback (most recent call last):
  File "C:\Users\MatteoVeglia\AppData\Local\Ynput\AYON\dependency_packages\ayon_2310271602_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "C:\Users\MatteoVeglia\AppData\Local\Ynput\AYON\addons\shotgrid_0.2.7\ayon_shotgrid\plugins\publish\integrate_shotgrid_version.py", line 63, in process
    self.sg_session.upload(
AttributeError: 'IntegrateShotgridVersion' object has no attribute 'sg_session'

I don’t care to share the full paths as this is all totally test data on a test sandbox.

Strange error though, it suggests that the code never created a connection to SG but I can confirm that a version was made from this publish so I’m at a loss.

The error is just saying that self.sg_session is not a defined attribute on the class instance. I’d say this is likely a bug or typo in the code.

Yes. It seems that here it should be sg_session not self.sg_session

Exactly as @BigRoy pointed out yeah, it’s a bug on the code. I have encountered a few other bugs while testing the sync SG project to Ayon so I will be doing a PR soon but I’m battling with some other errors now

I have now created a PR with the fix you raised @matteo and the other errors I was getting Pass custom project code field to other functions that use it by fabiaserra · Pull Request #57 · ynput/ayon-shotgrid · GitHub

Thanks you @BigRoy and @fabiaserra! This is the power of open source, remind me to buy you guys a beer at the AYON summit

another PR that brings the login authentication back to using the API key and some other features that I added into the OP shotgrid addon (I have some more but probably too specific to our workflow) Use SG API key for creating session and remove login functionality by fabiaserra · Pull Request #58 · ynput/ayon-shotgrid · GitHub

1 Like