status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
β | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,378 |
Inconsistencies in dagger mod get
|
Currently you are forced to use the .git suffix if the repository is not from github.
The imported package keeps the suffix thus altering the import directive to be used, therefore the import will be different in the tests of the project containing the package compared to projects where dagger mod get is used.
Moreover, the structure of a [package](https://github.com/grouville/dagger-serverless) is different from what is [documented](https://docs.dagger.io/1010/dev-cue-package/)
Supposing we have a repository called gitlab.banana.org/wonderful with a tag called v0.1.0 and this repository contains a directory called poteto like the cue package name. In this case i have to do:
`dagger mod get gitlab.banana.org/wonderful.git/[email protected]`
The resulting package name will be gitlab.banana.org/wonderful.git/poteto
It would be better to remove the .git suffix or just treat gitlab (or others) the same way as github, in other words, make this command work:
`dagger mod get gitlab.banana.org/wonderful/[email protected]`
|
https://github.com/dagger/dagger/issues/1378
|
https://github.com/dagger/dagger/pull/1431
|
e60b9dc268e491623f1327c7652ccda0664ca25b
|
455beae7622e026e399b22ff02155e4b5b529b9a
| 2022-01-10T18:04:14Z |
go
| 2022-01-18T09:11:21Z |
mod/require_test.go
|
clonePath: "/stdlib",
},
},
{
name: "Dagger repo with longer path and commit version",
in: "github.com/dagger/dagger/stdlib/test/test@26a1d46d1b3c",
want: &Require{
repo: "github.com/dagger/dagger",
path: "/stdlib/test/test",
version: "26a1d46d1b3c",
},
},
{
name: "Custom git provider without folder",
in: "git.blocklayer.com/dagger/test.git@main",
want: &Require{
repo: "git.blocklayer.com/dagger/test.git",
path: "",
version: "main",
},
},
{
name: "Custom git provider with folder and version",
in: "git.blocklayer.com/dagger/test.git/[email protected]",
want: &Require{
repo: "git.blocklayer.com/dagger/test.git",
path: "/test",
version: "v1.1.0",
},
},
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,378 |
Inconsistencies in dagger mod get
|
Currently you are forced to use the .git suffix if the repository is not from github.
The imported package keeps the suffix thus altering the import directive to be used, therefore the import will be different in the tests of the project containing the package compared to projects where dagger mod get is used.
Moreover, the structure of a [package](https://github.com/grouville/dagger-serverless) is different from what is [documented](https://docs.dagger.io/1010/dev-cue-package/)
Supposing we have a repository called gitlab.banana.org/wonderful with a tag called v0.1.0 and this repository contains a directory called poteto like the cue package name. In this case i have to do:
`dagger mod get gitlab.banana.org/wonderful.git/[email protected]`
The resulting package name will be gitlab.banana.org/wonderful.git/poteto
It would be better to remove the .git suffix or just treat gitlab (or others) the same way as github, in other words, make this command work:
`dagger mod get gitlab.banana.org/wonderful/[email protected]`
|
https://github.com/dagger/dagger/issues/1378
|
https://github.com/dagger/dagger/pull/1431
|
e60b9dc268e491623f1327c7652ccda0664ca25b
|
455beae7622e026e399b22ff02155e4b5b529b9a
| 2022-01-10T18:04:14Z |
go
| 2022-01-18T09:11:21Z |
mod/require_test.go
|
{
name: "Custom git provider with folder and version",
in: "git.blocklayer.com/dagger/test.git/[email protected]",
want: &Require{
repo: "git.blocklayer.com/dagger/test.git",
path: "/test",
version: "v1.1.0",
},
},
{
name: "Custom git provider without folder",
in: "git.blocklayer.com/dagger/test.git",
want: &Require{
repo: "git.blocklayer.com/dagger/test.git",
path: "",
version: "",
},
},
{
name: "Custom git provider with folder, no version",
in: "git.blocklayer.com/dagger/test.git/test",
want: &Require{
repo: "git.blocklayer.com/dagger/test.git",
path: "/test",
version: "",
},
},
{
name: "Custom git provider with custom port, folder, and version",
in: "git.blocklayer.com:7999/ops/dagger.git/stuff/here@v5",
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,378 |
Inconsistencies in dagger mod get
|
Currently you are forced to use the .git suffix if the repository is not from github.
The imported package keeps the suffix thus altering the import directive to be used, therefore the import will be different in the tests of the project containing the package compared to projects where dagger mod get is used.
Moreover, the structure of a [package](https://github.com/grouville/dagger-serverless) is different from what is [documented](https://docs.dagger.io/1010/dev-cue-package/)
Supposing we have a repository called gitlab.banana.org/wonderful with a tag called v0.1.0 and this repository contains a directory called poteto like the cue package name. In this case i have to do:
`dagger mod get gitlab.banana.org/wonderful.git/[email protected]`
The resulting package name will be gitlab.banana.org/wonderful.git/poteto
It would be better to remove the .git suffix or just treat gitlab (or others) the same way as github, in other words, make this command work:
`dagger mod get gitlab.banana.org/wonderful/[email protected]`
|
https://github.com/dagger/dagger/issues/1378
|
https://github.com/dagger/dagger/pull/1431
|
e60b9dc268e491623f1327c7652ccda0664ca25b
|
455beae7622e026e399b22ff02155e4b5b529b9a
| 2022-01-10T18:04:14Z |
go
| 2022-01-18T09:11:21Z |
mod/require_test.go
|
want: &Require{
repo: "git.blocklayer.com:7999/ops/dagger.git",
path: "/stuff/here",
version: "v5",
},
},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
got, err := newRequire(c.in, "")
if err != nil && c.hasError {
return
}
if err != nil {
t.Fatal(err)
}
if got.repo != c.want.repo {
t.Errorf("repos differ %q: want %s, got %s", c.in, c.want.repo, got.repo)
}
if got.path != c.want.path {
t.Errorf("paths differ %q: want %s, got %s", c.in, c.want.path, got.path)
}
if got.version != c.want.version {
t.Errorf("versions differ (%q): want %s, got %s", c.in, c.want.version, got.version)
}
})
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,105 |
Target when logging in to a private registry in a build requires a repo?
|
It appears that when I connect to my private registry for a build, I get an unauthorized response unless the target includes a repo (even if it doesn't exist).
```cue
package main
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
#Auth: {
target: dagger.#Input & {string}
username: dagger.#Input & {string}
secret: dagger.#Input & {dagger.#Secret | string}
}
// Add `auths` to `docker.#Build`
#Build: {
source: dagger.#Input & {dagger.#Artifact}
dockerfile: dagger.#Input & {*null | string}
args?: [string]: string | dagger.#Secret
auths: [...#Auth]
#up: [
for auth in auths {
op.#DockerLogin & {
for k, v in auth {
"\(k)": v
}
}
},
op.#DockerBuild & {
context: source
if dockerfile != null {
"dockerfile": dockerfile
}
if args != _|_ {
buildArg: args
}
},
]
}
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net"
username: "example"
}
]
}
```
This returns a **401 Unauthorized**:
```
$ dagger up
[β] image 0.4s
6:32PM FTL failed to up environment: task failed: registry.example.net/php:7.4: unexpected status code [manifests 7.4]: 401 Unauthorized
```
But **this works**:
```cue
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net/wat" // repo doesn't exist in the registry
username: "example"
}
]
}
```
Although with *docker.io* it isn't required. The following works:
```cue
image: #Build & {
source: null
dockerfile: """
FROM helder/private-repo
"""
auths: [
#Auth & {
target: "docker.io"
username: "helder"
}
]
}
```
I'm running a `registry:2` container with basic auth behind an Nginx reverse proxy.
|
https://github.com/dagger/dagger/issues/1105
|
https://github.com/dagger/dagger/pull/1454
|
abcd01ccfa5ffa88669b61af77b59258e5bd795c
|
587f92c9243e18ae69ab4373a7f48cfc248afe5d
| 2021-11-07T21:00:07Z |
go
| 2022-01-20T02:16:34Z |
solver/registryauth.go
|
package solver
import (
"context"
"strings"
"sync"
"github.com/docker/distribution/reference"
bkauth "github.com/moby/buildkit/session/auth"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type RegistryAuthProvider struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,105 |
Target when logging in to a private registry in a build requires a repo?
|
It appears that when I connect to my private registry for a build, I get an unauthorized response unless the target includes a repo (even if it doesn't exist).
```cue
package main
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
#Auth: {
target: dagger.#Input & {string}
username: dagger.#Input & {string}
secret: dagger.#Input & {dagger.#Secret | string}
}
// Add `auths` to `docker.#Build`
#Build: {
source: dagger.#Input & {dagger.#Artifact}
dockerfile: dagger.#Input & {*null | string}
args?: [string]: string | dagger.#Secret
auths: [...#Auth]
#up: [
for auth in auths {
op.#DockerLogin & {
for k, v in auth {
"\(k)": v
}
}
},
op.#DockerBuild & {
context: source
if dockerfile != null {
"dockerfile": dockerfile
}
if args != _|_ {
buildArg: args
}
},
]
}
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net"
username: "example"
}
]
}
```
This returns a **401 Unauthorized**:
```
$ dagger up
[β] image 0.4s
6:32PM FTL failed to up environment: task failed: registry.example.net/php:7.4: unexpected status code [manifests 7.4]: 401 Unauthorized
```
But **this works**:
```cue
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net/wat" // repo doesn't exist in the registry
username: "example"
}
]
}
```
Although with *docker.io* it isn't required. The following works:
```cue
image: #Build & {
source: null
dockerfile: """
FROM helder/private-repo
"""
auths: [
#Auth & {
target: "docker.io"
username: "helder"
}
]
}
```
I'm running a `registry:2` container with basic auth behind an Nginx reverse proxy.
|
https://github.com/dagger/dagger/issues/1105
|
https://github.com/dagger/dagger/pull/1454
|
abcd01ccfa5ffa88669b61af77b59258e5bd795c
|
587f92c9243e18ae69ab4373a7f48cfc248afe5d
| 2021-11-07T21:00:07Z |
go
| 2022-01-20T02:16:34Z |
solver/registryauth.go
|
credentials map[string]*bkauth.CredentialsResponse
m sync.RWMutex
}
func NewRegistryAuthProvider() *RegistryAuthProvider {
return &RegistryAuthProvider{
credentials: map[string]*bkauth.CredentialsResponse{},
}
}
func (a *RegistryAuthProvider) AddCredentials(target, username, secret string) {
a.m.Lock()
defer a.m.Unlock()
a.credentials[target] = &bkauth.CredentialsResponse{
Username: username,
Secret: secret,
}
}
func (a *RegistryAuthProvider) Register(server *grpc.Server) {
bkauth.RegisterAuthServer(server, a)
}
func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.CredentialsRequest) (*bkauth.CredentialsResponse, error) {
host := req.Host
if host == "registry-1.docker.io" {
host = "docker.io"
}
a.m.RLock()
defer a.m.RUnlock()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,105 |
Target when logging in to a private registry in a build requires a repo?
|
It appears that when I connect to my private registry for a build, I get an unauthorized response unless the target includes a repo (even if it doesn't exist).
```cue
package main
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
#Auth: {
target: dagger.#Input & {string}
username: dagger.#Input & {string}
secret: dagger.#Input & {dagger.#Secret | string}
}
// Add `auths` to `docker.#Build`
#Build: {
source: dagger.#Input & {dagger.#Artifact}
dockerfile: dagger.#Input & {*null | string}
args?: [string]: string | dagger.#Secret
auths: [...#Auth]
#up: [
for auth in auths {
op.#DockerLogin & {
for k, v in auth {
"\(k)": v
}
}
},
op.#DockerBuild & {
context: source
if dockerfile != null {
"dockerfile": dockerfile
}
if args != _|_ {
buildArg: args
}
},
]
}
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net"
username: "example"
}
]
}
```
This returns a **401 Unauthorized**:
```
$ dagger up
[β] image 0.4s
6:32PM FTL failed to up environment: task failed: registry.example.net/php:7.4: unexpected status code [manifests 7.4]: 401 Unauthorized
```
But **this works**:
```cue
image: #Build & {
source: null
dockerfile: """
FROM registry.example.net/php:7.4
"""
auths: [
#Auth & {
target: "registry.example.net/wat" // repo doesn't exist in the registry
username: "example"
}
]
}
```
Although with *docker.io* it isn't required. The following works:
```cue
image: #Build & {
source: null
dockerfile: """
FROM helder/private-repo
"""
auths: [
#Auth & {
target: "docker.io"
username: "helder"
}
]
}
```
I'm running a `registry:2` container with basic auth behind an Nginx reverse proxy.
|
https://github.com/dagger/dagger/issues/1105
|
https://github.com/dagger/dagger/pull/1454
|
abcd01ccfa5ffa88669b61af77b59258e5bd795c
|
587f92c9243e18ae69ab4373a7f48cfc248afe5d
| 2021-11-07T21:00:07Z |
go
| 2022-01-20T02:16:34Z |
solver/registryauth.go
|
for authHost, auth := range a.credentials {
u, err := parseAuthHost(authHost)
if err != nil {
return nil, err
}
if u == host {
return auth, nil
}
}
return &bkauth.CredentialsResponse{}, nil
}
func parseAuthHost(host string) (string, error) {
host = strings.TrimPrefix(host, "http://")
host = strings.TrimPrefix(host, "https://")
ref, err := reference.ParseNormalizedNamed(host)
if err != nil {
return "", err
}
return reference.Domain(ref), nil
}
func (a *RegistryAuthProvider) FetchToken(ctx context.Context, req *bkauth.FetchTokenRequest) (rr *bkauth.FetchTokenResponse, err error) {
return nil, status.Errorf(codes.Unavailable, "client side tokens not implemented")
}
func (a *RegistryAuthProvider) GetTokenAuthority(ctx context.Context, req *bkauth.GetTokenAuthorityRequest) (*bkauth.GetTokenAuthorityResponse, error) {
return nil, status.Errorf(codes.Unavailable, "client side tokens not implemented")
}
func (a *RegistryAuthProvider) VerifyTokenAuthority(ctx context.Context, req *bkauth.VerifyTokenAuthorityRequest) (*bkauth.VerifyTokenAuthorityResponse, error) {
return nil, status.Errorf(codes.Unavailable, "client side tokens not implemented")
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
package compiler
import (
"errors"
"path"
"path/filepath"
"sort"
"strconv"
"cuelang.org/go/cue"
"cuelang.org/go/cue/ast"
cueformat "cuelang.org/go/cue/format"
)
type Value struct {
val cue.Value
cc *Compiler
}
func (v *Value) FillPath(p cue.Path, x interface{}) error {
v.cc.lock()
defer v.cc.unlock()
if val, ok := x.(*Value); ok {
v.val = v.val.FillPath(p, val.val)
} else {
v.val = v.val.FillPath(p, x)
}
return v.val.Err()
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
func (v *Value) FillFields(values map[string]interface{}) (*Value, error) {
for p, x := range values {
if err := v.FillPath(cue.ParsePath(p), x); err != nil {
return nil, err
}
}
return v, nil
}
func (v *Value) LookupPath(p cue.Path) *Value {
v.cc.rlock()
defer v.cc.runlock()
return v.cc.Wrap(v.val.LookupPath(p))
}
func (v *Value) Lookup(path string) *Value {
return v.LookupPath(cue.ParsePath(path))
}
func (v *Value) ReferencePath() (*Value, cue.Path) {
vv, p := v.val.ReferencePath()
return v.cc.Wrap(vv), p
}
func (v *Value) Len() cue.Value {
return v.val.Len()
}
func (v *Value) Kind() cue.Kind {
return v.val.Kind()
}
func (v *Value) IncompleteKind() cue.Kind {
return v.Cue().IncompleteKind()
}
type Field struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
Selector cue.Selector
Value *Value
}
func (f Field) Label() string {
l := f.Selector.String()
if unquoted, err := strconv.Unquote(l); err == nil {
return unquoted
}
return l
}
func (v *Value) Fields(opts ...cue.Option) ([]Field, error) {
it, err := v.val.Fields(opts...)
if err != nil {
return nil, err
}
fields := []Field{}
for it.Next() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
fields = append(fields, Field{
Selector: it.Selector(),
Value: v.cc.Wrap(it.Value()),
})
}
sort.SliceStable(fields, func(i, j int) bool {
return fields[i].Selector.String() < fields[j].Selector.String()
})
return fields, nil
}
func (v *Value) Struct() (*cue.Struct, error) {
return v.val.Struct()
}
func (v *Value) Exists() bool {
return v.val.Exists()
}
func (v *Value) Bytes() ([]byte, error) {
return v.val.Bytes()
}
func (v *Value) String() (string, error) {
return v.val.String()
}
func (v *Value) Int64() (int64, error) {
return v.val.Int64()
}
func (v *Value) Bool() (bool, error) {
return v.val.Bool()
}
func (v *Value) Path() cue.Path {
return v.val.Path()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
}
func (v *Value) Decode(x interface{}) error {
return v.val.Decode(x)
}
func (v *Value) List() ([]*Value, error) {
l := []*Value{}
it, err := v.val.List()
if err != nil {
return nil, err
}
for it.Next() {
l = append(l, v.cc.Wrap(it.Value()))
}
return l, nil
}
func (v *Value) IsConcrete() bool {
return v.val.IsConcrete()
}
func (v *Value) IsConcreteR(opts ...cue.Option) error {
o := []cue.Option{
cue.All(),
cue.Concrete(true),
cue.Hidden(true),
}
o = append(o, opts...)
return v.val.Validate(o...)
}
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
var (
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
llBefore func(cue.Value) bool
llAfter func(cue.Value)
)
if before != nil {
llBefore = func(child cue.Value) bool {
return before(v.cc.Wrap(child))
}
}
if after != nil {
llAfter = func(child cue.Value) {
after(v.cc.Wrap(child))
}
}
v.val.Walk(llBefore, llAfter)
}
func (v *Value) JSON() JSON {
cuePathToStrings := func(p cue.Path) []string {
selectors := p.Selectors()
out := make([]string, len(selectors))
for i, sel := range selectors {
out[i] = sel.String()
}
return out
}
var out JSON
v.val.Walk(
func(v cue.Value) bool {
b, err := v.MarshalJSON()
if err == nil {
newOut, err := out.Set(b, cuePathToStrings(v.Path())...)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
if err == nil {
out = newOut
}
return false
}
return true
},
nil,
)
out, _ = out.Get(cuePathToStrings(v.Path())...)
return out
}
func (v *Value) Validate() error {
return v.val.Validate()
}
func (v *Value) Source(opts ...cue.Option) ([]byte, error) {
v.cc.rlock()
defer v.cc.runlock()
return cueformat.Node(v.val.Eval().Syntax(opts...),
cueformat.UseSpaces(4),
cueformat.TabIndent(false),
)
}
func (v *Value) Cue() cue.Value {
return v.val
}
func (v *Value) HasAttr(filter ...string) bool {
attrs := v.val.Attributes(cue.ValueAttr)
for _, attr := range attrs {
name := attr.Name()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
if name == "dagger" {
if len(filter) == 0 {
return true
}
for i := 0; i < attr.NumArgs(); i++ {
key, _ := attr.Arg(i)
for _, val := range filter {
if key == val {
return true
}
}
}
}
}
return false
}
func (v *Value) Filename() (string, error) {
pos := v.Cue().Pos()
if !pos.IsValid() {
return "", errors.New("invalid token position")
}
return pos.Filename(), nil
}
func (v *Value) Dirname() (string, error) {
f, err := v.Filename()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,494 |
Data race in value.FillPath()
|
I just noticed a data race in CI: https://github.com/dagger/dagger/runs/4930769392?check_suite_focus=true
It looks like it might be happening in `task/transformsecret.go`.
We're using `value.Walk()`, and in `Walk` we've left this nugget:
```
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
// FIXME: lock?
```
So I think yes, we should lock.
/cc @talentedmrjones
Trace:
```
# (from function `dagger' in file netlify/test/../../bats_helpers.bash, line 24,
# in test file netlify/test/netlify.bats, line 8)
# `dagger up ./netlify-test.cue' failed with status 66
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseRead: commandconn: failed to wait: signal: broken pipe"
# time="2022-01-25T01:22:59Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: broken pipe"
# 1:23AM INF inputs.secrets.test | computing
# 1:23AM INF actions._alpine._dag."0"._op | computing
# 1:23AM INF actions.data | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | computing
# 1:23AM INF actions.deploy._source | computing
# 1:23AM INF actions.data | completed duration=0s
# 1:23AM INF actions.deploy._build._dag."0"._dag."0"._op | completed duration=0s
# 1:23AM INF actions._alpine._dag."0"._op | completed duration=100ms
# 1:23AM INF inputs.secrets.test | completed duration=100ms
# 1:23AM INF actions.deploy._source | completed duration=100ms
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | computing
# 1:23AM INF actions.deploy._build._dag."0"._dag."1"._exec | completed duration=0s
# 1:23AM INF actions._image._dag."1"._exec | #6 0.224 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.358 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
# 1:23AM INF actions._image._dag."1"._exec | #6 0.739 (1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.750 (2/4) Installing ncurses-libs (6.3_p20211120-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.766 (3/4) Installing readline (8.1.1-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.778 (4/4) Installing bash (5.1.8-r0)
# 1:23AM INF actions._image._dag."1"._exec | #6 0.804 Executing bash-5.1.8-r0.post-install
# 1:23AM INF actions._image._dag."1"._exec | #6 0.809 Executing busybox-1.34.1-r3.trigger
# 1:23AM INF actions._image._dag."1"._exec | #6 0.813 OK: 8 MiB in 18 packages
# 1:23AM INF actions._alpine._dag."1"._exec | computing
# 1:23AM INF actions._alpine._dag."1"._exec | completed duration=0s
# 1:23AM INF actions.testSecrets | computing
# ==================
# WARNING: DATA RACE
# Read at 0x00c00086d2b4 by goroutine 83:
# cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1229 +0x11e
# cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:1215 +0x31d
# cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:376 +0x395
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:236 +0x1825
# cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:678 +0x42d
# cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:574 +0x7cb
# cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/disjunct.go:151 +0x2a4f
# cuelang.org/go/internal/core/adt.(*OpContext).Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/eval.go:290 +0x53d
# cuelang.org/go/internal/core/adt.(*Vertex).Finalize()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/internal/core/adt/composite.go:453 +0x1aa
# cuelang.org/go/cue.Value.Unify()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1831 +0x147
# cuelang.org/go/cue.Value.FillPath()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/cue/types.go:1716 +0x171b
# go.dagger.io/dagger/compiler.(*Value).FillPath()
# /home/runner/work/dagger/dagger/compiler/value.go:32 +0x365
# go.dagger.io/dagger/plan/task.(*transformSecretTask).Run()
# /home/runner/work/dagger/dagger/plan/task/transformsecret.go:36 +0x234
# go.dagger.io/dagger/plan.newRunner.func1.1()
# /home/runner/work/dagger/dagger/plan/plan.go:215 +0xa4b
# cuelang.org/go/tools/flow.RunnerFunc.Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:114 +0x3d
# cuelang.org/go/tools/flow.(*Controller).runLoop.func1()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:67 +0x82
#
# Previous write at 0x00c00086d2b4 by goroutine 48:
# [failed to restore the stack]
#
# Goroutine 83 (running) created at:
# cuelang.org/go/tools/flow.(*Controller).runLoop()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/run.go:66 +0x394
# cuelang.org/go/tools/flow.(*Controller).Run()
# /home/runner/go/pkg/mod/github.com/dagger/[email protected]/tools/flow/flow.go:228 +0x16d
# go.dagger.io/dagger/plan.(*Plan).Up()
# /home/runner/work/dagger/dagger/plan/plan.go:169 +0x371
# go.dagger.io/dagger/cmd/dagger/cmd.europaUp.func1()
# /home/runner/work/dagger/dagger/cmd/dagger/cmd/up.go:155 +0x116
# go.dagger.io/dagger/client.(*Client).buildfn.func3()
# /home/runner/work/dagger/dagger/client/client.go:171 +0x857
# github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/frontend/gateway/grpcclient/client.go:188 +0x14b
# github.com/moby/buildkit/client.(*Client).Build.func2()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:56 +0x3be
# github.com/moby/buildkit/client.(*Client).solve.func3()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:224 +0x8e
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
#
# Goroutine 48 (running) created at:
# golang.org/x/sync/errgroup.(*Group).Go()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x73
# github.com/moby/buildkit/client.(*Client).solve()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/solve.go:223 +0x12fb
# github.com/moby/buildkit/client.(*Client).Build()
# /home/runner/go/pkg/mod/github.com/moby/[email protected]/client/build.go:62 +0x627
# go.dagger.io/dagger/client.(*Client).buildfn()
# /home/runner/work/dagger/dagger/client/client.go:157 +0x848
# go.dagger.io/dagger/client.(*Client).Do.func2()
# /home/runner/work/dagger/dagger/client/client.go:93 +0x72
# golang.org/x/sync/errgroup.(*Group).Go.func1()
# /home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x94
# ==================
```
|
https://github.com/dagger/dagger/issues/1494
|
https://github.com/dagger/dagger/pull/1495
|
6ce362be5d919022ca2a9c4a6ff110e63d412d83
|
c6d4ffb75ebfcd2c7c5852e02c657bbf0ab4a24c
| 2022-01-25T01:48:27Z |
go
| 2022-01-26T01:21:38Z |
compiler/value.go
|
return "", err
}
return filepath.Dir(f), nil
}
func (v *Value) AbsPath() (string, error) {
p, err := v.String()
if err != nil {
return "", nil
}
if filepath.IsAbs(p) {
return p, nil
}
d, err := v.Dirname()
if err != nil {
return "", err
}
return path.Join(d, p), nil
}
func (v *Value) Dereference() *Value {
dVal := cue.Dereference(v.val)
return v.cc.Wrap(dVal)
}
func (v *Value) Default() (*Value, bool) {
val, hasDef := v.val.Default()
return v.cc.Wrap(val), hasDef
}
func (v *Value) Doc() []*ast.CommentGroup {
return v.Cue().Doc()
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
cmd/dagger/cmd/mod/get.go
|
package mod
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/common"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.dagger.io/dagger/mod"
"go.dagger.io/dagger/telemetry"
)
var getCmd = &cobra.Command{
Use: "get [packages]",
Short: "download and install dependencies",
Args: cobra.MaximumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
if err := viper.BindPFlags(cmd.Flags()); err != nil {
panic(err)
}
},
Run: func(cmd *cobra.Command, args []string) {
lg := logger.New()
ctx := lg.WithContext(cmd.Context())
project := common.CurrentProject(ctx)
doneCh := common.TrackProjectCommand(ctx, cmd, project, nil, &telemetry.Property{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
cmd/dagger/cmd/mod/get.go
|
Name: "packages",
Value: args,
})
var update = viper.GetBool("update")
var processedRequires []*mod.Require
var err error
if update && len(args) == 0 {
lg.Info().Msg("updating all installed packages...")
processedRequires, err = mod.UpdateInstalled(ctx, project.Path)
} else if update && len(args) > 0 {
lg.Info().Msg("updating specified packages...")
processedRequires, err = mod.UpdateAll(ctx, project.Path, args)
} else if !update && len(args) > 0 {
lg.Info().Msg("installing specified packages...")
processedRequires, err = mod.InstallAll(ctx, project.Path, args)
} else {
lg.Fatal().Msg("unrecognized update/install operation")
}
if len(processedRequires) > 0 {
for _, r := range processedRequires {
lg.Info().Msgf("installed/updated package %s", r)
}
}
if err != nil {
lg.Error().Err(err).Msg("error installing/updating packages")
}
<-doneCh
},
}
func init() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
cmd/dagger/cmd/mod/get.go
|
getCmd.Flags().String("private-key-file", "", "Private ssh key")
getCmd.Flags().String("private-key-password", "", "Private ssh key password")
getCmd.Flags().BoolP("update", "u", false, "Update specified package")
if err := viper.BindPFlags(getCmd.Flags()); err != nil {
panic(err)
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
mod/repo.go
|
package mod
import (
"context"
"fmt"
"os"
"sort"
"strings"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/rs/zerolog/log"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/hashicorp/go-version"
)
type repo struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
mod/repo.go
|
contents *git.Repository
require *Require
}
func clone(ctx context.Context, require *Require, dir string, privateKeyFile, privateKeyPassword string) (*repo, error) {
if err := os.RemoveAll(dir); err != nil {
return nil, fmt.Errorf("error cleaning up tmp directory")
}
if err := os.MkdirAll(dir, 0755); err != nil {
return nil, fmt.Errorf("error creating tmp dir for cloning package")
}
o := git.CloneOptions{
URL: fmt.Sprintf("https://%s", require.cloneRepo),
}
if privateKeyFile != "" {
publicKeys, err := ssh.NewPublicKeysFromFile("git", privateKeyFile, privateKeyPassword)
if err != nil {
return nil, err
}
o.Auth = publicKeys
o.URL = fmt.Sprintf("git@%s", strings.Replace(require.cloneRepo, "/", ":", 1))
}
r, err := git.PlainClone(dir, false, &o)
if err != nil {
return nil, err
}
rr := &repo{
contents: r,
require: require,
}
if require.version == "" {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
mod/repo.go
|
latestTag, err := rr.latestTag(ctx, require.versionConstraint)
if err != nil {
return nil, err
}
require.version = latestTag
}
if err := rr.checkout(ctx, require.version); err != nil {
return nil, err
}
return rr, nil
}
func (r *repo) checkout(ctx context.Context, version string) error {
lg := log.Ctx(ctx)
h, err := r.contents.ResolveRevision(plumbing.Revision(version))
if err != nil {
return err
}
lg.Debug().Str("repository", r.require.repo).Str("version", version).Str("commit", h.String()).Msg("checkout repo")
w, err := r.contents.Worktree()
if err != nil {
return err
}
err = w.Checkout(&git.CheckoutOptions{
Hash: *h,
})
if err != nil {
return err
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
mod/repo.go
|
func (r *repo) listTagVersions(ctx context.Context, versionConstraint string) ([]string, error) {
lg := log.Ctx(ctx).With().
Str("repository", r.require.repo).
Str("versionConstraint", versionConstraint).
Logger()
if versionConstraint == "" {
versionConstraint = ">= 0"
}
constraint, err := version.NewConstraint(versionConstraint)
if err != nil {
return nil, err
}
iter, err := r.contents.Tags()
if err != nil {
return nil, err
}
var tags []string
err = iter.ForEach(func(ref *plumbing.Reference) error {
tagV := ref.Name().Short()
if !strings.HasPrefix(tagV, "v") {
lg.Debug().Str("tag", tagV).Msg("tag version ignored, wrong format")
return nil
}
v, err := version.NewVersion(tagV)
if err != nil {
lg.Debug().Str("tag", tagV).Err(err).Msg("tag version ignored, parsing error")
return nil
}
if constraint.Check(v) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
mod/repo.go
|
tags = append(tags, ref.Name().Short())
lg.Debug().Str("tag", tagV).Msg("version added")
} else {
lg.Debug().Str("tag", tagV).Msg("tag version ignored, does not satisfy constraint")
}
return nil
})
if err != nil {
return nil, err
}
return tags, nil
}
func (r *repo) latestTag(ctx context.Context, versionConstraint string) (string, error) {
versionsRaw, err := r.listTagVersions(ctx, versionConstraint)
if err != nil {
return "", err
}
versions := make([]*version.Version, len(versionsRaw))
for i, raw := range versionsRaw {
v, _ := version.NewVersion(raw)
versions[i] = v
}
if len(versions) == 0 {
return "", fmt.Errorf("repo doesn't have any tags matching the required version")
}
sort.Sort(sort.Reverse(version.Collection(versions)))
version := versions[0].Original()
return version, nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
package pkg
import (
"context"
"embed"
"errors"
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"strings"
"github.com/gofrs/flock"
"github.com/rs/zerolog/log"
)
var (
FS embed.FS
)
var (
AlphaModule = "alpha.dagger.io"
DaggerModule = "dagger.io"
UniverseModule = "universe.dagger.io"
modules = []string{
AlphaModule,
DaggerModule,
UniverseModule,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
}
EnginePackage = fmt.Sprintf("%s/dagger/engine", DaggerModule)
lockFilePath = "dagger.lock"
)
func Vendor(ctx context.Context, p string) error {
if p == "" {
p = getCueModParent()
}
cuePkgDir := path.Join(p, "cue.mod", "pkg")
if err := os.MkdirAll(cuePkgDir, 0755); err != nil {
return err
}
lockFile := path.Join(cuePkgDir, lockFilePath)
l := flock.New(lockFile)
if err := l.Lock(); err != nil {
return err
}
defer func() {
l.Unlock()
os.Remove(lockFile)
}()
if err := cueModInit(ctx, p); err != nil {
return err
}
if err := os.WriteFile(
path.Join(cuePkgDir, ".gitignore"),
[]byte(fmt.Sprintf("# generated by dagger\ndagger.lock\n%s", strings.Join(modules, "\n"))),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
0600,
); err != nil {
return err
}
log.Ctx(ctx).Debug().Str("mod", p).Msg("vendoring packages")
unpackDir, err := os.MkdirTemp(cuePkgDir, "vendor-*")
if err != nil {
return err
}
defer os.RemoveAll(unpackDir)
if err := extractModules(unpackDir); err != nil {
return err
}
for _, module := range modules {
moduleDir := path.Join(cuePkgDir, module)
backupModuleDir := moduleDir + ".old"
if err := os.RemoveAll(backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
if err := os.Rename(moduleDir, backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
defer os.RemoveAll(backupModuleDir)
if err := os.Rename(path.Join(unpackDir, module), moduleDir); err != nil {
return err
}
}
return nil
}
func extractModules(dest string) error {
return fs.WalkDir(FS, ".", func(p string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
if !entry.Type().IsRegular() {
return nil
}
if filepath.Ext(entry.Name()) != ".cue" {
return nil
}
contents, err := fs.ReadFile(FS, p)
if err != nil {
return fmt.Errorf("%s: %w", p, err)
}
overlayPath := path.Join(dest, p)
if err := os.MkdirAll(filepath.Dir(overlayPath), 0755); err != nil {
return err
}
return os.WriteFile(overlayPath, contents, 0600)
})
}
func getCueModParent() string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
cwd, _ := os.Getwd()
parentDir := cwd
for {
if _, err := os.Stat(path.Join(parentDir, "cue.mod")); !errors.Is(err, os.ErrNotExist) {
break
}
parentDir = filepath.Dir(parentDir)
if parentDir == string(os.PathSeparator) {
parentDir = cwd
break
}
}
return parentDir
}
func cueModInit(ctx context.Context, parentDir string) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,344 |
mod get doesn't work in Europa
|
Since it relies on "projects" (e.g. `.dagger`), `mod get` doesn't work anymore.
|
https://github.com/dagger/dagger/issues/1344
|
https://github.com/dagger/dagger/pull/1519
|
f47d44da79db91905cf7851061087b7231ec0260
|
7b8a637bea7039e2433783b1a2a97c495920beec
| 2022-01-06T01:39:51Z |
go
| 2022-01-28T17:39:25Z |
pkg/pkg.go
|
lg := log.Ctx(ctx)
modDir := path.Join(parentDir, "cue.mod")
modFile := path.Join(modDir, "module.cue")
if _, err := os.Stat(modFile); err != nil {
if !errors.Is(err, os.ErrNotExist) {
return err
}
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
if err := os.WriteFile(modFile, []byte("module: \"\"\n"), 0600); err != nil {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "usr"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "pkg"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,492 |
engine.#Source.path is not properly supporting relative paths
|
In some cases setting `path: "./scripts"` results in 'invalid path' or `path does not exist` errors. It seems it looks for the path to be relative to `cwd` rather than `v.Filename`
|
https://github.com/dagger/dagger/issues/1492
|
https://github.com/dagger/dagger/pull/1527
|
a0c89a335fd02b7de600bc426f40c810df5f8110
|
a850f5453327382d44a315ebf365041434ffc39b
| 2022-01-24T19:49:01Z |
go
| 2022-01-28T23:21:14Z |
plan/task/source.go
|
package task
import (
"context"
"errors"
"fmt"
"io/fs"
"os"
"github.com/moby/buildkit/client/llb"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
)
func init() {
Register("Source", func() Task { return &sourceTask{} })
}
type sourceTask struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,492 |
engine.#Source.path is not properly supporting relative paths
|
In some cases setting `path: "./scripts"` results in 'invalid path' or `path does not exist` errors. It seems it looks for the path to be relative to `cwd` rather than `v.Filename`
|
https://github.com/dagger/dagger/issues/1492
|
https://github.com/dagger/dagger/pull/1527
|
a0c89a335fd02b7de600bc426f40c810df5f8110
|
a850f5453327382d44a315ebf365041434ffc39b
| 2022-01-24T19:49:01Z |
go
| 2022-01-28T23:21:14Z |
plan/task/source.go
|
}
func (c *sourceTask) PreRun(ctx context.Context, pctx *plancontext.Context, v *compiler.Value) error {
path, err := v.Lookup("path").String()
if err != nil {
return err
}
if !fs.ValidPath(path) {
return fmt.Errorf("invalid path %q", path)
}
absPath, err := v.Lookup("path").AbsPath()
if err != nil {
return err
}
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("path %q does not exist", path)
}
pctx.LocalDirs.Add(absPath)
return nil
}
func (c *sourceTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
lg := log.Ctx(ctx)
path, err := v.Lookup("path").AbsPath()
if err != nil {
return nil, err
}
var source struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,492 |
engine.#Source.path is not properly supporting relative paths
|
In some cases setting `path: "./scripts"` results in 'invalid path' or `path does not exist` errors. It seems it looks for the path to be relative to `cwd` rather than `v.Filename`
|
https://github.com/dagger/dagger/issues/1492
|
https://github.com/dagger/dagger/pull/1527
|
a0c89a335fd02b7de600bc426f40c810df5f8110
|
a850f5453327382d44a315ebf365041434ffc39b
| 2022-01-24T19:49:01Z |
go
| 2022-01-28T23:21:14Z |
plan/task/source.go
|
Include []string
Exclude []string
}
if err := v.Decode(&source); err != nil {
return nil, err
}
lg.Debug().Str("path", path).Msg("loading local directory")
opts := []llb.LocalOption{
withCustomName(v, "Embed %s", path),
llb.IncludePatterns(source.Include),
llb.ExcludePatterns(source.Exclude),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,492 |
engine.#Source.path is not properly supporting relative paths
|
In some cases setting `path: "./scripts"` results in 'invalid path' or `path does not exist` errors. It seems it looks for the path to be relative to `cwd` rather than `v.Filename`
|
https://github.com/dagger/dagger/issues/1492
|
https://github.com/dagger/dagger/pull/1527
|
a0c89a335fd02b7de600bc426f40c810df5f8110
|
a850f5453327382d44a315ebf365041434ffc39b
| 2022-01-24T19:49:01Z |
go
| 2022-01-28T23:21:14Z |
plan/task/source.go
|
llb.SessionID(s.SessionID()),
llb.SharedKeyHint(path),
}
st := llb.Scratch().File(
llb.Copy(
llb.Local(
path,
opts...,
),
"/",
"/",
),
withCustomName(v, "Embed %s [copy]", path),
)
result, err := s.Solve(ctx, st, pctx.Platform.Get())
if err != nil {
return nil, err
}
fs := pctx.FS.New(result)
return compiler.NewValue().FillFields(map[string]interface{}{
"output": fs.MarshalCUE(),
})
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,698 |
0.2: hide `dagger completion`
|
The `dagger completion` command is useful, especially for automated installers (homebrew etc). But it should not be visible to humans running `dagger help`. It should be hidden.
|
https://github.com/dagger/dagger/issues/1698
|
https://github.com/dagger/dagger/pull/1748
|
45f3121abeaafd1c56b69eb46608a519080a6a94
|
2b30bd027d52f0f633653d85efaa515fc08a1c1d
| 2022-03-07T22:33:11Z |
go
| 2022-03-10T14:50:10Z |
cmd/dagger/cmd/root.go
|
package cmd
import (
"os"
"strings"
"github.com/moby/buildkit/util/appcontext"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/project"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
var rootCmd = &cobra.Command{
Use: "dagger",
Short: "A programmable deployment system",
}
func init() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,698 |
0.2: hide `dagger completion`
|
The `dagger completion` command is useful, especially for automated installers (homebrew etc). But it should not be visible to humans running `dagger help`. It should be hidden.
|
https://github.com/dagger/dagger/issues/1698
|
https://github.com/dagger/dagger/pull/1748
|
45f3121abeaafd1c56b69eb46608a519080a6a94
|
2b30bd027d52f0f633653d85efaa515fc08a1c1d
| 2022-03-07T22:33:11Z |
go
| 2022-03-10T14:50:10Z |
cmd/dagger/cmd/root.go
|
rootCmd.PersistentFlags().String("log-format", "auto", "Log format (auto, plain, tty, json)")
rootCmd.PersistentFlags().StringP("log-level", "l", "info", "Log level")
rootCmd.PersistentFlags().Bool("no-cache", false, "Disable caching")
rootCmd.PersistentFlags().StringArray("cache-to", []string{},
"Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)")
rootCmd.PersistentFlags().StringArray("cache-from", []string{},
"External cache sources (eg. user/app:cache, type=local,src=path/to/dir)")
rootCmd.PersistentPreRun = func(cmd *cobra.Command, _ []string) {
go checkVersion()
}
rootCmd.PersistentPostRun = func(*cobra.Command, []string) {
warnVersion()
}
rootCmd.AddCommand(
upCmd,
versionCmd,
docCmd,
doCmd,
project.Cmd,
)
if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
panic(err)
}
viper.SetEnvPrefix("dagger")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
}
func Execute() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,698 |
0.2: hide `dagger completion`
|
The `dagger completion` command is useful, especially for automated installers (homebrew etc). But it should not be visible to humans running `dagger help`. It should be hidden.
|
https://github.com/dagger/dagger/issues/1698
|
https://github.com/dagger/dagger/pull/1748
|
45f3121abeaafd1c56b69eb46608a519080a6a94
|
2b30bd027d52f0f633653d85efaa515fc08a1c1d
| 2022-03-07T22:33:11Z |
go
| 2022-03-10T14:50:10Z |
cmd/dagger/cmd/root.go
|
var (
ctx = appcontext.Context()
lg = logger.New()
closer = logger.InitTracing()
span trace.Span
)
if len(os.Args) > 1 {
ctx, span = otel.Tracer("dagger").Start(ctx, os.Args[1])
span.AddEvent("command", trace.WithAttributes(
attribute.String("args", strings.Join(os.Args, " ")),
))
}
defer func() {
if span != nil {
span.End()
}
closer.Close()
}()
if err := rootCmd.ExecuteContext(ctx); err != nil {
lg.Fatal().Err(err).Msg("failed to execute command")
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
package cmd
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"text/tabwriter"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
"cuelang.org/go/cue"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/common"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.dagger.io/dagger/plan"
"go.dagger.io/dagger/solver"
"go.dagger.io/dagger/telemetry"
"golang.org/x/term"
)
var doCmd = &cobra.Command{
Use: "do [OPTIONS] ACTION [SUBACTION...]",
Short: "Execute a dagger action.",
PreRun: func(cmd *cobra.Command, args []string) {
if err := viper.BindPFlags(cmd.Flags()); err != nil {
panic(err)
}
},
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 1 {
doHelpCmd(cmd, nil)
return
}
var (
lg = logger.New()
tty *logger.TTYOutput
err error
)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
if f := viper.GetString("log-format"); f == "tty" || f == "auto" && term.IsTerminal(int(os.Stdout.Fd())) {
tty, err = logger.NewTTYOutput(os.Stderr)
if err != nil {
lg.Fatal().Err(err).Msg("failed to initialize TTY logger")
}
tty.Start()
defer tty.Stop()
lg = lg.Output(tty)
}
ctx := lg.WithContext(cmd.Context())
cl := common.NewClient(ctx)
p, err := loadPlan()
if err != nil {
lg.Fatal().Err(err).Msg("failed to load plan")
}
target := getTargetPath(args)
doneCh := common.TrackCommand(ctx, cmd, &telemetry.Property{
Name: "action",
Value: target.String(),
})
err = cl.Do(ctx, p.Context(), func(ctx context.Context, s solver.Solver) error {
return p.Do(ctx, target, s)
})
<-doneCh
if err != nil {
lg.Fatal().Err(err).Msg("failed to execute plan")
}
},
}
func loadPlan() (*plan.Plan, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
planPath := viper.GetString("plan")
absPlanPath, err := filepath.Abs(planPath)
if err != nil {
return nil, err
}
_, err = os.Stat(absPlanPath)
if err != nil {
return nil, err
}
return plan.Load(context.Background(), plan.Config{
Args: []string{planPath},
With: viper.GetStringSlice("with"),
})
}
func getTargetPath(args []string) cue.Path {
selectors := []cue.Selector{plan.ActionSelector}
for _, arg := range args {
selectors = append(selectors, cue.Str(arg))
}
return cue.MakePath(selectors...)
}
func doHelpCmd(cmd *cobra.Command, _ []string) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
lg := logger.New()
fmt.Printf("%s\n\n%s", cmd.Short, cmd.UsageString())
p, err := loadPlan()
if err != nil {
lg.Fatal().Err(err).Msg("failed to load plan")
}
target := getTargetPath(cmd.Flags().Args())
action := p.Action().FindByPath(target)
if action == nil {
lg.Fatal().Msg(fmt.Sprintf("action %s not found", target.String()))
return
}
if len(action.Name) < 1 {
return
}
fmt.Println("")
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.StripEscape)
defer w.Flush()
for _, a := range action.Children {
if !a.Hidden {
lineParts := []string{"", a.Name, strings.TrimSpace(a.Comment)}
fmt.Fprintln(w, strings.Join(lineParts, "\t"))
}
}
}
func init() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
cmd/dagger/cmd/do.go
|
doCmd.Flags().StringArrayP("with", "w", []string{}, "")
doCmd.Flags().StringP("plan", "p", ".", "Path to plan (defaults to current directory)")
doCmd.Flags().Bool("no-cache", false, "Disable caching")
doCmd.Flags().StringArray("cache-to", []string{},
"Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)")
doCmd.Flags().StringArray("cache-from", []string{},
"External cache sources (eg. user/app:cache, type=local,src=path/to/dir)")
doCmd.SetHelpFunc(doHelpCmd)
if err := viper.BindPFlags(doCmd.Flags()); err != nil {
panic(err)
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
package compiler
import (
"errors"
"path"
"path/filepath"
"sort"
"strconv"
"cuelang.org/go/cue"
"cuelang.org/go/cue/ast"
cueformat "cuelang.org/go/cue/format"
)
type Value struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
val cue.Value
cc *Compiler
}
func (v *Value) FillPath(p cue.Path, x interface{}) error {
v.cc.lock()
defer v.cc.unlock()
if val, ok := x.(*Value); ok {
v.val = v.val.FillPath(p, val.val)
} else {
v.val = v.val.FillPath(p, x)
}
return v.val.Err()
}
func (v *Value) FillFields(values map[string]interface{}) (*Value, error) {
for p, x := range values {
if err := v.FillPath(cue.ParsePath(p), x); err != nil {
return nil, err
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
return v, nil
}
func (v *Value) Fill(value interface{}) (*Value, error) {
if err := v.FillPath(cue.MakePath(), value); err != nil {
return nil, err
}
return v, nil
}
func (v *Value) LookupPath(p cue.Path) *Value {
v.cc.rlock()
defer v.cc.runlock()
return v.cc.Wrap(v.val.LookupPath(p))
}
func (v *Value) Lookup(path string) *Value {
return v.LookupPath(cue.ParsePath(path))
}
func (v *Value) ReferencePath() (*Value, cue.Path) {
vv, p := v.val.ReferencePath()
return v.cc.Wrap(vv), p
}
func (v *Value) Len() cue.Value {
return v.val.Len()
}
func (v *Value) Kind() cue.Kind {
return v.val.Kind()
}
func (v *Value) IncompleteKind() cue.Kind {
return v.Cue().IncompleteKind()
}
type Field struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
Selector cue.Selector
Value *Value
}
func (f Field) Label() string {
l := f.Selector.String()
if unquoted, err := strconv.Unquote(l); err == nil {
return unquoted
}
return l
}
func (v *Value) Fields(opts ...cue.Option) ([]Field, error) {
it, err := v.val.Fields(opts...)
if err != nil {
return nil, err
}
fields := []Field{}
for it.Next() {
fields = append(fields, Field{
Selector: it.Selector(),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
Value: v.cc.Wrap(it.Value()),
})
}
sort.SliceStable(fields, func(i, j int) bool {
return fields[i].Selector.String() < fields[j].Selector.String()
})
return fields, nil
}
func (v *Value) Struct() (*cue.Struct, error) {
return v.val.Struct()
}
func (v *Value) Exists() bool {
return v.val.Exists()
}
func (v *Value) Bytes() ([]byte, error) {
return v.val.Bytes()
}
func (v *Value) String() (string, error) {
return v.val.String()
}
func (v *Value) Int64() (int64, error) {
return v.val.Int64()
}
func (v *Value) Bool() (bool, error) {
return v.val.Bool()
}
func (v *Value) Path() cue.Path {
return v.val.Path()
}
func (v *Value) Decode(x interface{}) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
return v.val.Decode(x)
}
func (v *Value) List() ([]*Value, error) {
l := []*Value{}
it, err := v.val.List()
if err != nil {
return nil, err
}
for it.Next() {
l = append(l, v.cc.Wrap(it.Value()))
}
return l, nil
}
func (v *Value) IsConcrete() bool {
return v.val.IsConcrete()
}
func (v *Value) IsConcreteR(opts ...cue.Option) error {
o := []cue.Option{
cue.All(),
cue.Concrete(true),
cue.Hidden(true),
}
o = append(o, opts...)
return v.val.Validate(o...)
}
func (v *Value) Walk(before func(*Value) bool, after func(*Value)) {
v.cc.rlock()
defer v.cc.runlock()
var (
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
llBefore func(cue.Value) bool
llAfter func(cue.Value)
)
if before != nil {
llBefore = func(child cue.Value) bool {
return before(v.cc.Wrap(child))
}
}
if after != nil {
llAfter = func(child cue.Value) {
after(v.cc.Wrap(child))
}
}
v.val.Walk(llBefore, llAfter)
}
func (v *Value) JSON() JSON {
cuePathToStrings := func(p cue.Path) []string {
selectors := p.Selectors()
out := make([]string, len(selectors))
for i, sel := range selectors {
out[i] = sel.String()
}
return out
}
var out JSON
v.val.Walk(
func(v cue.Value) bool {
b, err := v.MarshalJSON()
if err == nil {
newOut, err := out.Set(b, cuePathToStrings(v.Path())...)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
if err == nil {
out = newOut
}
return false
}
return true
},
nil,
)
out, _ = out.Get(cuePathToStrings(v.Path())...)
return out
}
func (v *Value) Validate() error {
return v.val.Validate()
}
func (v *Value) Source(opts ...cue.Option) ([]byte, error) {
v.cc.rlock()
defer v.cc.runlock()
return cueformat.Node(v.val.Eval().Syntax(opts...),
cueformat.UseSpaces(4),
cueformat.TabIndent(false),
)
}
func (v *Value) Cue() cue.Value {
return v.val
}
func (v *Value) HasAttr(filter ...string) bool {
attrs := v.val.Attributes(cue.ValueAttr)
for _, attr := range attrs {
name := attr.Name()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
if name == "dagger" {
if len(filter) == 0 {
return true
}
for i := 0; i < attr.NumArgs(); i++ {
key, _ := attr.Arg(i)
for _, val := range filter {
if key == val {
return true
}
}
}
}
}
return false
}
func (v *Value) Filename() (string, error) {
pos := v.Cue().Pos()
if !pos.IsValid() {
return "", errors.New("invalid token position")
}
return pos.Filename(), nil
}
func (v *Value) Dirname() (string, error) {
f, err := v.Filename()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
compiler/value.go
|
return "", err
}
return filepath.Dir(f), nil
}
func (v *Value) AbsPath() (string, error) {
p, err := v.String()
if err != nil {
return "", nil
}
if filepath.IsAbs(p) {
return p, nil
}
d, err := v.Dirname()
if err != nil {
return "", err
}
return path.Join(d, p), nil
}
func (v *Value) Dereference() *Value {
dVal := cue.Dereference(v.val)
return v.cc.Wrap(dVal)
}
func (v *Value) Default() (*Value, bool) {
val, hasDef := v.val.Default()
return v.cc.Wrap(val), hasDef
}
func (v *Value) Doc() []*ast.CommentGroup {
return v.Cue().Doc()
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/action.go
|
package plan
import (
"cuelang.org/go/cue"
)
type Action struct {
Name string
Hidden bool
Path cue.Path
Comment string
Children []*Action
}
func (a *Action) AddChild(c *Action) {
a.Children = append(a.Children, c)
}
func (a *Action) FindByPath(path cue.Path) *Action {
queue := []*Action{a}
for len(queue) > 0 {
nextUp := queue[0]
queue = queue[1:]
if nextUp.Path.String() == path.String() {
return nextUp
}
if len(nextUp.Children) > 0 {
queue = append(queue, nextUp.Children...)
}
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
package plan
import (
"context"
"errors"
"fmt"
"strings"
"cuelang.org/go/cue"
cueflow "cuelang.org/go/tools/flow"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/pkg"
"go.dagger.io/dagger/plan/task"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
"go.opentelemetry.io/otel"
)
var (
ErrIncompatiblePlan = errors.New("attempting to load a dagger 0.1.0 project.\nPlease upgrade your config to be compatible with this version of dagger. Contact the Dagger team if you need help")
ActionSelector = cue.Str("actions")
ClientSelector = cue.Str("client")
)
type Plan struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
config Config
context *plancontext.Context
source *compiler.Value
action *Action
}
type Config struct {
Args []string
With []string
Target string
}
func Load(ctx context.Context, cfg Config) (*Plan, error) {
log.Ctx(ctx).Debug().Interface("args", cfg.Args).Msg("loading plan")
_, cueModExists := pkg.GetCueModParent()
if !cueModExists {
return nil, fmt.Errorf("dagger project not found. Run `dagger project init`")
}
v, err := compiler.Build("", nil, cfg.Args...)
if err != nil {
errstring := err.Error()
if strings.Contains(errstring, "cannot find package") {
if strings.Contains(errstring, "alpha.dagger.io") {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
return nil, ErrIncompatiblePlan
} else if strings.Contains(errstring, pkg.DaggerModule) || strings.Contains(errstring, pkg.UniverseModule) {
return nil, fmt.Errorf("%w: running `dagger project update` may resolve this", err)
}
}
return nil, err
}
for i, param := range cfg.With {
log.Ctx(ctx).Debug().Interface("with", param).Msg("compiling overlay")
paramV, err := compiler.Compile(fmt.Sprintf("with%v", i), param)
if err != nil {
return nil, err
}
log.Ctx(ctx).Debug().Interface("with", param).Msg("filling overlay")
fillErr := v.FillPath(cue.MakePath(), paramV)
if fillErr != nil {
return nil, fillErr
}
}
p := &Plan{
config: cfg,
context: plancontext.New(),
source: v,
}
p.fillAction()
if err := p.configPlatform(); err != nil {
return nil, err
}
if err := p.prepare(ctx); err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
}
return p, nil
}
func (p *Plan) Context() *plancontext.Context {
return p.context
}
func (p *Plan) Source() *compiler.Value {
return p.source
}
func (p *Plan) Action() *Action {
return p.action
}
func (p *Plan) configPlatform() error {
platformField := p.source.Lookup("platform")
if !platformField.Exists() {
return nil
}
platform, err := platformField.String()
if err != nil {
return err
}
err = p.context.Platform.Set(platform)
if err != nil {
return err
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
func (p *Plan) prepare(ctx context.Context) error {
flow := cueflow.New(
&cueflow.Config{
FindHiddenTasks: true,
},
p.source.Cue(),
func(flowVal cue.Value) (cueflow.Runner, error) {
v := compiler.Wrap(flowVal)
t, err := task.Lookup(v)
if err != nil {
if err == task.ErrNotTask {
return nil, nil
}
return nil, err
}
r, ok := t.(task.PreRunner)
if !ok {
return nil, nil
}
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
ctx := t.Context()
lg := log.Ctx(ctx).With().Str("task", t.Path().String()).Logger()
ctx = lg.WithContext(ctx)
if err := r.PreRun(ctx, p.context, compiler.Wrap(t.Value())); err != nil {
return fmt.Errorf("%s: %w", t.Path().String(), err)
}
return nil
}), nil
},
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
)
return flow.Run(ctx)
}
func (p *Plan) Do(ctx context.Context, path cue.Path, s solver.Solver) error {
ctx, span := otel.Tracer("dagger").Start(ctx, "plan.Up")
defer span.End()
r := NewRunner(p.context, path, s)
return r.Run(ctx, p.source)
}
func (p *Plan) fillAction() {
cfg := &cueflow.Config{
FindHiddenTasks: true,
Root: cue.MakePath(ActionSelector),
}
flow := cueflow.New(
cfg,
p.source.Cue(),
noOpRunner,
)
p.action = &Action{
Name: ActionSelector.String(),
Hidden: false,
Path: cue.MakePath(ActionSelector),
Children: []*Action{},
}
actions := p.source.LookupPath(cue.MakePath(ActionSelector))
if !actions.Exists() {
return
}
for _, cg := range actions.Doc() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,777 |
`dagger do --help`: cleaner formatting of available action list
|
## Problem
When listing available actions with `dagger do --help`, the formatting is messy.
* Multi-line comments are printed as is
* No "Available Options" section header
* Misaligned descriptions
* Easy to miss actions at the end
Example, running from the root of dagger repo:
```
$ dagger version
dagger devel (7b4b5915) linux/amd64
```
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
build Go build the dagger binary
depends on goLint and goTest to complete successfully
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
```
## Solution
* Only print first line of comment
* Add "Available Options" section header
* Fix description alignment
* Move actions to the top
Same example:
```
$ dagger do --help
Execute a dagger action.
Usage:
dagger do [OPTIONS] ACTION [SUBACTION...] [flags]
Available Actions:
build Go build the dagger binary
goTest Go unit tests
goLint Go lint using golangci-lint
cueLint CUE lint
Flags:
--cache-from stringArray External cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-to stringArray Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir)
-h, --help help for do
--no-cache Disable caching
-p, --plan string Path to plan (defaults to current directory) (default ".")
-w, --with stringArray
Global Flags:
--log-format string Log format (auto, plain, tty, json) (default "auto")
-l, --log-level string Log level (default "info")
```
|
https://github.com/dagger/dagger/issues/1777
|
https://github.com/dagger/dagger/pull/1782
|
35751bc2123174b73715c332c175e8bb63b1ff6f
|
21c6af067836ce33d9c1f5bcb06c68ab0448d403
| 2022-03-11T08:21:50Z |
go
| 2022-03-14T19:56:43Z |
plan/plan.go
|
p.action.Comment += cg.Text()
}
tasks := flow.Tasks()
for _, t := range tasks {
var q []cue.Selector
prevAction := p.action
for _, s := range t.Path().Selectors() {
q = append(q, s)
path := cue.MakePath(q...)
a := prevAction.FindByPath(path)
if a == nil {
v := p.Source().LookupPath(path)
childComment := ""
for _, cg := range v.Doc() {
childComment += cg.Text()
}
a = &Action{
Name: s.String(),
Hidden: s.PkgPath() != "",
Path: path,
Comment: childComment,
Children: []*Action{},
}
prevAction.AddChild(a)
}
prevAction = a
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
cmd/dagger/cmd/common/track.go
|
package common
import (
"context"
"crypto/sha256"
"fmt"
"strings"
"github.com/go-git/go-git/v5"
"github.com/spf13/cobra"
"go.dagger.io/dagger/pkg"
"go.dagger.io/dagger/telemetry"
)
func TrackCommand(ctx context.Context, cmd *cobra.Command, props ...*telemetry.Property) chan struct{} {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
cmd/dagger/cmd/common/track.go
|
props = append([]*telemetry.Property{
{
Name: "command",
Value: commandName(cmd),
},
}, props...)
if repo := gitRepoURL("."); repo != "" {
props = append(props, &telemetry.Property{
Name: "git_repository_hash",
Value: hash(repo),
})
}
if projectDir, found := pkg.GetCueModParent(); found {
props = append(props, &telemetry.Property{
Name: "project_path_hash",
Value: hash(projectDir),
})
}
return telemetry.TrackAsync(ctx, "Command Executed", props...)
}
func commandName(cmd *cobra.Command) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
cmd/dagger/cmd/common/track.go
|
parts := []string{}
for c := cmd; c.Parent() != nil; c = c.Parent() {
parts = append([]string{c.Name()}, parts...)
}
return strings.Join(parts, " ")
}
func hash(s string) string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(s)))
}
func gitRepoURL(path string) string {
repo, err := git.PlainOpenWithOptions(path, &git.PlainOpenOptions{
DetectDotGit: true,
})
if err != nil {
return ""
}
origin, err := repo.Remote("origin")
if err != nil {
return ""
}
if urls := origin.Config().URLs; len(urls) > 0 {
return urls[0]
}
return ""
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
telemetry/telemetry.go
|
package telemetry
import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"os"
"path/filepath"
"runtime"
"time"
"github.com/google/uuid"
"github.com/mitchellh/go-homedir"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/version"
)
const (
apiKey = "cb9777c166aefe4b77b31f961508191c"
telemetryURL = "https://t.dagger.io/v1"
)
type Property struct {
Name string
Value interface{}
}
func TrackAsync(ctx context.Context, eventName string, properties ...*Property) chan struct{} {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
telemetry/telemetry.go
|
doneCh := make(chan struct{}, 1)
go func() {
defer close(doneCh)
Track(ctx, eventName, properties...)
}()
return doneCh
}
func Track(ctx context.Context, eventName string, properties ...*Property) {
lg := log.Ctx(ctx).
With().
Str("event", eventName).
Logger()
if telemetryDisabled() || isCI() {
return
}
deviceID, err := getDeviceID()
if err != nil {
lg.Trace().Err(err).Msg("failed to get device id")
return
}
props := map[string]interface{}{
"dagger_version": version.Version,
"dagger_revision": version.Revision,
"os": runtime.GOOS,
"arch": runtime.GOARCH,
}
for _, p := range properties {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
telemetry/telemetry.go
|
props[p.Name] = p.Value
}
lg = lg.With().Fields(props).Logger()
ev := &event{
DeviceID: deviceID,
EventType: eventName,
Time: time.Now().Unix(),
AppVersion: version.Version,
OSName: runtime.GOOS,
Platform: runtime.GOARCH,
IP: "$remote",
EventProperties: props,
}
p := &payload{
APIKey: apiKey,
Events: []*event{ev},
}
b := new(bytes.Buffer)
if err := json.NewEncoder(b).Encode(p); err != nil {
lg.Trace().Err(err).Msg("failed to encode payload")
return
}
req, err := http.NewRequest("POST", telemetryURL, b)
if err != nil {
lg.Trace().Err(err).Msg("failed to prepare request")
}
req.Header = map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"*/*"},
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
telemetry/telemetry.go
|
start := time.Now()
resp, err := http.DefaultClient.Do(req)
if err != nil {
lg.Trace().Err(err).Msg("failed to send telemetry event")
return
}
resp.Body.Close()
if resp.StatusCode != http.StatusOK {
lg.Trace().Str("status", resp.Status).Msg("telemetry request failed")
return
}
lg.Trace().Dur("duration", time.Since(start)).Msg("telemetry event")
}
type payload struct {
APIKey string `json:"api_key,omitempty"`
Events []*event `json:"events"`
}
type event struct {
UserID string `json:"user_id,omitempty"`
DeviceID string `json:"device_id,omitempty"`
EventType string `json:"event_type,omitempty"`
Time int64 `json:"time,omitempty"`
AppVersion string `json:"app_version,omitempty"`
Platform string `json:"platform,omitempty"`
OSName string `json:"os_name,omitempty"`
OSVersion string `json:"os_version,omitempty"`
IP string `json:"ip,omitempty"`
EventProperties map[string]interface{} `json:"event_properties,omitempty"`
}
func isCI() bool {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,205 |
Include CI runners in analytics
|
Currently `dagger` sends basic analytics on long-running commands (this can be disabled with the semi-standard DO_NOT_TRACK environment variable). But not all commands are included in the analytics: commands run in a CI environment (according to best-effort heuristics) are entirely skipped. This results in an analytics blind spot: basically we donβt know anything about real-world usage of Dagger in CI. This is a major problem because we are positioning Dagger as a portable development kit for CICD: running in CI environments is a major use case.
There is a good reason for not sending these events: they produce noisier data because they do not include a stable engine ID. So every individual run looks like an entirely new engine.
This is a valid concern but there is a better way to address it: when a CI environment is detected, add a special `ci: true` attribute to the event, and send it. The analytics service can either filter out these CI events (same behavior as today) or use them for new queries. Unlike today, we would have the choice.
|
https://github.com/dagger/dagger/issues/1205
|
https://github.com/dagger/dagger/pull/1801
|
a406b15ef403ca55bbac98807b151b763fab2029
|
e9d3b2fd15569e9b4ae66c2504d4c8439a810077
| 2021-12-11T03:26:40Z |
go
| 2022-03-14T23:11:26Z |
telemetry/telemetry.go
|
return os.Getenv("CI") != "" ||
os.Getenv("BUILD_NUMBER") != "" ||
os.Getenv("RUN_ID") != ""
}
func telemetryDisabled() bool {
return os.Getenv("DAGGER_TELEMETRY_DISABLE") != "" ||
os.Getenv("DO_NOT_TRACK") != ""
}
func getDeviceID() (string, error) {
idFile, err := homedir.Expand("~/.config/dagger/cli_id")
if err != nil {
return "", err
}
id, err := os.ReadFile(idFile)
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
return "", err
}
if err := os.MkdirAll(filepath.Dir(idFile), 0755); err != nil {
return "", err
}
id = []byte(uuid.New().String())
if err := os.WriteFile(idFile, id, 0600); err != nil {
return "", err
}
}
return string(id), nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,802 |
Platform unknown for images built with dagger
|
When building images with dagger, I get a warning when running them:
```
WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/amd64) and no specific platform was requested
```
It still runs though. I'm using Docker Desktop on macOS.
Example inspect from a Dockerfile built in dagger:
```json
[
{
"Comment": "buildkit.exporter.image.v0",
"Architecture": "",
"Os": "linux",
}
]
```
This is the same Dockerfile, but with `docker build`:
```json
[
{
"Comment": "buildkit.dockerfile.v0",
"Architecture": "amd64",
"Os": "linux",
}
]
```
The issue may be in `dagger.#Push`.
|
https://github.com/dagger/dagger/issues/1802
|
https://github.com/dagger/dagger/pull/1827
|
30cbc64d86e8245cdf9edb2079cb610e5a3d68b4
|
e484477bf9e640e528e980e47193e8d7908449f8
| 2022-03-14T19:52:06Z |
go
| 2022-03-22T17:55:22Z |
plan/task/push.go
|
package task
import (
"context"
"fmt"
"github.com/docker/distribution/reference"
bk "github.com/moby/buildkit/client"
"github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
)
func init() {
Register("Push", func() Task { return &pushTask{} })
}
type pushTask struct {
}
func (c *pushTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
lg := log.Ctx(ctx)
rawDest, err := v.Lookup("dest").String()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,802 |
Platform unknown for images built with dagger
|
When building images with dagger, I get a warning when running them:
```
WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/amd64) and no specific platform was requested
```
It still runs though. I'm using Docker Desktop on macOS.
Example inspect from a Dockerfile built in dagger:
```json
[
{
"Comment": "buildkit.exporter.image.v0",
"Architecture": "",
"Os": "linux",
}
]
```
This is the same Dockerfile, but with `docker build`:
```json
[
{
"Comment": "buildkit.dockerfile.v0",
"Architecture": "amd64",
"Os": "linux",
}
]
```
The issue may be in `dagger.#Push`.
|
https://github.com/dagger/dagger/issues/1802
|
https://github.com/dagger/dagger/pull/1827
|
30cbc64d86e8245cdf9edb2079cb610e5a3d68b4
|
e484477bf9e640e528e980e47193e8d7908449f8
| 2022-03-14T19:52:06Z |
go
| 2022-03-22T17:55:22Z |
plan/task/push.go
|
return nil, err
}
dest, err := reference.ParseNormalizedNamed(rawDest)
if err != nil {
return nil, fmt.Errorf("failed to parse ref %s: %w", rawDest, err)
}
dest = reference.TagNameOnly(dest)
if auth := v.Lookup("auth"); auth.Exists() {
a, err := decodeAuthValue(pctx, auth)
if err != nil {
return nil, err
}
target, err := solver.ParseAuthHost(rawDest)
if err != nil {
return nil, err
}
s.AddCredentials(target, a.Username, a.Secret.PlainText())
lg.Debug().Str("target", target).Msg("add target credentials")
}
input, err := pctx.FS.FromValue(v.Lookup("input"))
if err != nil {
return nil, err
}
st, err := input.State()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,802 |
Platform unknown for images built with dagger
|
When building images with dagger, I get a warning when running them:
```
WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/amd64) and no specific platform was requested
```
It still runs though. I'm using Docker Desktop on macOS.
Example inspect from a Dockerfile built in dagger:
```json
[
{
"Comment": "buildkit.exporter.image.v0",
"Architecture": "",
"Os": "linux",
}
]
```
This is the same Dockerfile, but with `docker build`:
```json
[
{
"Comment": "buildkit.dockerfile.v0",
"Architecture": "amd64",
"Os": "linux",
}
]
```
The issue may be in `dagger.#Push`.
|
https://github.com/dagger/dagger/issues/1802
|
https://github.com/dagger/dagger/pull/1827
|
30cbc64d86e8245cdf9edb2079cb610e5a3d68b4
|
e484477bf9e640e528e980e47193e8d7908449f8
| 2022-03-14T19:52:06Z |
go
| 2022-03-22T17:55:22Z |
plan/task/push.go
|
return nil, err
}
imageConfig := ImageConfig{}
if err := v.Lookup("config").Decode(&imageConfig); err != nil {
return nil, err
}
lg.Debug().Str("dest", dest.String()).Msg("export image")
resp, err := s.Export(ctx, st, &dockerfile2llb.Image{Config: imageConfig.ToSpec()}, bk.ExportEntry{
Type: bk.ExporterImage,
Attrs: map[string]string{
"name": dest.String(),
"push": "true",
},
}, pctx.Platform.Get())
if err != nil {
return nil, err
}
digest, hasImageDigest := resp.ExporterResponse["containerimage.digest"]
if !hasImageDigest {
return nil, fmt.Errorf("image push target %q did not return an image digest", dest.String())
}
imageRef := fmt.Sprintf("%s@%s", resp.ExporterResponse["image.name"], digest)
return compiler.NewValue().FillFields(map[string]interface{}{
"result": imageRef,
})
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
package pkg
import (
"context"
"embed"
"errors"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
"github.com/gofrs/flock"
"github.com/rs/zerolog/log"
)
var (
FS embed.FS
)
var (
DaggerModule = "dagger.io"
UniverseModule = "universe.dagger.io"
modules = []string{
DaggerModule,
UniverseModule,
}
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
DaggerCorePackage = fmt.Sprintf("%s/core", DaggerPackage)
lockFilePath = "dagger.lock"
)
func Vendor(ctx context.Context, p string) error {
if p == "" {
p, _ = GetCueModParent()
}
cuePkgDir := path.Join(p, "cue.mod", "pkg")
if err := os.MkdirAll(cuePkgDir, 0755); err != nil {
return err
}
lockFile := path.Join(cuePkgDir, lockFilePath)
l := flock.New(lockFile)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
if err := l.Lock(); err != nil {
return err
}
defer func() {
l.Unlock()
os.Remove(lockFile)
}()
if err := CueModInit(ctx, p, ""); err != nil {
return err
}
gitignorePath := path.Join(cuePkgDir, ".gitignore")
if contents, err := ioutil.ReadFile(gitignorePath); err == nil {
if strings.HasPrefix(string(contents), "# generated by dagger") {
os.Remove(gitignorePath)
}
}
if err := os.WriteFile(
path.Join(cuePkgDir, ".gitattributes"),
[]byte("# generated by dagger\n** linguist-generated=true\n"),
0600,
); err != nil {
return err
}
log.Ctx(ctx).Debug().Str("mod", p).Msg("vendoring packages")
unpackDir, err := os.MkdirTemp(cuePkgDir, "vendor-*")
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
return err
}
defer os.RemoveAll(unpackDir)
if err := extractModules(unpackDir); err != nil {
return err
}
for _, module := range modules {
moduleDir := path.Join(cuePkgDir, module)
backupModuleDir := moduleDir + ".old"
if err := os.RemoveAll(backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
if err := os.Rename(moduleDir, backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
defer os.RemoveAll(backupModuleDir)
if err := os.Rename(path.Join(unpackDir, module), moduleDir); err != nil {
return err
}
}
return nil
}
func extractModules(dest string) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
return fs.WalkDir(FS, ".", func(p string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
if !entry.Type().IsRegular() {
return nil
}
if strings.Contains(p, "cue.mod/pkg") {
return nil
}
contents, err := fs.ReadFile(FS, p)
if err != nil {
return fmt.Errorf("%s: %w", p, err)
}
overlayPath := path.Join(dest, p)
if err := os.MkdirAll(filepath.Dir(overlayPath), 0755); err != nil {
return err
}
return os.WriteFile(overlayPath, contents, 0700)
})
}
func GetCueModParent() (string, bool) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
cwd, _ := os.Getwd()
parentDir := cwd
found := false
for {
if _, err := os.Stat(path.Join(parentDir, "cue.mod")); !errors.Is(err, os.ErrNotExist) {
found = true
break
}
parentDir = filepath.Dir(parentDir)
if parentDir == string(os.PathSeparator) {
parentDir = cwd
break
}
}
return parentDir, found
}
func CueModInit(ctx context.Context, parentDir, module string) error {
lg := log.Ctx(ctx)
absParentDir, err := filepath.Abs(parentDir)
if err != nil {
return err
}
modDir := path.Join(absParentDir, "cue.mod")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,848 |
`dagger do` on uninitialized plans hang on Windows
|
# Problem
Uninitialized projects hang on Windows, not on Mac
# Context
While trying to export the improvement of the `todoapp` from @marcosnils', I copied the `todoapp` (and only this one) to another directory. Running `dagger do build` inside this directory made it hang indefinitely in Windows, and errors on Mac:
_Mac_
```
4:21PM FTL failed to load plan: import failed: cannot find package "dagger.io/dagger":
/tmp/todoapp/netlify.cue:4:2
: running `dagger project update` may resolve this
```
_Windows_
```
dagger.exe do build -p .\todoapp\netlify.cue --log-level debug --log-format plain
3:47PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.10.0
```
# Repro
On windows:
```
git clone https://github.com/dagger/dagger
cd dagger
git checkout v0.2.0
cp pkg/universe.dagger.io/examples/todoapp /tmp
cd /tmp/todoapp
dagger do build
```
Related to:
- https://github.com/dagger/dagger/issues/1796
- https://github.com/dagger/dagger/issues/1820
|
https://github.com/dagger/dagger/issues/1848
|
https://github.com/dagger/dagger/pull/1910
|
f4c9cd663a503740ca1957b85b7ebac96d681c6a
|
ea59c932bb11da344f4ec0ef387e1d944bc77586
| 2022-03-24T15:31:27Z |
go
| 2022-03-29T01:29:38Z |
pkg/pkg.go
|
if err := os.MkdirAll(modDir, 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
modFile := path.Join(modDir, "module.cue")
if _, err := os.Stat(modFile); err != nil {
statErr, ok := err.(*os.PathError)
if !ok {
return statErr
}
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
contents := fmt.Sprintf(`module: "%s"`, module)
if err := os.WriteFile(modFile, []byte(contents), 0600); err != nil {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "usr"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "pkg"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,977 |
π dagger hangs if a file is supplied to client filesystem read set as dagger.#FS
|
### What is the issue?
When using a file instead of a directory as the input of `dagger.#FS`, dagger hangs.
### Log output
N/A
### Steps to reproduce
Create a dagger with the following plan file and run `dagger do test` to reproduce.
```test.cue
package main
import (
"dagger.io/dagger"
)
dagger.#Plan & {
client: filesystem: "somefile.txt": read: contents: dagger.#FS
actions: test: {
}
}
```
### Dagger version
0.2.4
### OS version
Linux tp 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
https://github.com/dagger/dagger/issues/1977
|
https://github.com/dagger/dagger/pull/1979
|
b482c19b7c2e2999b841cdffa6108fdb858331db
|
d00fbff9d50026584beb20ee10e22f405e8d4656
| 2022-03-31T20:26:37Z |
go
| 2022-04-01T18:17:50Z |
plan/task/clientfilesystemread.go
|
package task
import (
"context"
"errors"
"fmt"
"os"
"cuelang.org/go/cue"
"github.com/moby/buildkit/client/llb"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
)
func init() {
Register("ClientFilesystemRead", func() Task { return &clientFilesystemReadTask{} })
}
type clientFilesystemReadTask struct {
}
func (t clientFilesystemReadTask) PreRun(_ context.Context, pctx *plancontext.Context, v *compiler.Value) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,977 |
π dagger hangs if a file is supplied to client filesystem read set as dagger.#FS
|
### What is the issue?
When using a file instead of a directory as the input of `dagger.#FS`, dagger hangs.
### Log output
N/A
### Steps to reproduce
Create a dagger with the following plan file and run `dagger do test` to reproduce.
```test.cue
package main
import (
"dagger.io/dagger"
)
dagger.#Plan & {
client: filesystem: "somefile.txt": read: contents: dagger.#FS
actions: test: {
}
}
```
### Dagger version
0.2.4
### OS version
Linux tp 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
https://github.com/dagger/dagger/issues/1977
|
https://github.com/dagger/dagger/pull/1979
|
b482c19b7c2e2999b841cdffa6108fdb858331db
|
d00fbff9d50026584beb20ee10e22f405e8d4656
| 2022-03-31T20:26:37Z |
go
| 2022-04-01T18:17:50Z |
plan/task/clientfilesystemread.go
|
path, err := t.parsePath(v)
if err != nil {
return err
}
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("path %q does not exist", path)
}
if plancontext.IsFSValue(v.Lookup("contents")) {
pctx.LocalDirs.Add(path)
}
return nil
}
func (t clientFilesystemReadTask) Run(ctx context.Context, pctx *plancontext.Context, s *solver.Solver, v *compiler.Value) (*compiler.Value, error) {
path, err := t.parsePath(v)
if err != nil {
return nil, err
}
contents, err := t.readContents(ctx, pctx, s, v, path)
if err != nil {
return nil, err
}
return compiler.NewValue().FillFields(map[string]interface{}{
"contents": contents,
})
}
func (t clientFilesystemReadTask) parsePath(v *compiler.Value) (path string, err error) {
path, err = v.Lookup("path").String()
if err != nil {
return
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,977 |
π dagger hangs if a file is supplied to client filesystem read set as dagger.#FS
|
### What is the issue?
When using a file instead of a directory as the input of `dagger.#FS`, dagger hangs.
### Log output
N/A
### Steps to reproduce
Create a dagger with the following plan file and run `dagger do test` to reproduce.
```test.cue
package main
import (
"dagger.io/dagger"
)
dagger.#Plan & {
client: filesystem: "somefile.txt": read: contents: dagger.#FS
actions: test: {
}
}
```
### Dagger version
0.2.4
### OS version
Linux tp 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
https://github.com/dagger/dagger/issues/1977
|
https://github.com/dagger/dagger/pull/1979
|
b482c19b7c2e2999b841cdffa6108fdb858331db
|
d00fbff9d50026584beb20ee10e22f405e8d4656
| 2022-03-31T20:26:37Z |
go
| 2022-04-01T18:17:50Z |
plan/task/clientfilesystemread.go
|
if plancontext.IsServiceValue(v.Lookup("contents")) {
return
}
path, err = clientFilePath(path)
return
}
func (t clientFilesystemReadTask) readContents(ctx context.Context, pctx *plancontext.Context, s *solver.Solver, v *compiler.Value, path string) (interface{}, error) {
lg := log.Ctx(ctx)
contents := v.Lookup("contents")
if plancontext.IsFSValue(contents) {
lg.Debug().Str("path", path).Msg("loading local directory")
return t.readFS(ctx, pctx, s, v, path)
}
if plancontext.IsSecretValue(contents) {
lg.Debug().Str("path", path).Msg("loading local secret file")
return t.readSecret(pctx, path)
}
if contents.IsConcrete() {
return nil, fmt.Errorf("unexpected concrete value, please use a type")
}
k := contents.IncompleteKind()
if k == cue.StringKind {
lg.Debug().Str("path", path).Msg("loading local file")
return t.readString(path)
}
return nil, fmt.Errorf("unsupported type %q", k)
}
func (t clientFilesystemReadTask) readFS(ctx context.Context, pctx *plancontext.Context, s *solver.Solver, v *compiler.Value, path string) (*compiler.Value, error) {
var dir struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,977 |
π dagger hangs if a file is supplied to client filesystem read set as dagger.#FS
|
### What is the issue?
When using a file instead of a directory as the input of `dagger.#FS`, dagger hangs.
### Log output
N/A
### Steps to reproduce
Create a dagger with the following plan file and run `dagger do test` to reproduce.
```test.cue
package main
import (
"dagger.io/dagger"
)
dagger.#Plan & {
client: filesystem: "somefile.txt": read: contents: dagger.#FS
actions: test: {
}
}
```
### Dagger version
0.2.4
### OS version
Linux tp 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
https://github.com/dagger/dagger/issues/1977
|
https://github.com/dagger/dagger/pull/1979
|
b482c19b7c2e2999b841cdffa6108fdb858331db
|
d00fbff9d50026584beb20ee10e22f405e8d4656
| 2022-03-31T20:26:37Z |
go
| 2022-04-01T18:17:50Z |
plan/task/clientfilesystemread.go
|
Include []string
Exclude []string
}
if err := v.Decode(&dir); err != nil {
return nil, err
}
opts := []llb.LocalOption{
withCustomName(v, "Local %s", path),
llb.SessionID(s.SessionID()),
llb.SharedKeyHint(path),
}
if len(dir.Include) > 0 {
opts = append(opts, llb.IncludePatterns(dir.Include))
}
excludePatterns := []string{"**/.dagger/"}
if len(dir.Exclude) > 0 {
excludePatterns = dir.Exclude
}
opts = append(opts, llb.ExcludePatterns(excludePatterns))
st := llb.Scratch().File(
llb.Copy(
llb.Local(
path,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,977 |
π dagger hangs if a file is supplied to client filesystem read set as dagger.#FS
|
### What is the issue?
When using a file instead of a directory as the input of `dagger.#FS`, dagger hangs.
### Log output
N/A
### Steps to reproduce
Create a dagger with the following plan file and run `dagger do test` to reproduce.
```test.cue
package main
import (
"dagger.io/dagger"
)
dagger.#Plan & {
client: filesystem: "somefile.txt": read: contents: dagger.#FS
actions: test: {
}
}
```
### Dagger version
0.2.4
### OS version
Linux tp 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
|
https://github.com/dagger/dagger/issues/1977
|
https://github.com/dagger/dagger/pull/1979
|
b482c19b7c2e2999b841cdffa6108fdb858331db
|
d00fbff9d50026584beb20ee10e22f405e8d4656
| 2022-03-31T20:26:37Z |
go
| 2022-04-01T18:17:50Z |
plan/task/clientfilesystemread.go
|
opts...,
),
"/",
"/",
),
withCustomName(v, "Local %s [copy]", path),
)
result, err := s.Solve(ctx, st, pctx.Platform.Get())
if err != nil {
return nil, err
}
fs := pctx.FS.New(result)
return fs.MarshalCUE(), nil
}
func (t clientFilesystemReadTask) readSecret(pctx *plancontext.Context, path string) (*compiler.Value, error) {
contents, err := t.readString(path)
if err != nil {
return nil, err
}
secret := pctx.Secrets.New(contents)
return secret.MarshalCUE(), nil
}
func (t clientFilesystemReadTask) readString(path string) (string, error) {
contents, err := os.ReadFile(path)
if err != nil {
return "", err
}
return string(contents), nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,003 |
π ~ is not expanded in --cache-to and --cache-from switches
|
### What is the issue?
I run this:
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
and in current directory new folder was create that was named `~`.
dagger should expand ~ to current user home folder path.
### Log output
nothing in logs
### Steps to reproduce
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
### Dagger version
0.2.4
### OS version
ubuntu 21.10
|
https://github.com/dagger/dagger/issues/2003
|
https://github.com/dagger/dagger/pull/2006
|
d934522c385a41ed45efe657d4920daf2656aaa2
|
e00b3c20680a664bf83fdedb7f126abedc8f4e03
| 2022-04-03T05:35:59Z |
go
| 2022-04-12T11:21:11Z |
cmd/dagger/cmd/common/common.go
|
package common
import (
"context"
"fmt"
"strings"
"cuelang.org/go/cue"
"github.com/containerd/containerd/platforms"
"github.com/docker/buildx/util/buildflags"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"go.dagger.io/dagger/client"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext"
)
func FormatValue(val *compiler.Value) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,003 |
π ~ is not expanded in --cache-to and --cache-from switches
|
### What is the issue?
I run this:
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
and in current directory new folder was create that was named `~`.
dagger should expand ~ to current user home folder path.
### Log output
nothing in logs
### Steps to reproduce
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
### Dagger version
0.2.4
### OS version
ubuntu 21.10
|
https://github.com/dagger/dagger/issues/2003
|
https://github.com/dagger/dagger/pull/2006
|
d934522c385a41ed45efe657d4920daf2656aaa2
|
e00b3c20680a664bf83fdedb7f126abedc8f4e03
| 2022-04-03T05:35:59Z |
go
| 2022-04-12T11:21:11Z |
cmd/dagger/cmd/common/common.go
|
switch {
case val.HasAttr("artifact"):
return "dagger.#Artifact"
case plancontext.IsSecretValue(val):
return "dagger.#Secret"
case plancontext.IsFSValue(val):
return "dagger.#FS"
case plancontext.IsServiceValue(val):
return "dagger.#Socket"
}
if val.IsConcreteR() != nil {
return val.IncompleteKind().String()
}
if val.IncompleteKind() == cue.StructKind {
return "struct"
}
valStr := fmt.Sprintf("%v", val.Cue())
return strings.ReplaceAll(valStr, "\n", "\\n")
}
func ValueDocFull(val *compiler.Value) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,003 |
π ~ is not expanded in --cache-to and --cache-from switches
|
### What is the issue?
I run this:
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
and in current directory new folder was create that was named `~`.
dagger should expand ~ to current user home folder path.
### Log output
nothing in logs
### Steps to reproduce
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
### Dagger version
0.2.4
### OS version
ubuntu 21.10
|
https://github.com/dagger/dagger/issues/2003
|
https://github.com/dagger/dagger/pull/2006
|
d934522c385a41ed45efe657d4920daf2656aaa2
|
e00b3c20680a664bf83fdedb7f126abedc8f4e03
| 2022-04-03T05:35:59Z |
go
| 2022-04-12T11:21:11Z |
cmd/dagger/cmd/common/common.go
|
docs := []string{}
for _, c := range val.Doc() {
docs = append(docs, c.Text())
}
doc := strings.TrimSpace(strings.Join(docs, "\n"))
if len(doc) == 0 {
return "-"
}
return doc
}
func ValueDocOneLine(val *compiler.Value) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,003 |
π ~ is not expanded in --cache-to and --cache-from switches
|
### What is the issue?
I run this:
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
and in current directory new folder was create that was named `~`.
dagger should expand ~ to current user home folder path.
### Log output
nothing in logs
### Steps to reproduce
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
### Dagger version
0.2.4
### OS version
ubuntu 21.10
|
https://github.com/dagger/dagger/issues/2003
|
https://github.com/dagger/dagger/pull/2006
|
d934522c385a41ed45efe657d4920daf2656aaa2
|
e00b3c20680a664bf83fdedb7f126abedc8f4e03
| 2022-04-03T05:35:59Z |
go
| 2022-04-12T11:21:11Z |
cmd/dagger/cmd/common/common.go
|
docs := []string{}
for _, c := range val.Doc() {
docs = append(docs, strings.TrimSpace(c.Text()))
}
doc := strings.Join(docs, " ")
lines := strings.Split(doc, "\n")
docs = []string{}
for _, line := range lines {
if strings.HasPrefix(line, "FIXME: ") ||
strings.HasPrefix(line, "TODO: ") ||
strings.HasPrefix(line, "INTERNAL: ") {
continue
}
if len(line) == 0 {
continue
}
docs = append(docs, line)
}
if len(docs) == 0 {
return "-"
}
return strings.Join(docs, " ")
}
func NewClient(ctx context.Context) *client.Client {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,003 |
π ~ is not expanded in --cache-to and --cache-from switches
|
### What is the issue?
I run this:
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
and in current directory new folder was create that was named `~`.
dagger should expand ~ to current user home folder path.
### Log output
nothing in logs
### Steps to reproduce
```console
dagger do build --cache-from type=local,src=~/cc --cache-to type=local,mode=max,dest=~/cc
```
### Dagger version
0.2.4
### OS version
ubuntu 21.10
|
https://github.com/dagger/dagger/issues/2003
|
https://github.com/dagger/dagger/pull/2006
|
d934522c385a41ed45efe657d4920daf2656aaa2
|
e00b3c20680a664bf83fdedb7f126abedc8f4e03
| 2022-04-03T05:35:59Z |
go
| 2022-04-12T11:21:11Z |
cmd/dagger/cmd/common/common.go
|
lg := log.Ctx(ctx)
cacheExports, err := buildflags.ParseCacheEntry(viper.GetStringSlice("cache-to"))
if err != nil {
lg.Fatal().Err(err).Msg("unable to parse --cache-to options")
}
cacheImports, err := buildflags.ParseCacheEntry(viper.GetStringSlice("cache-from"))
if err != nil {
lg.Fatal().Err(err).Msg("unable to parse --cache-from options")
}
ep := viper.GetString("platform")
var p *specs.Platform
if len(ep) > 0 {
pp, err := platforms.Parse(ep)
if err != nil {
lg.Fatal().Err(err).Msg("invalid value for --platform")
}
p = &pp
}
cl, err := client.New(ctx, "", client.Config{
CacheExports: cacheExports,
CacheImports: cacheImports,
NoCache: viper.GetBool("no-cache"),
TargetPlatform: p,
})
if err != nil {
lg.Fatal().Err(err).Msg("unable to create client")
}
return cl
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,689 |
Do not show commandconn WARN messages on the first dagger run
|
When `dagger` runs for the first time against a local Docker Engine, it shows the following `WARN` messages:
```
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseRead: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
```
This is a bad first experience, and we should improve our first impression.
Point-in-time capture of the latest `dagger` dev version behaviour (pre `0.2.0-beta.1`)
<img width="863" alt="image" src="https://user-images.githubusercontent.com/3342/156835873-b3b92bd5-747c-4b24-bc75-3a778ee47435.png">
|
https://github.com/dagger/dagger/issues/1689
|
https://github.com/dagger/dagger/pull/2161
|
464c7ad708ba93e15df08d71ab3f552539b243f6
|
991c8dc6ff4538b55fe82af42a2d5bd93d5bf256
| 2022-03-04T20:20:02Z |
go
| 2022-04-13T01:11:05Z |
cmd/dagger/cmd/root.go
|
package cmd
import (
"os"
"strings"
"github.com/moby/buildkit/util/appcontext"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/project"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
var rootCmd = &cobra.Command{
Use: "dagger",
Short: "A programmable deployment system",
}
func init() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,689 |
Do not show commandconn WARN messages on the first dagger run
|
When `dagger` runs for the first time against a local Docker Engine, it shows the following `WARN` messages:
```
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseRead: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
```
This is a bad first experience, and we should improve our first impression.
Point-in-time capture of the latest `dagger` dev version behaviour (pre `0.2.0-beta.1`)
<img width="863" alt="image" src="https://user-images.githubusercontent.com/3342/156835873-b3b92bd5-747c-4b24-bc75-3a778ee47435.png">
|
https://github.com/dagger/dagger/issues/1689
|
https://github.com/dagger/dagger/pull/2161
|
464c7ad708ba93e15df08d71ab3f552539b243f6
|
991c8dc6ff4538b55fe82af42a2d5bd93d5bf256
| 2022-03-04T20:20:02Z |
go
| 2022-04-13T01:11:05Z |
cmd/dagger/cmd/root.go
|
rootCmd.PersistentFlags().String("log-format", "auto", "Log format (auto, plain, tty, json)")
rootCmd.PersistentFlags().StringP("log-level", "l", "info", "Log level")
rootCmd.PersistentFlags().Bool("experimental", false, "Enable experimental features")
rootCmd.PersistentPreRun = func(cmd *cobra.Command, _ []string) {
go checkVersion()
}
rootCmd.PersistentPostRun = func(*cobra.Command, []string) {
warnVersion()
}
rootCmd.AddCommand(
versionCmd,
docCmd,
doCmd,
project.Cmd,
)
rootCmd.CompletionOptions.HiddenDefaultCmd = true
if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
panic(err)
}
viper.SetEnvPrefix("dagger")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
}
func Execute() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 1,689 |
Do not show commandconn WARN messages on the first dagger run
|
When `dagger` runs for the first time against a local Docker Engine, it shows the following `WARN` messages:
```
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseRead: commandconn: failed to wait: signal: terminated
WARN[0002] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated
```
This is a bad first experience, and we should improve our first impression.
Point-in-time capture of the latest `dagger` dev version behaviour (pre `0.2.0-beta.1`)
<img width="863" alt="image" src="https://user-images.githubusercontent.com/3342/156835873-b3b92bd5-747c-4b24-bc75-3a778ee47435.png">
|
https://github.com/dagger/dagger/issues/1689
|
https://github.com/dagger/dagger/pull/2161
|
464c7ad708ba93e15df08d71ab3f552539b243f6
|
991c8dc6ff4538b55fe82af42a2d5bd93d5bf256
| 2022-03-04T20:20:02Z |
go
| 2022-04-13T01:11:05Z |
cmd/dagger/cmd/root.go
|
var (
ctx = appcontext.Context()
lg = logger.New()
closer = logger.InitTracing()
span trace.Span
)
if len(os.Args) > 1 {
ctx, span = otel.Tracer("dagger").Start(ctx, os.Args[1])
span.AddEvent("command", trace.WithAttributes(
attribute.String("args", strings.Join(os.Args, " ")),
))
}
defer func() {
if span != nil {
span.End()
}
closer.Close()
}()
if err := rootCmd.ExecuteContext(ctx); err != nil {
lg.Fatal().Err(err).Msg("failed to execute command")
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,091 |
β¨ Explicit `dagger project update` usage
|
### What are you trying to do?
There is a lost of users who can't run `hello world` example or any other example in the docs because they forgot to tip `dagger project update`.
It is not explicitly explained in the doc and there is no tip in the CLI.
What would be awesome is that you have a small message after `dagger project init` to remember you to tip `dagger project update` to install dagger dependencies.
Example
```shell
$ dagger project init
Project initialised! To install dagger universe, run : dagger project update
```
### Why is this important to you?
It's a common mistake that break on-boarding flow.
As a user, it should be easier to do a simple plan or copy/paste something from the doc and run it.
### How are you currently working around this?
Explain directly to users what to do
|
https://github.com/dagger/dagger/issues/2091
|
https://github.com/dagger/dagger/pull/2119
|
15176acc9dfcd9294867d427193696bd5572303b
|
eeb2ef3eab77ef763d672eed0b5a4284fc69978e
| 2022-04-08T12:12:34Z |
go
| 2022-04-14T08:42:46Z |
cmd/dagger/cmd/project/init.go
|
package project
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/common"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.dagger.io/dagger/pkg"
)
var sep = string(os.PathSeparator)
var initCmd = &cobra.Command{
Use: fmt.Sprintf("init [path%sto%sproject]", sep, sep),
Short: "Initialize a new empty project",
Args: cobra.MaximumNArgs(1),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,091 |
β¨ Explicit `dagger project update` usage
|
### What are you trying to do?
There is a lost of users who can't run `hello world` example or any other example in the docs because they forgot to tip `dagger project update`.
It is not explicitly explained in the doc and there is no tip in the CLI.
What would be awesome is that you have a small message after `dagger project init` to remember you to tip `dagger project update` to install dagger dependencies.
Example
```shell
$ dagger project init
Project initialised! To install dagger universe, run : dagger project update
```
### Why is this important to you?
It's a common mistake that break on-boarding flow.
As a user, it should be easier to do a simple plan or copy/paste something from the doc and run it.
### How are you currently working around this?
Explain directly to users what to do
|
https://github.com/dagger/dagger/issues/2091
|
https://github.com/dagger/dagger/pull/2119
|
15176acc9dfcd9294867d427193696bd5572303b
|
eeb2ef3eab77ef763d672eed0b5a4284fc69978e
| 2022-04-08T12:12:34Z |
go
| 2022-04-14T08:42:46Z |
cmd/dagger/cmd/project/init.go
|
PreRun: func(cmd *cobra.Command, args []string) {
if err := viper.BindPFlags(cmd.Flags()); err != nil {
panic(err)
}
},
Run: func(cmd *cobra.Command, args []string) {
lg := logger.New()
ctx := lg.WithContext(cmd.Context())
dir := "."
if len(args) > 0 {
dir = args[0]
}
name := viper.GetString("name")
doneCh := common.TrackCommand(ctx, cmd)
err := pkg.CueModInit(ctx, dir, name)
<-doneCh
if err != nil {
lg.Fatal().Err(err).Msg("failed to initialize project")
}
},
}
func init() {
initCmd.Flags().StringP("name", "n", "", "project name")
if err := viper.BindPFlags(initCmd.Flags()); err != nil {
panic(err)
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,091 |
β¨ Explicit `dagger project update` usage
|
### What are you trying to do?
There is a lost of users who can't run `hello world` example or any other example in the docs because they forgot to tip `dagger project update`.
It is not explicitly explained in the doc and there is no tip in the CLI.
What would be awesome is that you have a small message after `dagger project init` to remember you to tip `dagger project update` to install dagger dependencies.
Example
```shell
$ dagger project init
Project initialised! To install dagger universe, run : dagger project update
```
### Why is this important to you?
It's a common mistake that break on-boarding flow.
As a user, it should be easier to do a simple plan or copy/paste something from the doc and run it.
### How are you currently working around this?
Explain directly to users what to do
|
https://github.com/dagger/dagger/issues/2091
|
https://github.com/dagger/dagger/pull/2119
|
15176acc9dfcd9294867d427193696bd5572303b
|
eeb2ef3eab77ef763d672eed0b5a4284fc69978e
| 2022-04-08T12:12:34Z |
go
| 2022-04-14T08:42:46Z |
cmd/dagger/cmd/project/update.go
|
package project
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.dagger.io/dagger/cmd/dagger/cmd/common"
"go.dagger.io/dagger/cmd/dagger/logger"
"go.dagger.io/dagger/mod"
"go.dagger.io/dagger/pkg"
)
var updateCmd = &cobra.Command{
Use: "update [package]",
Short: "Download and install dependencies",
Args: cobra.MaximumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
if err := viper.BindPFlags(cmd.Flags()); err != nil {
panic(err)
}
},
Run: func(cmd *cobra.Command, args []string) {
lg := logger.New()
ctx := lg.WithContext(cmd.Context())
var err error
cueModPath, cueModExists := pkg.GetCueModParent()
if !cueModExists {
lg.Fatal().Msg("dagger project not found. Run `dagger project init`")
}
if len(args) == 0 {
lg.Debug().Msg("No package specified, updating all packages")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,091 |
β¨ Explicit `dagger project update` usage
|
### What are you trying to do?
There is a lost of users who can't run `hello world` example or any other example in the docs because they forgot to tip `dagger project update`.
It is not explicitly explained in the doc and there is no tip in the CLI.
What would be awesome is that you have a small message after `dagger project init` to remember you to tip `dagger project update` to install dagger dependencies.
Example
```shell
$ dagger project init
Project initialised! To install dagger universe, run : dagger project update
```
### Why is this important to you?
It's a common mistake that break on-boarding flow.
As a user, it should be easier to do a simple plan or copy/paste something from the doc and run it.
### How are you currently working around this?
Explain directly to users what to do
|
https://github.com/dagger/dagger/issues/2091
|
https://github.com/dagger/dagger/pull/2119
|
15176acc9dfcd9294867d427193696bd5572303b
|
eeb2ef3eab77ef763d672eed0b5a4284fc69978e
| 2022-04-08T12:12:34Z |
go
| 2022-04-14T08:42:46Z |
cmd/dagger/cmd/project/update.go
|
pkg.Vendor(ctx, cueModPath)
return
}
var update = viper.GetBool("update")
doneCh := common.TrackCommand(ctx, cmd)
var processedRequires []*mod.Require
if update && len(args) == 0 {
lg.Info().Msg("updating all installed packages...")
processedRequires, err = mod.UpdateInstalled(ctx, cueModPath)
} else if update && len(args) > 0 {
lg.Info().Msg("updating specified packages...")
processedRequires, err = mod.UpdateAll(ctx, cueModPath, args)
} else if !update && len(args) > 0 {
lg.Info().Msg("installing specified packages...")
processedRequires, err = mod.InstallAll(ctx, cueModPath, args)
} else {
lg.Fatal().Msg("unrecognized update/install operation")
}
if len(processedRequires) > 0 {
for _, r := range processedRequires {
lg.Info().Msgf("installed/updated package %s", r)
}
}
<-doneCh
if err != nil {
lg.Error().Err(err).Msg("error installing/updating packages")
}
},
}
func init() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,091 |
β¨ Explicit `dagger project update` usage
|
### What are you trying to do?
There is a lost of users who can't run `hello world` example or any other example in the docs because they forgot to tip `dagger project update`.
It is not explicitly explained in the doc and there is no tip in the CLI.
What would be awesome is that you have a small message after `dagger project init` to remember you to tip `dagger project update` to install dagger dependencies.
Example
```shell
$ dagger project init
Project initialised! To install dagger universe, run : dagger project update
```
### Why is this important to you?
It's a common mistake that break on-boarding flow.
As a user, it should be easier to do a simple plan or copy/paste something from the doc and run it.
### How are you currently working around this?
Explain directly to users what to do
|
https://github.com/dagger/dagger/issues/2091
|
https://github.com/dagger/dagger/pull/2119
|
15176acc9dfcd9294867d427193696bd5572303b
|
eeb2ef3eab77ef763d672eed0b5a4284fc69978e
| 2022-04-08T12:12:34Z |
go
| 2022-04-14T08:42:46Z |
cmd/dagger/cmd/project/update.go
|
updateCmd.Flags().String("private-key-file", "", "Private ssh key")
updateCmd.Flags().String("private-key-password", "", "Private ssh key password")
updateCmd.Flags().BoolP("update", "u", false, "Update specified package")
if err := viper.BindPFlags(updateCmd.Flags()); err != nil {
panic(err)
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,044 |
π dagger do doesn't output stderr
|
### What is the issue?
`dagger do <action>` doesn't return useful info from stderr.
When I change the logging format to `--logformat plain` I get the info I need.
### Log output
```
β service-foo git:(master) β dagger do typescript
[β] client.env 0.0s
[β] client.filesystem."./".read 0.5s
[β] actions.typescript 216.1s
209.9s
8:14PM FTL failed to execute plan: task failed: actions.typescript._build: process "/bin/sh -c cp -r $DEPLOYABLE_NAME/build /output" did not complete successfully: exit code: 1
```
```
dagger do typescript --log-format plain
7:51PM INF system | #10 97.11 Failed to compile.
7:51PM INF system | #10 97.11
7:51PM INF system | #10 97.11 src/store/foo.ts
7:51PM INF system | #10 97.11 Line 29:7: Unsafe return of an `any` typed value @typescript-eslint/no-unsafe-return
7:51PM INF system | #10 97.1
7:51PM INF system | #10 97.39 Output:
7:51PM INF system | #10 97.39
7:51PM INF system | #10 97.39 info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
7:51PM INF system | #10 97.42 error Command failed with exit code 1.
7:51PM INF system | #10 97.42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7:51PM ERR actions.typescript._build | failed: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
```
### Steps to reproduce
_No response_
### Dagger version
dagger 0.2.4 (b32c8732) darwin/amd64
### OS version
osx - 12.01
|
https://github.com/dagger/dagger/issues/2044
|
https://github.com/dagger/dagger/pull/2188
|
437f4517b68347e16704df57c75bd8d418028c8e
|
27d878456f03fb92fd5c62221a279a7ca261926d
| 2022-04-05T04:29:38Z |
go
| 2022-04-19T00:50:34Z |
cmd/dagger/logger/plain.go
|
package logger
import (
"bytes"
"encoding/json"
"fmt"
"hash/adler32"
"io"
"sort"
"strings"
"time"
"github.com/mitchellh/colorstring"
"github.com/rs/zerolog"
)
var colorize = colorstring.Colorize{
Colors: colorstring.DefaultColors,
Reset: true,
}
type PlainOutput struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,044 |
π dagger do doesn't output stderr
|
### What is the issue?
`dagger do <action>` doesn't return useful info from stderr.
When I change the logging format to `--logformat plain` I get the info I need.
### Log output
```
β service-foo git:(master) β dagger do typescript
[β] client.env 0.0s
[β] client.filesystem."./".read 0.5s
[β] actions.typescript 216.1s
209.9s
8:14PM FTL failed to execute plan: task failed: actions.typescript._build: process "/bin/sh -c cp -r $DEPLOYABLE_NAME/build /output" did not complete successfully: exit code: 1
```
```
dagger do typescript --log-format plain
7:51PM INF system | #10 97.11 Failed to compile.
7:51PM INF system | #10 97.11
7:51PM INF system | #10 97.11 src/store/foo.ts
7:51PM INF system | #10 97.11 Line 29:7: Unsafe return of an `any` typed value @typescript-eslint/no-unsafe-return
7:51PM INF system | #10 97.1
7:51PM INF system | #10 97.39 Output:
7:51PM INF system | #10 97.39
7:51PM INF system | #10 97.39 info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
7:51PM INF system | #10 97.42 error Command failed with exit code 1.
7:51PM INF system | #10 97.42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7:51PM ERR actions.typescript._build | failed: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
```
### Steps to reproduce
_No response_
### Dagger version
dagger 0.2.4 (b32c8732) darwin/amd64
### OS version
osx - 12.01
|
https://github.com/dagger/dagger/issues/2044
|
https://github.com/dagger/dagger/pull/2188
|
437f4517b68347e16704df57c75bd8d418028c8e
|
27d878456f03fb92fd5c62221a279a7ca261926d
| 2022-04-05T04:29:38Z |
go
| 2022-04-19T00:50:34Z |
cmd/dagger/logger/plain.go
|
Out io.Writer
}
func (c *PlainOutput) Write(p []byte) (int, error) {
event := map[string]interface{}{}
d := json.NewDecoder(bytes.NewReader(p))
if err := d.Decode(&event); err != nil {
return 0, fmt.Errorf("cannot decode event: %s", err)
}
source := parseSource(event)
return fmt.Fprintln(c.Out, colorize.Color(fmt.Sprintf("%s %s %s%s%s",
formatTimestamp(event),
formatLevel(event),
formatSource(source),
formatMessage(event),
formatFields(event),
)))
}
func formatLevel(event map[string]interface{}) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,044 |
π dagger do doesn't output stderr
|
### What is the issue?
`dagger do <action>` doesn't return useful info from stderr.
When I change the logging format to `--logformat plain` I get the info I need.
### Log output
```
β service-foo git:(master) β dagger do typescript
[β] client.env 0.0s
[β] client.filesystem."./".read 0.5s
[β] actions.typescript 216.1s
209.9s
8:14PM FTL failed to execute plan: task failed: actions.typescript._build: process "/bin/sh -c cp -r $DEPLOYABLE_NAME/build /output" did not complete successfully: exit code: 1
```
```
dagger do typescript --log-format plain
7:51PM INF system | #10 97.11 Failed to compile.
7:51PM INF system | #10 97.11
7:51PM INF system | #10 97.11 src/store/foo.ts
7:51PM INF system | #10 97.11 Line 29:7: Unsafe return of an `any` typed value @typescript-eslint/no-unsafe-return
7:51PM INF system | #10 97.1
7:51PM INF system | #10 97.39 Output:
7:51PM INF system | #10 97.39
7:51PM INF system | #10 97.39 info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
7:51PM INF system | #10 97.42 error Command failed with exit code 1.
7:51PM INF system | #10 97.42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7:51PM ERR actions.typescript._build | failed: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
```
### Steps to reproduce
_No response_
### Dagger version
dagger 0.2.4 (b32c8732) darwin/amd64
### OS version
osx - 12.01
|
https://github.com/dagger/dagger/issues/2044
|
https://github.com/dagger/dagger/pull/2188
|
437f4517b68347e16704df57c75bd8d418028c8e
|
27d878456f03fb92fd5c62221a279a7ca261926d
| 2022-04-05T04:29:38Z |
go
| 2022-04-19T00:50:34Z |
cmd/dagger/logger/plain.go
|
level := zerolog.DebugLevel
if l, ok := event[zerolog.LevelFieldName].(string); ok {
level, _ = zerolog.ParseLevel(l)
}
switch level {
case zerolog.TraceLevel:
return "[magenta]TRC[reset]"
case zerolog.DebugLevel:
return "[yellow]DBG[reset]"
case zerolog.InfoLevel:
return "[green]INF[reset]"
case zerolog.WarnLevel:
return "[red]WRN[reset]"
case zerolog.ErrorLevel:
return "[red]ERR[reset]"
case zerolog.FatalLevel:
return "[red]FTL[reset]"
case zerolog.PanicLevel:
return "[red]PNC[reset]"
default:
return "[bold]???[reset]"
}
}
func formatTimestamp(event map[string]interface{}) string {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 2,044 |
π dagger do doesn't output stderr
|
### What is the issue?
`dagger do <action>` doesn't return useful info from stderr.
When I change the logging format to `--logformat plain` I get the info I need.
### Log output
```
β service-foo git:(master) β dagger do typescript
[β] client.env 0.0s
[β] client.filesystem."./".read 0.5s
[β] actions.typescript 216.1s
209.9s
8:14PM FTL failed to execute plan: task failed: actions.typescript._build: process "/bin/sh -c cp -r $DEPLOYABLE_NAME/build /output" did not complete successfully: exit code: 1
```
```
dagger do typescript --log-format plain
7:51PM INF system | #10 97.11 Failed to compile.
7:51PM INF system | #10 97.11
7:51PM INF system | #10 97.11 src/store/foo.ts
7:51PM INF system | #10 97.11 Line 29:7: Unsafe return of an `any` typed value @typescript-eslint/no-unsafe-return
7:51PM INF system | #10 97.1
7:51PM INF system | #10 97.39 Output:
7:51PM INF system | #10 97.39
7:51PM INF system | #10 97.39 info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
7:51PM INF system | #10 97.42 error Command failed with exit code 1.
7:51PM INF system | #10 97.42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7:51PM ERR actions.typescript._build | failed: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
```
### Steps to reproduce
_No response_
### Dagger version
dagger 0.2.4 (b32c8732) darwin/amd64
### OS version
osx - 12.01
|
https://github.com/dagger/dagger/issues/2044
|
https://github.com/dagger/dagger/pull/2188
|
437f4517b68347e16704df57c75bd8d418028c8e
|
27d878456f03fb92fd5c62221a279a7ca261926d
| 2022-04-05T04:29:38Z |
go
| 2022-04-19T00:50:34Z |
cmd/dagger/logger/plain.go
|
ts, ok := event[zerolog.TimestampFieldName].(string)
if !ok {
return "???"
}
t, err := time.Parse(zerolog.TimeFieldFormat, ts)
if err != nil {
panic(err)
}
return fmt.Sprintf("[dark_gray]%s[reset]", t.Format(time.Kitchen))
}
func formatMessage(event map[string]interface{}) string {
message, ok := event[zerolog.MessageFieldName].(string)
if !ok {
return ""
}
message = strings.TrimSpace(message)
if err, ok := event[zerolog.ErrorFieldName].(string); ok && err != "" {
message = message + ": " + err
}
level := zerolog.DebugLevel
if l, ok := event[zerolog.LevelFieldName].(string); ok {
level, _ = zerolog.ParseLevel(l)
}
switch level {
case zerolog.TraceLevel:
return fmt.Sprintf("[dim]%s[reset]", message)
case zerolog.DebugLevel:
return fmt.Sprintf("[dim]%s[reset]", message)
case zerolog.InfoLevel:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.