Skip to content
Snippets Groups Projects

fix: revise docker image dependencies

Merged A. Stadler requested to merge tzfx1/cli:update-docker-builds into main
All threads resolved!
  • 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. :shrug:

:question: 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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Oscar Tovar
  • Oscar Tovar
  • Oscar Tovar
  • Oscar Tovar
    • Resolved by A. Stadler

      Thanks for the contribution, it's greatly appreciated :thank_you: There's a few changes being made in this MR that are not related to the removal of the image dependencies. I tried my best to annotate them with my interpretation, but if I made a mistake, please feel free to correct them. I left some suggestions to further trim down the Dockerfile to the bare minimum. Please take a look, and let me know what you think.

  • A. Stadler added 1 commit

    added 1 commit

    Compare with previous version

  • A. Stadler requested review from @hacks4oats

    requested review from @hacks4oats

  • Oscar Tovar approved this merge request

    approved this merge request

  • Awesome work on this @tzfx1 I'm approving and setting to auto merge!

  • Oscar Tovar enabled automatic add to merge train when checks pass

    enabled automatic add to merge train when checks pass

  • Oscar Tovar resolved all threads

    resolved all threads

  • merged

  • Oscar Tovar mentioned in commit b367216e

    mentioned in commit b367216e

  • @tzfx1, how was your code review experience with this merge request? Please tell us how we can continue to iterate and improve:

    1. React with a :thumbsup: or a :thumbsdown: on this comment to describe your experience.
    2. Create a new comment starting with @gitlab-bot feedback below, and leave any additional feedback you have for us in the comment.

    Subscribe to the GitLab Community Newsletter for contributor-focused content and opportunities to level up.

    Thanks for your help! :heart:

    This message was generated automatically. You're welcome to improve it.

  • @tzfx1, congratulations for getting your first MR merged :tada:

    If this is your first MR against a GitLab project, we'd like to invite and encourage you to self-nominate yourself for First MR Merged swag prize here.

    Thank you again for contributing, what's your next contribution going to be? :thinking:

    This message was generated automatically. You're welcome to improve it.

  • Please register or sign in to reply
    Loading