From 94c486335cda18b6e7766fc1a2c09b208b4eda29 Mon Sep 17 00:00:00 2001 From: Nicholas Tate Date: Mon, 22 Aug 2022 20:03:22 +0000 Subject: [PATCH 1/2] Add snap support for docker interface for app dev builds --- snap/snapcraft.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 33a04b8bd..fbe13fe59 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -64,6 +64,8 @@ parts: bin/doctl: bin/doctl.real plugs: + app-dev-build: + interface: docker dot-docker: interface: personal-files write: @@ -88,3 +90,4 @@ apps: - dot-docker - doctl-config - kube-config + - app-dev-build From a29e02b2960d912e95d4dfc727e19afc356ac971 Mon Sep 17 00:00:00 2001 From: Nicholas Tate Date: Mon, 22 Aug 2022 20:38:03 +0000 Subject: [PATCH 2/2] add snap warning message --- commands/apps_dev.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/apps_dev.go b/commands/apps_dev.go index 17381253c..91ce88fb6 100644 --- a/commands/apps_dev.go +++ b/commands/apps_dev.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + "io/fs" "os" "sync" @@ -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