Skip to content

fix: revise docker image dependencies

A. Stadler requested to merge tzfx1/cli:update-docker-builds into main
  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

Description

This MR does the following:

  • Revises the project Dockerfile to only include dependencies that are required to run glab functions.
    • git (for all of the git interactions)
    • nano (the default editor in glab for writing MR bodies and other large text things)
    • openssh (required for cloning repositories)
  • Rewrites the entrypoint.sh (now docker-entrypoint.sh) script to remove unnecessary github/docker logins and simplify start logic.
    • Borrows from nodejs' docker-entrypoint, passes glab arguments (and the glab command) directly to the glab executable
    • Allows calling other commands (as one would in a ci pipeline) to work without having to manually override entrypoint.
  • Updates the underlying commands for make rt and make rtdebug to work correctly with the latest version of goreleaser.
    • At some point it looks like the syntax these are using got deprecated/removed.
    • In order to test these changes and build a docker image with make rt I needed to update the underlying commands.
  • Renames snapshot.name_template to snapshot.version_template in .goreleaser.yaml-- The build (and in the existing CI builds) seemed very angry this deprecation, so I figured I'd update it while I'm in that file. Happy to revert if too far out of scope.

Related Issues

Resolves #7646 (closed)

How has this been tested?

  1. go, make, goreleaser installed.
  2. A local docker image built using make rt.
  3. Access-token generated and added to config.yml
  4. An alias added locally to use the built docker container as an ad-hoc command-- see issue #7646 (closed) for example.
  5. Manual testing of all the glab commands I could find to ensure that no missing dependencies were encountered.
    • glab repo clone / glab mr create of specific importance to test ssh and nano dependencies.
    • git api calls in general to ensure curl removal didn't affect those.

Potential issue: Open in Browser

Calls with --web to open something in a browser don't quite work as expected in docker. Without the BROWSER environment variable/config set, the default appears to be to use xgd-open, which attempts to dig for a default browser.

To keep the alpine container small, I tried both lynx and elinks for small, text-only browsers, however neither worked (read: didn't open at all) when glab attempted to open them. I could open up either and navigate to the gitlab link directly while inside the container, so I'm not sure if it's an issue with the browsers or some interaction with how glab is attempting to open them. 🤷

It might be worth at some point putting some handlebars around this deeper in the code-- something like if no BROWSER is available and xgd-open exits in failure, just show the url and be done with it? However this is more of a minor annoyance. The URL is still shown and is clickable from the console, even if the browser open functionality doesn't work.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by 🤖 GitLab Bot 🤖

Merge request reports