Fix poetry not found issue in mise in AI Gateway setup

What does this merge request do and why?

Fix poetry not found issue in mise. Running cd in non-interactive mode doesn't call the required mise shell hooks. This results in poetry command which is managed by mise to fail.

$ make gitlab-ai-gateway-update
--snip--
--------------------------------------------------------------------------------
Performing poetry steps for /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway
--------------------------------------------------------------------------------
# Set Python version for poetry to fix Python upgrades.
cd /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway && egrep '^python ' .tool-versions | awk '{ print $2 }' | xargs -L 1 poetry env use
egrep: warning: egrep is obsolescent; using ggrep -E
xargs: poetry: No such file or directory
make[1]: *** [support/makefiles/Makefile.gitlab-ai-gateway.mk:28: gitlab-ai-gateway-poetry-install] Error 127

How to set up and validate locally

  1. Ensure GitLab AI Gateway is enabled by adding the below configuration in gdk.yml:
    ---
    gitlab_ai_gateway:
      enabled: true
    mise:
      enabled: true
  2. Check out to this merge request's branch.
  3. Run gdk reconfigure to check if regenerating all configuration is successful.
  4. Run the following command to update gitlab-ai-gateway and confirm the error no longer shows.
    $ make gitlab-ai-gateway-update
    --snip--
    --------------------------------------------------------------------------------
    Performing poetry steps for /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway
    --------------------------------------------------------------------------------
    # Set Python version for poetry to fix Python upgrades.
    cd /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway && egrep '^python ' .tool-versions | awk '{ print $2 }' | xargs -L 1 mise exec -- poetry env use
    egrep: warning: egrep is obsolescent; using ggrep -E
    Using virtualenv: /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway/.venv
    cd /Users/tanle/code/gitlab/gdk/gitlab-ai-gateway && mise exec -- poetry install
    Installing dependencies from lock file
    
    No dependencies to install or update
    
    Installing the current project: ai_gateway (0.1.0)

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Tan Le

Merge request reports

Loading