Skip to content

Commit

Permalink
Add snap support for docker interface for app dev builds (digitalocea…
Browse files Browse the repository at this point in the history
…n#1214)

* Add snap support for docker interface for app dev builds

* add snap warning message
  • Loading branch information
nicktate committed Sep 20, 2022
1 parent b2b8434 commit 5754811
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions commands/apps_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"os"
"sync"

Expand Down Expand Up @@ -311,6 +312,11 @@ func RunAppsDevBuild(c *CmdConfig) error {
}
res, err = builder.Build(ctx)
if err != nil {
_, isSnap := os.LookupEnv("SNAP")
if errors.Is(err, fs.ErrPermission) && isSnap {
template.Buffered(logWriter, `{{warning "Using the doctl Snap? Grant access to the doctl:app-dev-build plug to use this command with: sudo snap connect doctl:app-dev-build docker:docker-daemon"}}{{nl}}`, nil)
return err
}
return err
}
return nil
Expand Down
3 changes: 3 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ parts:
bin/doctl: bin/doctl.real

plugs:
app-dev-build:
interface: docker
dot-docker:
interface: personal-files
write:
Expand All @@ -90,3 +92,4 @@ apps:
- dot-docker
- doctl-config
- kube-config
- app-dev-build

0 comments on commit 5754811

Please sign in to comment.