Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snap support for docker interface for app dev builds #1214

Merged
merged 2 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -64,6 +64,8 @@ parts:
bin/doctl: bin/doctl.real

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