0

tank updates: howto always answer yes?

Hi,

When we want to update apps, we test them first by creating a new pipeline configuration then running the "./tank updates" command.

This downloads the latest version of the apps in the "app_store" folder and modify the YAML files in the pipeline configuration's "config/env" folder (each "location" entry is updated to the newest version).

My question is: is there a way to always answer "yes" to the "./tank updates" command? In our case, it is safe to do so because we are testing in another pipeline configuration (there is no risk for the production install).

Any hints on this?

3 comments

  • 1
    Avatar
    KP

    Hi Maxim,

    If you're running the command manually in a terminal, the first time an app or engine is detected as out of date, you'll be prompted to continue with updating the bundle or not. One of the options is 'a' which means 'all'. If you type this, Toolkit will go ahead and update any additional updates it finds automatically.

     

     

    $ ./tank updates
    
    Welcome to the Shotgun Pipeline Toolkit!
    For documentation, see https://toolkit.shotgunsoftware.com
    Starting Toolkit for your current path '/sgtk/software/shotgun/scarlet'
    - The path is not associated with any Shotgun object.
    - Falling back on default project settings.
    - Running as user 'Toolkit'
    - Using configuration 'Primary' and Core v0.16.12
    - Setting the Context to scarlet.
    - Running command updates...
    
    
    ----------------------------------------------------------------------
    Command: Updates
    ----------------------------------------------------------------------
    
    This command will go through your current configuration and check if there are
    any updates available. If there are updates, you will be asked if you want to
    perform an upgrade. If settings has been added to the new version that you are
    installing, you may be prompted to specified values for these.
    
    Running this command with no parameters will check all environments, engines
    and app. This may take a long time. You can also run the updater on a subset
    of your installed apps and engines.
    
    General syntax:
    > tank updates [environment_name] [engine_name] [app_name]
    
    The special keyword ALL can be used to denote all items in a category.
    
    Examples:
    
    Check everything:
    > tank updates
    
    Check the Shot environment:
    > tank updates Shot
    
    Check all maya apps in all environments:
    > tank updates ALL tk-maya
    
    Check all maya apps in the Shot environment:
    > tank updates Shot tk-maya
    
    Make sure the loader app is up to date everywhere:
    > tank updates ALL ALL tk-multi-loader
    
    Make sure the loader app is up to date in maya:
    > tank updates ALL tk-maya tk-multi-loader
    
    
    Continue with full update? [yn]y
    
    
    ======================================================================
    Environment asset...
    ======================================================================
    
    
    ----------------------------------------------------------------------
    Engine tk-shell (Environment asset)
     \-- You are running version v0.4.1 which is the most recent release.
    
    App tk-multi-launchphotoshop (Engine tk-shell, Environment asset)
     \-- You are running version v0.6.5 which is the most recent release.
    
    ...
    ...
    
    ----------------------------------------------------------------------
    Engine tk-mari (Environment asset)
     \-- You are running version v1.0.2 which is the most recent release.
    
    App tk-multi-workfiles (Engine tk-mari, Environment asset)
    /----------------------------------------------------------------------
    | Item:        tk-multi-workfiles v0.6.15
    |
    | Description: Using this app you can change the current work area
    |              and browse work files and publishes.  The app
    |              additionally provides 'Save As' and 'Change Version'
    |              commands for managing work files
    |
    | Change Log:  Fixed a rare issue where opening a file in Maya could
    |              fail.
    \----------------------------------------------------------------------
    Update to the above version? [Yna?]a
    
    ...
    ...
    

     

    If you need to run updates in a script, you can do this as well! Once you import the Toolkit module and instantiate a Toolkit object for your project, you can get a handle to the update command and execute it. Because you're not in an interactive shell, Toolkit will assume all updates should be installed. Documentation about this approach is available here.

    >>> import sgtk
    >>> sgtk
    <module 'tank' from '/sgtk/software/shotgun/scarlet/install/core/python/tank/__init__.pyc'>
    >>> tk = sgtk.sgtk_from_path("/sgtk/projects/scarlet")
    >>> tk
    
    >>> tk.list_commands()
    ['setup_project', 'setup_project_factory', 'core', 'localize', 'share_core', 'attach_to_core', 'validate', 'cache_apps', 'clear_shotgun_menu_cache', 'app_info', 'install_app', 'install_engine', 'updates', 'configurations', 'synchronize_folders', 'unregister_folders', 'clone_configuration', 'copy_apps']
    >>> update = tk.get_command("updates")
    >>> update.parameters
    {'app_filter': {'default': 'ALL', 'type': 'str', 'description': 'Name of app to check.'}, 'engine_filter': {'default': 'ALL', 'type': 'str', 'description': 'Name of engine to check.'}, 'environment_filter': {'default': 'ALL', 'type':
    'str', 'description': 'Name of environment to check.'}}
    >>> params = {}
    >>> update.execute(params)
    INFO
    INFO
    INFO ======================================================================
    INFO Environment asset...
    INFO ======================================================================
    INFO
    INFO
    INFO ----------------------------------------------------------------------
    INFO Engine tk-shell (Environment asset)
    INFO  \-- You are running version v0.4.1 which is the most recent release.
    INFO
    INFO App tk-multi-launchphotoshop (Engine tk-shell, Environment asset)
    INFO  \-- You are running version v0.6.5 which is the most recent release.
    INFO
    INFO App tk-multi-launchmaya (Engine tk-shell, Environment asset)
    INFO  \-- You are running version Undefined which is the most recent release.
    ...
    ...
    

     

  • 0
    Avatar
    Maxim Doucet

    Ok, now that you describe it, it looks obvious :)

    Thanks for your help KP!

  • 0
    Avatar
    Adric Worley

    I'd like to note here that the 'a' option is not very obvious, and I had assumed it was an 'abort' option. It would be helpful if that was explained in the command text.

Please sign in to leave a comment.