Commit Graph
1811 Commits
Author SHA1 Message Date
balanza e01f942ae1 fix(containermanager): prevent nil pointer exception 2026-06-14 13:04:28 +02:00
balanza 492b81a9b8 chore(ci): fix test CI command 2026-06-14 13:04:28 +02:00
Emanuele De Cupis 5a9649e6ee chore(repo): make the go rewrite the root project (#60)
* chore(repo): remove shell implementation

* chore(repo): remove bash completion for sub-commands

There is no need for separate files as there will be no dedicated binary
for sub-commands

* chore(repo): remove zsh completion for sub-commands

There is no need for separate files as there will be no dedicated binary
for sub-commands

* chore(repo): delete RFC

We are not using RFC at the moment

* chore(repo): move golang project to the root

* chore(ci): move golang project to the root

* chore(repo): use standard .gitignore for golang projects

source: https://github.com/github/gitignore/blob/main/Go.gitignore

* chore(ci): compatibility CI to handle a golang project

* refactor(ci): run shell script checks against the inside-distrobox files

* refactor(ci): merge ci.yml workflow into main.yml
2026-06-14 13:04:28 +02:00
Emanuele De Cupis 2631fb48f5 feat(rm): cleanup container desktop resources (#59)
* feat(rm): cleanup exported apps and bins

* feat(rm): remove desktop entry
2026-06-14 13:04:28 +02:00
Emanuele De Cupis 8c0408396e feat(assemble): exported apps and bins (#58)
* fix(assemble): start container only if the flag is provided

* test(containermanager): define mock

* feat(assemble): export apps

* test(assemble): fail on invalid app name

* feat(assemble): exported bins

* test(assemble): fail on invalid bin name
2026-06-14 13:04:28 +02:00
Emanuele De Cupis 9c2de1e996 feat(create): pull on create (#39)
* feat(containermanager): add ExistsImage function

* feat(containermanager): add PullImage function

* feat(containermanager): pipe command output to stdout and stderr

* feat(create): allow image pull on distrobox create

* feat(ephemeral): allow image pulling

* feat(assemble): allow image pulling

* refactor(manifest): use AlwaysPull instead of Pull to explicit intent
2026-06-14 13:04:27 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 0eceb5a316 build(deps): bump actions/setup-go from 6.2.0 to 6.3.0 (#55)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5...4b73464bb391d4059bd26b0524d20df3927bd417)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 78ff32fe03 fix(containermanager): handle enter custom command (#57) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 18b6743402 feat(assemble): handle start_now field in manifest (#56) 2026-06-14 13:04:27 +02:00
Alessio Biancalana fe1e9d56de feat(upgrade): go porting (#54)
* feat(upgrade): port to go

* chore: adjust linting config
2026-06-14 13:04:27 +02:00
8dfb3ad2f7 test(rewrite): add shell-vs-Go compatibility test suite (#44)
* test(rewrite): add shell-vs-Go compatibility test suite

Compares command generation and flag parity between shell distrobox and
the Go rewrite. Uses a single image (alpine:3.21) since all tests
operate at the command-generation level, not runtime.

Shell output is always the reference — if Go differs it's a failure,
not a skip. Go stderr is captured for diagnostics on flag rejections.
Container targeting is per-name only (no --all) to avoid interfering
with existing distroboxes.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix add more tests

* fix add more tests

* fix add more tests

* fix(tests): fix malformed test cases in compare.sh

Three value-flag tests were broken by word splitting on unquoted
${flags} expansion — multi-word values caused trailing tokens to
clobber the container name:
- --additional-flags "--ulimit nofile=4096:4096" → --memory=512m
- --init-hooks "echo test-init-hook" → true
- --pre-init-hooks "echo test-pre-init-hook" → true

Also fix flag_slug computation (tr ' -' → tr ' -/:') in all four
loop sites so paths containing / or : don't create bogus filenames,
which silently broke the -H /tmp/dbx-test-home short-flag test.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix: test refinement

remove version checks
remove ephemeral until we fix upstream
add test that surfaces go vs shell difference

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix: exclude SHLVL from checks, reduce noise

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* fix(test): remove some noise from env vars

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>

* chore: rename output file so that are grouped by operation

* chore(tests): fix linting issues and port comparison tests to POSIX sh

* chore(tests): apply shfmt

---------

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: balanza <emanuele@decup.is>
Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 13:04:27 +02:00
Alessio Biancalana 1522c75eaa chore(rm): format go code (#53) 2026-06-14 13:04:27 +02:00
Alessio Biancalana 0b543d194d feat(rm): aliases for flags 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 02fd08ab89 fix(containermanager): handle podman+runc scenario (#51)
When using Podman on a system that uses runc, we must manually add root
mounts to ensure they are mounted as read only volumes
2026-06-14 13:04:27 +02:00
Alessio Biancalana b7e48d7069 chore(list): ls alias (#50) 2026-06-14 13:04:27 +02:00
Alessio Biancalana 16c438d581 fix(create): dry run doesn't fail if container exists (#49) 2026-06-14 13:04:27 +02:00
Luca Di Maio 3c0a2f3036 fix: sync with shell upstream (#48)
Go rewrite emitted --userns keep-id without :size=65536 and
--platform <val> instead of --platform=<val>, diverging from the
shell reference implementation.

Sync assets internal shell with current upstream

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 83aecc269f feat(enter): support custom commands, fix TTY detection and flag parsing (#47) 2026-06-14 13:04:27 +02:00
Luca Di Maio 75c5e39640 fix(ephemeral): add dry-run flag
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 96974f71a0 fix(podman): fix constant lint
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio ed61cd0c4d fix(enter): add missing dry run
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 2d010dde14 fix(podman): empty DBX_CONTAINER_MANAGER should default to podman
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 792dfd20cc fix(podman): add missing Commit implementation
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio d7c0b3cd81 fix(create): behave like shell, use containerName as default hostname on unsharenetns
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
balanza 847ec6fc13 feat(containermanager): add suppoer to podman static 2026-06-14 13:04:27 +02:00
balanza ea9503c3e6 chore(lint): ignore duplication for podman container containermanager 2026-06-14 13:04:27 +02:00
balanza 46ece43968 feat(containermanager): add podman support 2026-06-14 13:04:27 +02:00
dependabot[bot] 63c22522f8 build(deps): bump actions/checkout from 6.0.1 to 6.0.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-14 13:04:27 +02:00
dependabot[bot] b04758c28f build(deps): bump actions/setup-go from 6.1.0 to 6.2.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/4dc6199c7b1a012772edbd06daecab0f50c9053c...7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-14 13:04:27 +02:00
balanza eea4ce9315 refactor(create): reduce command function complexity 2026-06-14 13:04:27 +02:00
balanza 31c4efa7ec feat(create): handle clone flag
Distroboxes using `--clone` flag will be created from the given existing
container. A new image is committed using the container as a base.
2026-06-14 13:04:27 +02:00
balanza 3b1c865ac9 feat(containermanager): add commit command 2026-06-14 13:04:27 +02:00
balanza 2c54e1746d feat(containermanager): parse container ID from inspect data 2026-06-14 13:04:27 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 90f914a14a build(deps): bump actions/checkout from 5.0.1 to 6.0.1 (#37)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.1 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5.0.1...v6.0.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 13:04:27 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 9a188438c0 build(deps): bump golangci/golangci-lint-action from 9.1.0 to 9.2.0 (#38)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 9.1.0 to 9.2.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/e7fa5ac41e1cf5b7d48e45e42232ce7ada589601...1e7e51e771db61008b38414a730f564565cf7c20)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: 9.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 90a9a64c76 feat(ephemeral): implement ephemeral command (#34)
* refactor(enter): define command options

Refactor the `enter` command package so that adheres to the convention
to define its own arguments as options and read them in the Execute
method.

* refactor(containermanager): add InspectContainer to the public interface

* refactor(rm): move preflight checks in the command layer

That simplifies the containermanager.Remove interface and improve the
separation between the container manager and the presentation logic as
prompting it's not handled at containermanager level anymore.
It also improves efficiency as the userenv is fetch only once.

* refactor(ui): pass the prompter by reference

Use pointer to optimize memory footprint. It also allows nullable
references, hence a validation is required for the `rm` command when
executing on interactive mode.

* feat(ephemeral): add ephemeral command

The command is a composition of create, enter and rm commands.
It accepts the same arguments as the create command.
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 4107ec9cf3 feat(stop): add stop command (#36)
Add the stop command to stop executing containers. The command is a
wrapper of the container manager's stop feature.
If no container name is provided and the `--all` flag is not set, the
default container name is implied.
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 6f5a541732 fix(enter): remove wrong early return (#35) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 09294e2264 feat(create): abort create if the container already exists (#28)
* add Exists function to containermanager

This public function tells if the container exists or not.
No output parsing is necessary, hence for performance we avoid using the
already-present InspectContainer function.

* fail if container with the same name already exists

* output error
2026-06-14 13:04:27 +02:00
balanza 2da62dafdc fix: add complete message 2026-06-14 13:04:27 +02:00
Fabrizio Sestito 31ceeb1074 fix(manifest): use recursive includes resolver to detect circular dependencies
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 861a1a7504 perf(manifest): reduce allocations in sectionToItem
Replace helper functions (lastString, lastBool, allStrings, splitString)
with a single loop that fetches ValueWithShadows() once per key. This
avoids repeated calls to the ini library for each field.

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 1ed885cbf0 chore(manifest): rename tests to something more idiomatic
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 6d6afebb2d refactor: simplify manifest parsing with iniv1 library
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Emanuele De Cupis e90eab44a3 chore: introduce ui package (#31)
* move the Propter under screen package

* add color formatters

* add progress

This module allows for printing a sequence of lines with check marks.
Useful to show progress on a long running action (example: container
init).

* implement progess on create

* implement progress on assemble

* implement progress on enter

* implement color

* move internal/screen to pkg/ui

* add printer

* implement printer

* fix progress finalize method

* fix progress implementation for enter command
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 7a49a645aa feat(assemble): implement rm and replace (#27) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 974aacf5fc chore(rm): refactor options passing (#26) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis f4b876dca2 fix(rm): remove only distrobox (#25) 2026-06-14 13:04:27 +02:00
Alessio Biancalana cd919f684c feat(rm): rewrite in go (#23)
* feat: rewrite rm in go

* fix: declare yes and no as string slices
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 73bc4bc141 feat(assemble): fetch remote manifest (#24)
Manifest can either be file or remote URLs. In the latter case, the content is fetched into a temporary file; then the parsing follows as usual.

Note that the HTTP fetch has no constraint on protocol to use nor an allowed list of URLs, just like in the original `assemble` command. https://github.com/89luca89/distrobox/blob/main/distrobox-assemble#L240

```
if command -v curl > /dev/null 2>&1; then
	download="curl --connect-timeout 3 --retry 1 -sLo"
elif command -v wget > /dev/null 2>&1; then
	download="wget --timeout=3 --tries=1 -qO"
```

The only difference with the original implementation is that the file input is checked to be a valid URL.
2026-06-14 13:04:27 +02:00