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
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.go
|
router *router.Router
secretStore *secret.Store
gw bkgw.Client
bkClient *bkclient.Client
solveOpts bkclient.SolveOpt
solveCh chan *bkclient.SolveStatus
platform specs.Platform
}
func (r *baseSchema) Solve(ctx context.Context, st llb.State, marshalOpts ...llb.ConstraintsOpt) (*filesystem.Filesystem, error) {
def, err := st.Marshal(ctx, append([]llb.ConstraintsOpt{llb.Platform(r.platform)}, marshalOpts...)...)
if err != nil {
return nil, err
}
_, err = r.gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: def.ToPB(),
})
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.go
|
return filesystem.FromDefinition(def), nil
}
func (r *baseSchema) Export(ctx context.Context, fs *filesystem.Filesystem, export bkclient.ExportEntry) error {
fsDef, err := fs.ToDefinition()
if err != nil {
return err
}
solveOpts := r.solveOpts
solveOpts.Exports = []bkclient.ExportEntry{export}
ch := make(chan *bkclient.SolveStatus)
go func() {
for event := range ch {
r.solveCh <- event
}
}()
_, err = r.bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: fsDef,
})
}, ch)
if err != nil {
return err
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
package core
import (
"fmt"
"path/filepath"
"strings"
"github.com/graphql-go/graphql"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"go.dagger.io/dagger/core/filesystem"
"go.dagger.io/dagger/router"
)
var _ router.ExecutableSchema = &coreSchema{}
type coreSchema struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
*baseSchema
sshAuthSockID string
workdirID string
}
func (r *coreSchema) Name() string {
return "core"
}
func (r *coreSchema) Schema() string {
return `
extend type Query {
"Core API"
core: Core!
"Host API"
host: Host!
}
"Core API"
type Core {
"Fetch an OCI image"
image(ref: String!): Filesystem!
"Fetch a git repository"
git(remote: String!, ref: String): Filesystem!
}
"Interactions with the user's host filesystem"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
type Host {
"Fetch the client's workdir"
workdir: LocalDir!
"Fetch a client directory"
dir(id: String!): LocalDir!
}
"A directory on the user's host filesystem"
type LocalDir {
"Read the contents of the directory"
read: Filesystem!
"Write the provided filesystem to the directory"
write(contents: FSID!, path: String): Boolean!
}
`
}
func (r *coreSchema) Resolvers() router.Resolvers {
return router.Resolvers{
"Query": router.ObjectResolver{
"core": r.core,
"host": r.host,
},
"Core": router.ObjectResolver{
"image": r.image,
"git": r.git,
},
"Host": router.ObjectResolver{
"workdir": r.workdir,
"dir": r.dir,
},
"LocalDir": router.ObjectResolver{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
"read": r.localDirRead,
"write": r.localDirWrite,
},
}
}
func (r *coreSchema) Dependencies() []router.ExecutableSchema {
return nil
}
func (r *coreSchema) core(p graphql.ResolveParams) (any, error) {
return struct{}{}, nil
}
func (r *coreSchema) host(p graphql.ResolveParams) (any, error) {
return struct{}{}, nil
}
func (r *coreSchema) image(p graphql.ResolveParams) (any, error) {
ref := p.Args["ref"].(string)
st := llb.Image(ref)
return r.Solve(p.Context, st)
}
func (r *coreSchema) git(p graphql.ResolveParams) (any, error) {
remote := p.Args["remote"].(string)
ref, _ := p.Args["ref"].(string)
var opts []llb.GitOption
if r.sshAuthSockID != "" {
opts = append(opts, llb.MountSSHSock(r.sshAuthSockID))
}
st := llb.Git(remote, ref, opts...)
return r.Solve(p.Context, st)
}
type localDir struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
ID string `json:"id"`
}
func (r *coreSchema) workdir(p graphql.ResolveParams) (any, error) {
return localDir{r.workdirID}, nil
}
func (r *coreSchema) dir(p graphql.ResolveParams) (any, error) {
id := p.Args["id"].(string)
return localDir{id}, nil
}
func (r *coreSchema) localDirRead(p graphql.ResolveParams) (any, error) {
obj := p.Source.(localDir)
st := llb.Scratch().File(llb.Copy(llb.Local(
obj.ID,
llb.SharedKeyHint(obj.ID),
llb.ExcludePatterns([]string{"**/node_modules"}),
), "/", "/"))
return r.Solve(p.Context, st, llb.LocalUniqueID(obj.ID))
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/core.schema.go
|
}
func (r *coreSchema) localDirWrite(p graphql.ResolveParams) (any, error) {
fsid := p.Args["contents"].(filesystem.FSID)
fs := filesystem.Filesystem{ID: fsid}
workdir, err := filepath.Abs(r.solveOpts.LocalDirs[r.workdirID])
if err != nil {
return nil, err
}
path, _ := p.Args["path"].(string)
dest, err := filepath.Abs(filepath.Join(workdir, path))
if err != nil {
return nil, err
}
dest, err = filepath.EvalSymlinks(dest)
if err != nil {
return nil, err
}
if !strings.HasPrefix(dest, workdir) {
return nil, fmt.Errorf("path %q is outside workdir", path)
}
if err := r.Export(p.Context, &fs, bkclient.ExportEntry{
Type: bkclient.ExporterLocal,
OutputDir: dest,
}); err != nil {
return nil, err
}
return true, nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
package filesystem
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
)
const (
scratchID = FSID("scratch")
)
type FSID string
type Filesystem struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
ID FSID `json:"id"`
}
func (f *Filesystem) ToDefinition() (*pb.Definition, error) {
if f.ID == scratchID {
def, err := llb.Scratch().Marshal(context.TODO())
if err != nil {
return nil, err
}
return def.ToPB(), nil
}
jsonBytes := make([]byte, base64.StdEncoding.DecodedLen(len(f.ID)))
n, err := base64.StdEncoding.Decode(jsonBytes, []byte(f.ID))
if err != nil {
return nil, fmt.Errorf("failed to unmarshal fs bytes: %v", err)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
jsonBytes = jsonBytes[:n]
var result pb.Definition
if err := json.Unmarshal(jsonBytes, &result); err != nil {
return nil, fmt.Errorf("failed to unmarshal result: %v: %s", err, string(jsonBytes))
}
return &result, nil
}
func (f *Filesystem) ToState() (llb.State, error) {
if f.ID == scratchID {
return llb.Scratch(), nil
}
def, err := f.ToDefinition()
if err != nil {
return llb.State{}, err
}
defop, err := llb.NewDefinitionOp(def)
if err != nil {
return llb.State{}, err
}
return llb.NewState(defop), nil
}
func (f *Filesystem) Evaluate(ctx context.Context, gw bkgw.Client) error {
def, err := f.ToDefinition()
if err != nil {
return err
}
_, err = gw.Solve(ctx, bkgw.SolveRequest{
Definition: def,
Evaluate: true,
})
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
return err
}
func (f *Filesystem) ReadFile(ctx context.Context, gw bkgw.Client, path string) ([]byte, error) {
def, err := f.ToDefinition()
if err != nil {
return nil, err
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: def,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
if ref == nil {
return nil, fmt.Errorf("failed to read file: open %s: no such file or directory", path)
}
outputBytes, err := ref.ReadFile(ctx, bkgw.ReadRequest{
Filename: path,
})
if err != nil {
return nil, err
}
return outputBytes, nil
}
func New(id FSID) *Filesystem {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
return &Filesystem{
ID: id,
}
}
func FromDefinition(def *llb.Definition) *Filesystem {
jsonBytes, err := json.Marshal(def.ToPB())
if err != nil {
panic(err)
}
b64Bytes := make([]byte, base64.StdEncoding.EncodedLen(len(jsonBytes)))
base64.StdEncoding.Encode(b64Bytes, jsonBytes)
return &Filesystem{
ID: FSID(b64Bytes),
}
}
func FromState(ctx context.Context, st llb.State, platform specs.Platform) (*Filesystem, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
return FromDefinition(def), nil
}
func FromSource(source any) (*Filesystem, error) {
fs, ok := source.(*Filesystem)
if ok {
return fs, nil
}
m, ok := source.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("invalid source type: %T", source)
}
id, ok := m["id"].(string)
if !ok {
return nil, fmt.Errorf("invalid source id: %T %v", source, source)
}
return &Filesystem{
ID: FSID(id),
}, nil
}
func Merged(ctx context.Context, filesystems []*Filesystem, platform specs.Platform) (*Filesystem, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/filesystem/filesystem.go
|
states := make([]llb.State, 0, len(filesystems))
for _, fs := range filesystems {
state, err := fs.ToState()
if err != nil {
return nil, err
}
states = append(states, state)
}
return FromState(ctx, llb.Merge(states), platform)
}
func Diffed(ctx context.Context, lower, upper *Filesystem, platform specs.Platform) (*Filesystem, error) {
lowerState, err := lower.ToState()
if err != nil {
return nil, err
}
upperState, err := upper.ToState()
if err != nil {
return nil, err
}
return FromState(ctx, llb.Diff(lowerState, upperState), platform)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
package core
import (
"context"
"testing"
"github.com/Khan/genqlient/graphql"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
"go.dagger.io/dagger/engine"
"go.dagger.io/dagger/internal/testutil"
)
func init() {
if err := testutil.SetupBuildkitd(); err != nil {
panic(err)
}
}
func TestCoreImage(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Core struct {
Image struct {
File string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
file(path: "/etc/alpine-release")
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Core.Image.File, "3.16.2\n")
}
func TestCoreGit(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Core struct {
Git struct {
File string
}
}
}{}
err := testutil.Query(
`{
core {
git(remote: "github.com/dagger/dagger") {
file(path: "README.md", lines: 1)
}
}
}`, &res, nil)
require.NoError(t, err)
require.Contains(t, res.Core.Git.File, "Dagger")
}
func TestFilesystemCopy(t *testing.T) {
t.Parallel()
alpine := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Core struct {
Image struct {
ID string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
id
}
}
}`, &alpine, nil)
require.NoError(t, err)
require.NotEmpty(t, alpine.Core.Image.ID)
res := struct {
Core struct {
Filesystem struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Copy struct {
File string
}
}
}
}{}
testutil.Query(
`query ($from: FSID!) {
core {
filesystem(id: "scratch") {
copy(
from: $from
srcPath: "/etc/alpine-release"
destPath: "/test"
) {
file(path: "/test")
}
}
}
}`, &res, &testutil.QueryOptions{
Variables: map[string]any{
"from": alpine.Core.Image.ID,
},
})
require.NoError(t, err)
require.Equal(t, "3.16.2\n", res.Core.Filesystem.Copy.File)
}
func TestCoreExec(t *testing.T) {
t.Parallel()
imageRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Core struct {
Image struct {
ID string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
id
}
}
}`, &imageRes, nil)
require.NoError(t, err)
id := imageRes.Core.Image.ID
execRes := struct {
Core struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Image struct {
Exec struct {
Mount struct {
File string
}
}
}
}
}{}
err = testutil.Query(
`query TestExec($id: FSID!) {
core {
image(ref: "alpine:3.16.2") {
exec(input: {
args: ["sh", "-c", "echo hi > /mnt/hello"]
mounts: [{fs: $id, path: "/mnt/"}]
}) {
mount(path: "/mnt") {
file(path: "/hello")
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "hi\n", execRes.Core.Image.Exec.Mount.File)
}
func TestCoreImageExport(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
randomID := identity.NewID()
err := engine.Start(context.Background(), nil, func(ctx engine.Context) error {
go func() {
err := ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query RunRegistry($rand: String!) {
core {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
image(ref: "registry:2") {
exec(input: {
args: ["/entrypoint.sh", "/etc/docker/registry/config.yml"]
env: [{name: "RANDOM", value: $rand}]
}) {
stdout
stderr
}
}
}
}`,
Variables: map[string]any{
"rand": randomID,
},
},
&graphql.Response{Data: new(map[string]any)},
)
if err != nil {
t.Logf("error running registry: %v", err)
}
}()
err := ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query WaitForRegistry($rand: String!) {
core {
image(ref: "alpine:3.16.2") {
exec(input: {
args: ["sh", "-c", "for i in $(seq 1 60); do nc -zv 127.0.0.1 5000 && exit 0; sleep 1; done; exit 1"]
env: [{name: "RANDOM", value: $rand}]
}) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
stdout
}
}
}
}`,
Variables: map[string]any{
"rand": randomID,
},
},
&graphql.Response{Data: new(map[string]any)},
)
require.NoError(t, err)
testRef := "127.0.0.1:5000/testimagepush:latest"
err = ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query TestImagePush($ref: String!) {
core {
image(ref: "alpine:3.16.2") {
pushImage(ref: $ref)
}
}
}`,
Variables: map[string]any{
"ref": testRef,
},
},
&graphql.Response{Data: new(map[string]any)},
)
require.NoError(t, err)
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,066 |
Use image config to configure action ExecOps
|
Right now any env vars (like `PATH`) or other configuration provided as part of an image config w/ the `FS` for a package don't get set when invoking the action, resulting in hacks like this: https://github.com/dagger/cloak/blob/e60aede62917e4e2711cca499d019c857f0b14ed/examples/netlify/ts/index.ts#L17-L17
|
https://github.com/dagger/dagger/issues/3066
|
https://github.com/dagger/dagger/pull/3137
|
b7f3f4fece8cf49da229f395e5914a1c4d01512b
|
a1308896202d85adb6077c002ff819c07a2d392f
| 2022-08-05T21:42:33Z |
go
| 2022-09-27T16:38:56Z |
core/integration/core.schema_test.go
|
Core struct {
Image struct {
File string
}
}
}{}
err = ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query TestImagePull($ref: String!) {
core {
image(ref: $ref) {
file(path: "/etc/alpine-release")
}
}
}`,
Variables: map[string]any{
"ref": testRef,
},
},
&graphql.Response{Data: &res},
)
require.NoError(t, err)
require.Equal(t, res.Core.Image.File, "3.16.2\n")
return nil
})
require.NoError(t, err)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.go
|
package core
import (
"context"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"go.dagger.io/dagger/core/filesystem"
"go.dagger.io/dagger/project"
"go.dagger.io/dagger/router"
"go.dagger.io/dagger/secret"
)
type InitializeArgs struct {
Router *router.Router
SecretStore *secret.Store
SSHAuthSockID string
WorkdirID string
Gateway bkgw.Client
BKClient *bkclient.Client
SolveOpts bkclient.SolveOpt
SolveCh chan *bkclient.SolveStatus
Platform specs.Platform
}
func New(params InitializeArgs) (router.ExecutableSchema, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.go
|
base := &baseSchema{
router: params.Router,
secretStore: params.SecretStore,
gw: params.Gateway,
bkClient: params.BKClient,
solveOpts: params.SolveOpts,
solveCh: params.SolveCh,
platform: params.Platform,
sshAuthSockID: params.SSHAuthSockID,
}
return router.MergeExecutableSchemas("core",
&coreSchema{base, params.WorkdirID},
&directorySchema{base},
&fileSchema{base},
&gitSchema{base},
&filesystemSchema{base},
&projectSchema{
baseSchema: base,
remoteSchemas: make(map[string]*project.RemoteSchema),
compiledSchemas: make(map[string]*project.CompiledRemoteSchema),
},
&execSchema{base},
&dockerBuildSchema{base},
&secretSchema{base},
)
}
type baseSchema struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.go
|
router *router.Router
secretStore *secret.Store
gw bkgw.Client
bkClient *bkclient.Client
solveOpts bkclient.SolveOpt
solveCh chan *bkclient.SolveStatus
platform specs.Platform
sshAuthSockID string
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.go
|
}
func (r *baseSchema) Solve(ctx context.Context, st llb.State, marshalOpts ...llb.ConstraintsOpt) (*filesystem.Filesystem, error) {
marshalOpts = append([]llb.ConstraintsOpt{llb.Platform(r.platform)}, marshalOpts...)
inputCfg, err := filesystem.ImageConfigFromState(ctx, st)
if err != nil {
return nil, err
}
input, err := st.Marshal(ctx, marshalOpts...)
if err != nil {
return nil, err
}
res, err := r.gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: input.ToPB(),
})
if err != nil {
return nil, err
}
bkref, err := res.SingleRef()
if err != nil {
return nil, err
}
resSt, err := bkref.ToState()
if err != nil {
return nil, err
}
img, err := filesystem.ImageFromStateAndConfig(ctx, resSt, inputCfg, marshalOpts...)
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.go
|
return img.ToFilesystem()
}
func (r *baseSchema) Export(ctx context.Context, fs *filesystem.Filesystem, export bkclient.ExportEntry) error {
fsDef, err := fs.ToDefinition()
if err != nil {
return err
}
solveOpts := r.solveOpts
solveOpts.Exports = []bkclient.ExportEntry{export}
ch := make(chan *bkclient.SolveStatus)
go func() {
for event := range ch {
r.solveCh <- event
}
}()
_, err = r.bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: fsDef,
})
}, ch)
if err != nil {
return err
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
package core
import (
"fmt"
"path/filepath"
"strings"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"go.dagger.io/dagger/core/filesystem"
"go.dagger.io/dagger/router"
)
var _ router.ExecutableSchema = &coreSchema{}
type coreSchema struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
*baseSchema
workdirID string
}
func (r *coreSchema) Name() string {
return "core"
}
func (r *coreSchema) Schema() string {
return `
extend type Query {
"Core API"
core: Core!
"Host API"
host: Host!
}
"Core API"
type Core {
"Fetch an OCI image"
image(ref: String!): Filesystem!
}
"Interactions with the user's host filesystem"
type Host {
"Fetch the client's workdir"
workdir: LocalDir!
"Fetch a client directory"
dir(id: String!): LocalDir!
}
"A directory on the user's host filesystem"
type LocalDir {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
"Read the contents of the directory"
read: Filesystem!
"Write the provided filesystem to the directory"
write(contents: FSID!, path: String): Boolean!
}
`
}
func (r *coreSchema) Resolvers() router.Resolvers {
return router.Resolvers{
"Query": router.ObjectResolver{
r.Name(): router.PassthroughResolver,
"host": router.PassthroughResolver,
},
"Core": router.ObjectResolver{
"image": router.ToResolver(r.image),
},
"Host": router.ObjectResolver{
"workdir": router.ToResolver(r.workdir),
"dir": router.ToResolver(r.dir),
},
"LocalDir": router.ObjectResolver{
"read": router.ToResolver(r.localDirRead),
"write": router.ToResolver(r.localDirWrite),
},
}
}
func (r *coreSchema) Dependencies() []router.ExecutableSchema {
return nil
}
type imageArgs struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
Ref string
}
func (r *coreSchema) image(ctx *router.Context, parent any, args imageArgs) (*filesystem.Filesystem, error) {
st := llb.Image(args.Ref, llb.WithMetaResolver(r.gw))
return r.Solve(ctx, st)
}
type localDir struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
ID string `json:"id"`
}
func (r *coreSchema) workdir(ctx *router.Context, parent any, args any) (localDir, error) {
return localDir{r.workdirID}, nil
}
type dirArgs struct {
ID string
}
func (r *coreSchema) dir(ctx *router.Context, parent any, args dirArgs) (localDir, error) {
return localDir(args), nil
}
func (r *coreSchema) localDirRead(ctx *router.Context, parent localDir, args any) (*filesystem.Filesystem, error) {
st := llb.Scratch().File(llb.Copy(llb.Local(
parent.ID,
llb.SharedKeyHint(parent.ID),
llb.ExcludePatterns([]string{"**/node_modules"}),
), "/", "/"))
return r.Solve(ctx, st, llb.LocalUniqueID(parent.ID))
}
type localDirWriteArgs struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/core.schema.go
|
Contents filesystem.FSID
Path string
}
func (r *coreSchema) localDirWrite(ctx *router.Context, parent localDir, args localDirWriteArgs) (bool, error) {
fs := filesystem.Filesystem{ID: args.Contents}
workdir, err := filepath.Abs(r.solveOpts.LocalDirs[r.workdirID])
if err != nil {
return false, err
}
dest, err := filepath.Abs(filepath.Join(workdir, args.Path))
if err != nil {
return false, err
}
dest, err = filepath.EvalSymlinks(dest)
if err != nil {
return false, err
}
if !strings.HasPrefix(dest, workdir) {
return false, fmt.Errorf("path %q is outside workdir", args.Path)
}
if err := r.Export(ctx, &fs, bkclient.ExportEntry{
Type: bkclient.ExporterLocal,
OutputDir: dest,
}); err != nil {
return false, err
}
return true, nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/filesystem/image.go
|
package filesystem
import (
"context"
"encoding/base64"
"encoding/json"
"strings"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
)
type Image struct {
FS *pb.Definition `json:"fs"`
Config specs.ImageConfig `json:"cfg"`
}
func (info *Image) ToFilesystem() (*Filesystem, error) {
jsonBytes, err := json.Marshal(info)
if err != nil {
return nil, err
}
b64Bytes := make([]byte, base64.StdEncoding.EncodedLen(len(jsonBytes)))
base64.StdEncoding.Encode(b64Bytes, jsonBytes)
return &Filesystem{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/filesystem/image.go
|
ID: FSID(b64Bytes),
}, nil
}
func (info *Image) ToState() (llb.State, error) {
defop, err := llb.NewDefinitionOp(info.FS)
if err != nil {
return llb.State{}, err
}
st := llb.NewState(defop)
for _, env := range info.Config.Env {
parts := strings.SplitN(env, "=", 2)
if len(parts[0]) > 0 {
var v string
if len(parts) > 1 {
v = parts[1]
}
st = st.AddEnv(parts[0], v)
}
}
st = st.Dir(info.Config.WorkingDir)
return st, nil
}
func ImageFromState(ctx context.Context, st llb.State, marshalOpts ...llb.ConstraintsOpt) (*Image, error) {
cfg, err := ImageConfigFromState(ctx, st)
if err != nil {
return nil, err
}
return ImageFromStateAndConfig(ctx, st, cfg, marshalOpts...)
}
func ImageConfigFromState(ctx context.Context, st llb.State) (specs.ImageConfig, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/filesystem/image.go
|
env, err := st.Env(ctx)
if err != nil {
return specs.ImageConfig{}, err
}
dir, err := st.GetDir(ctx)
if err != nil {
return specs.ImageConfig{}, err
}
return specs.ImageConfig{
Env: env,
WorkingDir: dir,
}, nil
}
func ImageFromStateAndConfig(ctx context.Context, st llb.State, cfg specs.ImageConfig, marshalOpts ...llb.ConstraintsOpt) (*Image, error) {
def, err := st.Marshal(ctx, marshalOpts...)
if err != nil {
return nil, err
}
return &Image{
FS: def.ToPB(),
Config: cfg,
}, nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
package core
import (
"context"
"testing"
"github.com/Khan/genqlient/graphql"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
"go.dagger.io/dagger/engine"
"go.dagger.io/dagger/internal/testutil"
)
func TestCoreImage(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Core struct {
Image struct {
File string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
file(path: "/etc/alpine-release")
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Core.Image.File, "3.16.2\n")
}
func TestCoreGit(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Core struct {
Git struct {
File string
}
}
}{}
err := testutil.Query(
`{
core {
git(remote: "github.com/dagger/dagger") {
file(path: "README.md", lines: 1)
}
}
}`, &res, nil)
require.NoError(t, err)
require.Contains(t, res.Core.Git.File, "Dagger")
}
func TestFilesystemCopy(t *testing.T) {
t.Parallel()
alpine := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Core struct {
Image struct {
ID string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
id
}
}
}`, &alpine, nil)
require.NoError(t, err)
require.NotEmpty(t, alpine.Core.Image.ID)
res := struct {
Core struct {
Filesystem struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Copy struct {
File string
}
}
}
}{}
testutil.Query(
`query ($from: FSID!) {
core {
filesystem(id: "scratch") {
copy(
from: $from
srcPath: "/etc/alpine-release"
destPath: "/test"
) {
file(path: "/test")
}
}
}
}`, &res, &testutil.QueryOptions{
Variables: map[string]any{
"from": alpine.Core.Image.ID,
},
})
require.NoError(t, err)
require.Equal(t, "3.16.2\n", res.Core.Filesystem.Copy.File)
}
func TestCoreExec(t *testing.T) {
t.Parallel()
imageRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Core struct {
Image struct {
ID string
}
}
}{}
err := testutil.Query(
`{
core {
image(ref: "alpine:3.16.2") {
id
}
}
}`, &imageRes, nil)
require.NoError(t, err)
id := imageRes.Core.Image.ID
execRes := struct {
Core struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Image struct {
Exec struct {
Mount struct {
File string
}
}
}
}
}{}
err = testutil.Query(
`query TestExec($id: FSID!) {
core {
image(ref: "alpine:3.16.2") {
exec(input: {
args: ["sh", "-c", "echo hi > /mnt/hello"]
mounts: [{fs: $id, path: "/mnt/"}]
}) {
mount(path: "/mnt") {
file(path: "/hello")
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "hi\n", execRes.Core.Image.Exec.Mount.File)
}
func TestCoreImageExport(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
randomID := identity.NewID()
err := engine.Start(context.Background(), nil, func(ctx engine.Context) error {
go func() {
err := ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query RunRegistry($rand: String!) {
core {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
image(ref: "registry:2") {
exec(input: {
args: ["/entrypoint.sh", "/etc/docker/registry/config.yml"]
env: [{name: "RANDOM", value: $rand}]
}) {
stdout
stderr
}
}
}
}`,
Variables: map[string]any{
"rand": randomID,
},
},
&graphql.Response{Data: new(map[string]any)},
)
if err != nil {
t.Logf("error running registry: %v", err)
}
}()
err := ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query WaitForRegistry($rand: String!) {
core {
image(ref: "alpine:3.16.2") {
exec(input: {
args: ["sh", "-c", "for i in $(seq 1 60); do nc -zv 127.0.0.1 5000 && exit 0; sleep 1; done; exit 1"]
env: [{name: "RANDOM", value: $rand}]
}) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
stdout
}
}
}
}`,
Variables: map[string]any{
"rand": randomID,
},
},
&graphql.Response{Data: new(map[string]any)},
)
require.NoError(t, err)
testRef := "127.0.0.1:5000/testimagepush:latest"
err = ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query TestImagePush($ref: String!) {
core {
image(ref: "alpine:3.16.2") {
pushImage(ref: $ref)
}
}
}`,
Variables: map[string]any{
"ref": testRef,
},
},
&graphql.Response{Data: new(map[string]any)},
)
require.NoError(t, err)
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,170 |
🐞 ENTRYPOINT/CMD data lost during Dagger image build
|
### What is the issue?
The default entrypoint/cmd of a base image is lost when that image is used in a Dagger image build process.
### Log output
_No response_
### Steps to reproduce
Running standard PHP image:
```
$ docker run php:8.1-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Sat Sep 17 06:11:06.065706 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.9 configured -- resuming normal operations
[Sat Sep 17 06:11:06.065751 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
```
Building new image based on above image, making no changes, pushing it to registry and running it:
```
query {
core {
image(ref: "php:8.1-apache") {
pushImage(ref:"xxx/testrepo:latest")
}
}
}
$ docker run xxx/testrepo
docker: Error response from daemon: No command specified.
See 'docker run --help'.
```
### Dagger version
cloak devel (97205d987) linux/amd64
### OS version
Linux 5.15.0-47-generic #51-Ubuntu SMP
|
https://github.com/dagger/dagger/issues/3170
|
https://github.com/dagger/dagger/pull/3174
|
8c3d0f8e8468395485fd97bd095e8e4ab809b79c
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
| 2022-09-28T20:41:19Z |
go
| 2022-09-29T23:17:00Z |
core/integration/old_core.schema_test.go
|
Core struct {
Image struct {
File string
}
}
}{}
err = ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query TestImagePull($ref: String!) {
core {
image(ref: $ref) {
file(path: "/etc/alpine-release")
}
}
}`,
Variables: map[string]any{
"ref": testRef,
},
},
&graphql.Response{Data: &res},
)
require.NoError(t, err)
require.Equal(t, res.Core.Image.File, "3.16.2\n")
return nil
})
require.NoError(t, err)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
package buildkitd
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime/debug"
"strconv"
"strings"
"time"
"github.com/docker/distribution/reference"
"github.com/gofrs/flock"
"github.com/mitchellh/go-homedir"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/util/tracing/detect"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
_ "github.com/moby/buildkit/client/connhelper/dockercontainer"
_ "github.com/moby/buildkit/client/connhelper/kubepod"
_ "github.com/moby/buildkit/client/connhelper/podmancontainer"
)
const (
image = "moby/buildkit"
containerName = "dagger-buildkitd"
volumeName = "dagger-buildkitd"
buildkitdLockPath = "~/.config/dagger/.buildkitd.lock"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
lockTimeout = 10 * time.Minute
)
func Client(ctx context.Context) (*bkclient.Client, error) {
host := os.Getenv("BUILDKIT_HOST")
if host == "" {
h, err := startBuildInfoBuildkitd(ctx)
if err != nil {
return nil, err
}
host = h
}
opts := []bkclient.ClientOpt{
bkclient.WithFailFast(),
bkclient.WithTracerProvider(otel.GetTracerProvider()),
}
exp, err := detect.Exporter()
if err != nil {
return nil, err
}
if td, ok := exp.(bkclient.TracerDelegate); ok {
opts = append(opts, bkclient.WithTracerDelegate(td))
}
c, err := bkclient.New(ctx, host, opts...)
if err != nil {
return nil, fmt.Errorf("buildkit client: %w", err)
}
return c, nil
}
func startBuildInfoBuildkitd(ctx context.Context) (string, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
var vendoredVersion string
bi, ok := debug.ReadBuildInfo()
if !ok {
return "", errors.New("unable to read build info")
}
for _, d := range bi.Deps {
if d.Path == "github.com/moby/buildkit" {
vendoredVersion = d.Version
break
}
}
return startBuildkitdVersion(ctx, vendoredVersion)
}
func StartGoModBuildkitd(ctx context.Context) (string, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
out, err := exec.Command("go", "list", "-m", "github.com/moby/buildkit").CombinedOutput()
if err != nil {
return "", err
}
trimmed := strings.TrimSpace(string(out))
_, version, ok := strings.Cut(trimmed, " ")
if !ok {
return "", fmt.Errorf("unexpected go list output: %s", trimmed)
}
return startBuildkitdVersion(ctx, version)
}
func startBuildkitdVersion(ctx context.Context, version string) (string, error) {
if version == "" {
return "", errors.New("buildkitd version is empty")
}
if err := checkBuildkit(ctx, version); err != nil {
return "", err
}
return fmt.Sprintf("docker-container://%s", containerName), nil
}
func checkBuildkit(ctx context.Context, version string) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
lockFilePath, err := homedir.Expand(buildkitdLockPath)
if err != nil {
return fmt.Errorf("unable to expand buildkitd lock path: %w", err)
}
if err := os.MkdirAll(filepath.Dir(lockFilePath), 0755); err != nil {
return fmt.Errorf("unable to create buildkitd lock path parent dir: %w", err)
}
lock := flock.New(lockFilePath)
lockCtx, cancel := context.WithTimeout(ctx, lockTimeout)
defer cancel()
locked, err := lock.TryLockContext(lockCtx, 100*time.Millisecond)
if err != nil {
return fmt.Errorf("failed to lock buildkitd lock file: %w", err)
}
if !locked {
return fmt.Errorf("failed to acquire buildkitd lock file")
}
defer lock.Unlock()
config, err := getBuildkitInformation(ctx)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
if err != nil {
if err := checkDocker(ctx); err != nil {
return err
}
fmt.Println("No buildkitd container found, creating one...")
removeBuildkit(ctx)
if err := installBuildkit(ctx, version); err != nil {
return err
}
} else {
if config.Version != version {
fmt.Println("Buildkitd container is out of date, updating it...")
if err := removeBuildkit(ctx); err != nil {
return err
}
if err := installBuildkit(ctx, version); err != nil {
return err
}
}
if !config.IsActive {
fmt.Println("Buildkitd container is not running, starting it...")
if err := startBuildkit(ctx); err != nil {
return err
}
}
}
return nil
}
func checkDocker(ctx context.Context) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
cmd := exec.CommandContext(ctx, "docker", "info")
output, err := cmd.CombinedOutput()
if err != nil {
log.
Ctx(ctx).
Error().
Err(err).
Bytes("output", output).
Msg("failed to run docker")
return err
}
return nil
}
func startBuildkit(ctx context.Context) error {
cmd := exec.CommandContext(ctx,
"docker",
"start",
containerName,
)
_, err := cmd.CombinedOutput()
if err != nil {
return err
}
return waitBuildkit(ctx)
}
func installBuildkit(ctx context.Context, version string) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
cmd := exec.CommandContext(ctx,
"docker",
"pull",
image+":"+version,
)
_, err := cmd.CombinedOutput()
if err != nil {
return err
}
cmd = exec.CommandContext(ctx,
"docker",
"run",
"-d",
"--restart", "always",
"-v", volumeName+":/var/lib/buildkit",
"--name", containerName,
"--privileged",
image+":"+version,
"--debug",
)
output, err := cmd.CombinedOutput()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
if !strings.Contains(string(output), "Error response from daemon: Conflict.") {
return err
}
}
return waitBuildkit(ctx)
}
func waitBuildkit(ctx context.Context) error {
c, err := bkclient.New(ctx, "docker-container://"+containerName)
if err != nil {
return err
}
defer c.Close()
const (
retryPeriod = 100 * time.Millisecond
retryAttempts = 100
)
for retry := 0; retry < retryAttempts; retry++ {
_, err = c.ListWorkers(ctx)
if err == nil {
return nil
}
time.Sleep(retryPeriod)
}
return errors.New("buildkit failed to respond")
}
func removeBuildkit(ctx context.Context) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
cmd := exec.CommandContext(ctx,
"docker",
"rm",
"-fv",
containerName,
)
_, err := cmd.CombinedOutput()
if err != nil {
return err
}
return nil
}
func getBuildkitInformation(ctx context.Context) (*buildkitInformation, error) {
formatString := "{{.Config.Image}};{{.State.Running}};{{if index .NetworkSettings.Networks \"host\"}}{{\"true\"}}{{else}}{{\"false\"}}{{end}}"
cmd := exec.CommandContext(ctx,
"docker",
"inspect",
"--format",
formatString,
containerName,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,015 |
Better error message when docker is not running
|
If docker isn't running and tries to spin up the automatic buildkitd, cloak just says `exit status 1`. We should be able to check this situation and give a better error.
|
https://github.com/dagger/dagger/issues/3015
|
https://github.com/dagger/dagger/pull/3185
|
c9b294a4cf6a0ce994f4014d2d9d76b30bfe6f3d
|
14b6907c376edd5430b30ca5152e3d3988683f5e
| 2022-09-14T20:05:21Z |
go
| 2022-09-30T02:51:19Z |
internal/buildkitd/buildkitd.go
|
)
output, err := cmd.CombinedOutput()
if err != nil {
return nil, err
}
s := strings.Split(string(output), ";")
ref, err := reference.ParseNormalizedNamed(strings.TrimSpace(s[0]))
if err != nil {
return nil, err
}
tag, ok := ref.(reference.Tagged)
if !ok {
return nil, fmt.Errorf("failed to parse image: %s", output)
}
isActive, err := strconv.ParseBool(strings.TrimSpace(s[1]))
if err != nil {
return nil, err
}
return &buildkitInformation{
Version: tag.Tag(),
IsActive: isActive,
}, nil
}
type buildkitInformation struct {
Version string
IsActive bool
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
core/integration/project_test.go
|
package core
import (
"context"
"testing"
"github.com/Khan/genqlient/graphql"
"github.com/stretchr/testify/require"
"go.dagger.io/dagger/engine"
)
func TestExtensionMount(t *testing.T) {
startOpts := &engine.Config{
Workdir: "../../",
ConfigPath: "core/integration/testdata/extension/cloak.yaml",
}
err := engine.Start(context.Background(), startOpts, func(ctx engine.Context) error {
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
core/integration/project_test.go
|
Core struct {
Filesystem struct {
WriteFile struct {
ID string `json:"id"`
}
}
}
}{}
err := ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `{
core {
filesystem(id: "scratch") {
writeFile(path: "/foo", contents: "bar") {
id
}
}
}
}`,
},
&graphql.Response{Data: &res},
)
require.NoError(t, err)
res2 := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
core/integration/project_test.go
|
Test struct {
TestMount string
}
}{}
err = ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: `query TestMount($in: FSID!) {
test {
testMount(in: $in)
}
}`,
Variables: map[string]any{
"in": res.Core.Filesystem.WriteFile.ID,
},
},
&graphql.Response{Data: &res2},
)
require.NoError(t, err)
require.Equal(t, res2.Test.TestMount, "bar")
return nil
})
require.NoError(t, err)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
internal/testutil/query.go
|
package testutil
import (
"context"
"os"
"github.com/Khan/genqlient/graphql"
"go.dagger.io/dagger/engine"
"go.dagger.io/dagger/internal/buildkitd"
"go.dagger.io/dagger/sdk/go/dagger"
)
type QueryOptions struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
internal/testutil/query.go
|
Variables map[string]any
Secrets map[string]string
Operation string
}
func Query(query string, res any, opts *QueryOptions) error {
if opts == nil {
opts = &QueryOptions{}
}
if opts.Variables == nil {
opts.Variables = make(map[string]any)
}
if opts.Secrets == nil {
opts.Secrets = make(map[string]string)
}
return engine.Start(context.Background(), nil, func(ctx engine.Context) error {
if err := addSecrets(ctx, ctx.Client, opts); err != nil {
return err
}
return ctx.Client.MakeRequest(ctx,
&graphql.Request{
Query: query,
Variables: opts.Variables,
OpName: opts.Operation,
},
&graphql.Response{Data: &res},
)
})
}
func addSecrets(ctx context.Context, cl graphql.Client, opts *QueryOptions) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
internal/testutil/query.go
|
for name, plaintext := range opts.Secrets {
addSecret := struct {
Core struct {
AddSecret dagger.SecretID
}
}{}
err := cl.MakeRequest(ctx,
&graphql.Request{
Query: `query AddSecret($plaintext: String!) {
core {
addSecret(plaintext: $plaintext)
}
}`,
Variables: map[string]string{
"plaintext": plaintext,
},
},
&graphql.Response{Data: &addSecret},
)
if err != nil {
return err
}
opts.Variables[name] = addSecret.Core.AddSecret
}
return nil
}
func SetupBuildkitd() error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
internal/testutil/query.go
|
host, err := buildkitd.StartGoModBuildkitd(context.Background())
if err != nil {
return err
}
os.Setenv("BUILDKIT_HOST", host)
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
project/gogenerate.go
|
package project
import (
"context"
"embed"
"io/fs"
"path/filepath"
"sort"
"github.com/moby/buildkit/client/llb"
"go.dagger.io/dagger/core/filesystem"
)
var goGenerateSrc embed.FS
func (s RemoteSchema) goGenerate(ctx context.Context, subpath, schema, coreSchema string) (*filesystem.Filesystem, error) {
projectFS, err := s.contextFS.ToState()
if err != nil {
return nil, err
}
base := goBase(s.gw)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
project/gogenerate.go
|
entries, err := fs.ReadDir(goGenerateSrc, "go")
if err != nil {
return nil, err
}
base = base.File(llb.Mkdir("/tools", 0755))
sort.Slice(entries, func(i, j int) bool {
return entries[i].Name() < entries[j].Name()
})
for _, e := range entries {
contents, err := fs.ReadFile(goGenerateSrc, filepath.Join("go", e.Name()))
if err != nil {
return nil, err
}
base = base.File(llb.Mkfile(
filepath.Join("/tools", e.Name()),
e.Type().Perm(),
contents,
))
}
base = base.Run(
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,019 |
`cloak generate` does nothing when workdir and extension path are the same
|
If `go.mod` is missing for a go extension, then `go generate` will create the `gen` dir successfully but just skip making the generated go code. This should instead be an error case.
|
https://github.com/dagger/dagger/issues/3019
|
https://github.com/dagger/dagger/pull/3189
|
14b6907c376edd5430b30ca5152e3d3988683f5e
|
80808d35abbcf478baa260ea4f9d46bcb92c24a4
| 2022-09-13T16:49:36Z |
go
| 2022-09-30T14:34:28Z |
project/gogenerate.go
|
shell(
`go mod init cloakgenerate`,
`go work init`,
`go work use .`,
`go work use -r /src`,
`go build -o generate generate.go`,
),
llb.Dir("/tools"),
llb.AddMount("/src", projectFS, llb.Readonly),
llb.AddEnv("CGO_ENABLED", "0"),
withGoCaching(),
).Root()
projectSubpath := filepath.Join(filepath.Dir(s.configPath), subpath)
outputDir := filepath.Join("/src", projectSubpath)
projectFS = base.Run(
llb.Shlex("./generate"),
llb.Dir("/tools"),
llb.AddMount("/src", projectFS, llb.Readonly),
llb.AddMount(outputDir, projectFS, llb.SourcePath(projectSubpath)),
llb.AddEnv("CGO_ENABLED", "0"),
llb.AddEnv("GENERATE_OUTPUT_DIR", outputDir),
llb.AddEnv("SCHEMA", schema),
llb.AddEnv("CORE_SCHEMA", coreSchema),
withGoCaching(),
).GetMount(outputDir)
return filesystem.FromState(ctx, projectFS, s.platform)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/core.go
|
package core
import (
"context"
"encoding/json"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"go.dagger.io/dagger/core/filesystem"
"go.dagger.io/dagger/project"
"go.dagger.io/dagger/router"
"go.dagger.io/dagger/secret"
)
type InitializeArgs struct {
Router *router.Router
SecretStore *secret.Store
SSHAuthSockID string
WorkdirID string
Gateway bkgw.Client
BKClient *bkclient.Client
SolveOpts bkclient.SolveOpt
SolveCh chan *bkclient.SolveStatus
Platform specs.Platform
}
func New(params InitializeArgs) (router.ExecutableSchema, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/core.go
|
base := &baseSchema{
router: params.Router,
secretStore: params.SecretStore,
gw: params.Gateway,
bkClient: params.BKClient,
solveOpts: params.SolveOpts,
solveCh: params.SolveCh,
platform: params.Platform,
sshAuthSockID: params.SSHAuthSockID,
}
return router.MergeExecutableSchemas("core",
&coreSchema{base, params.WorkdirID},
&directorySchema{base},
&fileSchema{base},
&gitSchema{base},
&containerSchema{base},
&filesystemSchema{base},
&projectSchema{
baseSchema: base,
remoteSchemas: make(map[string]*project.RemoteSchema),
compiledSchemas: make(map[string]*project.CompiledRemoteSchema),
},
&execSchema{base},
&dockerBuildSchema{base},
&secretSchema{base},
)
}
type baseSchema struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/core.go
|
router *router.Router
secretStore *secret.Store
gw bkgw.Client
bkClient *bkclient.Client
solveOpts bkclient.SolveOpt
solveCh chan *bkclient.SolveStatus
platform specs.Platform
sshAuthSockID string
}
func (r *baseSchema) Solve(ctx context.Context, st llb.State, marshalOpts ...llb.ConstraintsOpt) (*filesystem.Filesystem, error) {
marshalOpts = append([]llb.ConstraintsOpt{llb.Platform(r.platform)}, marshalOpts...)
inputCfg, err := filesystem.ImageConfigFromState(ctx, st)
if err != nil {
return nil, err
}
input, err := st.Marshal(ctx, marshalOpts...)
if err != nil {
return nil, err
}
res, err := r.gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: input.ToPB(),
})
if err != nil {
return nil, err
}
bkref, err := res.SingleRef()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/core.go
|
if err != nil {
return nil, err
}
resSt, err := bkref.ToState()
if err != nil {
return nil, err
}
img, err := filesystem.ImageFromStateAndConfig(ctx, resSt, inputCfg, marshalOpts...)
if err != nil {
return nil, err
}
return img.ToFilesystem()
}
func (r *baseSchema) Export(ctx context.Context, fs *filesystem.Filesystem, export bkclient.ExportEntry) error {
fsDef, err := fs.ToDefinition()
if err != nil {
return err
}
img, err := fs.ToImage()
if err != nil {
return err
}
cfgBytes, err := json.Marshal(specs.Image{
Architecture: r.platform.Architecture,
OS: r.platform.OS,
OSVersion: r.platform.OSVersion,
OSFeatures: r.platform.OSFeatures,
Config: img.Config,
})
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/core.go
|
return err
}
solveOpts := r.solveOpts
solveOpts.Exports = []bkclient.ExportEntry{export}
ch := make(chan *bkclient.SolveStatus)
go func() {
for event := range ch {
r.solveCh <- event
}
}()
_, err = r.bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: fsDef,
})
if err != nil {
return nil, err
}
res.AddMeta(exptypes.ExporterImageConfigKey, cfgBytes)
return res, nil
}, ch)
if err != nil {
return err
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,181 |
implement `HTTP` core API
|
The `HTTP` API can be implemented at any time now that `File` and `Directory` are implemented. Nothing depends on it.
https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/schema/http.graphqls#L2-L14
See [`core/file.go`](https://github.com/dagger/dagger/blob/03ea15e68fcc46f2c51bc829fd0d24e97d88c576/core/file.go) for reference.
This can be implemented using [`llb.HTTP`](https://pkg.go.dev/github.com/moby/[email protected]/client/llb#HTTP).
|
https://github.com/dagger/dagger/issues/3181
|
https://github.com/dagger/dagger/pull/3223
|
009c430550df8b3f52fe5f8a8a68aea8706d22b3
|
8e2944c43bfd99a8ef053d7a776afff501815851
| 2022-09-29T18:56:02Z |
go
| 2022-10-04T17:34:31Z |
core/schema/fs.go
|
package schema
import _ "embed"
var Git string
var Directory string
var File string
var Container string
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
package core
import (
"context"
"encoding/json"
"fmt"
"path"
"strconv"
"strings"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"go.dagger.io/dagger/core/shim"
)
type Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
ID ContainerID `json:"id"`
}
type ContainerAddress string
type ContainerID string
func (id ContainerID) decode() (*containerIDPayload, error) {
if id == "" {
return &containerIDPayload{}, nil
}
var payload containerIDPayload
if err := decodeID(&payload, id); err != nil {
return nil, err
}
return &payload, nil
}
type containerIDPayload struct {
FS *pb.Definition `json:"fs"`
Config specs.ImageConfig `json:"cfg"`
Mounts []ContainerMount `json:"mounts,omitempty"`
Meta *pb.Definition `json:"meta,omitempty"`
Platform specs.Platform `json:"platform,omitempty"`
Secrets []ContainerSecret `json:"secret_env,omitempty"`
}
type ContainerSecret struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
Secret SecretID `json:"secret"`
EnvName string `json:"env,omitempty"`
MountPath string `json:"path,omitempty"`
}
func (payload *containerIDPayload) Encode() (ContainerID, error) {
id, err := encodeID(payload)
if err != nil {
return "", err
}
return ContainerID(id), nil
}
func (payload *containerIDPayload) FSState() (llb.State, error) {
if payload.FS == nil {
return llb.Scratch(), nil
}
return defToState(payload.FS)
}
const metaMount = "/dagger"
const metaSourcePath = "meta"
func (payload *containerIDPayload) MetaState() (*llb.State, error) {
if payload.Meta == nil {
return nil, nil
}
metaSt, err := defToState(payload.Meta)
if err != nil {
return nil, err
}
return &metaSt, nil
}
type ContainerMount struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
Source *pb.Definition `json:"source,omitempty"`
SourcePath string `json:"source_path,omitempty"`
Target string `json:"target"`
CacheID string `json:"cache_id,omitempty"`
CacheSharingMode string `json:"cache_sharing,omitempty"`
Tmpfs bool `json:"tmpfs,omitempty"`
}
func (mnt ContainerMount) SourceState() (llb.State, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if mnt.Source == nil {
return llb.Scratch(), nil
}
return defToState(mnt.Source)
}
func (container *Container) FS(ctx context.Context) (*Directory, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
st, err := payload.FSState()
if err != nil {
return nil, err
}
return NewDirectory(ctx, st, "", payload.Platform)
}
func (container *Container) WithFS(ctx context.Context, st llb.State, platform specs.Platform) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
stDef, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
payload.FS = stDef.ToPB()
payload.Platform = platform
id, err := payload.Encode()
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedDirectory(ctx context.Context, target string, source *Directory) (*Container, error) {
return container.withMounted(ctx, target, source)
}
func (container *Container) WithMountedFile(ctx context.Context, target string, source *File) (*Container, error) {
return container.withMounted(ctx, target, source)
}
func (container *Container) WithMountedCache(ctx context.Context, target string, cache CacheID, source *Directory) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
cachePayload, err := cache.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
mount := ContainerMount{
Target: target,
CacheID: cachePayload.Sum(),
CacheSharingMode: "shared",
}
if source != nil {
dirSt, dirRel, dirPlatform, err := source.Decode()
if err != nil {
return nil, err
}
dirDef, err := dirSt.Marshal(ctx, llb.Platform(dirPlatform))
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if err != nil {
return nil, err
}
mount.Source = dirDef.ToPB()
mount.SourcePath = dirRel
}
payload.Mounts = append(payload.Mounts, mount)
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
payload.Mounts = append(payload.Mounts, ContainerMount{
Target: target,
Tmpfs: true,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret) (*Container, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
payload.Secrets = append(payload.Secrets, ContainerSecret{
Secret: source.ID,
MountPath: target,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
var found bool
var foundIdx int
for i := len(payload.Mounts) - 1; i >= 0; i-- {
if payload.Mounts[i].Target == target {
found = true
foundIdx = i
break
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if found {
payload.Mounts = append(payload.Mounts[:foundIdx], payload.Mounts[foundIdx+1:]...)
}
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) Mounts(ctx context.Context) ([]string, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
mounts := []string{}
for _, mnt := range payload.Mounts {
mounts = append(mounts, mnt.Target)
}
return mounts, nil
}
func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
payload.Secrets = append(payload.Secrets, ContainerSecret{
Secret: secret.ID,
EnvName: name,
})
id, err := payload.Encode()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
dirPath = absPath(payload.Config.WorkingDir, dirPath)
var dir *Directory
for i := len(payload.Mounts) - 1; i >= 0; i-- {
mnt := payload.Mounts[i]
if dirPath == mnt.Target || strings.HasPrefix(dirPath, mnt.Target+"/") {
if mnt.Tmpfs {
return nil, fmt.Errorf("%s: cannot retrieve directory from tmpfs", dirPath)
}
if mnt.CacheID != "" {
return nil, fmt.Errorf("%s: cannot retrieve directory from cache", dirPath)
}
st, err := mnt.SourceState()
if err != nil {
return nil, err
}
sub := mnt.SourcePath
if dirPath != mnt.Target {
dirSub := strings.TrimPrefix(dirPath, mnt.Target+"/")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if dirSub != "" {
sub = path.Join(sub, dirSub)
}
}
dir, err = NewDirectory(ctx, st, sub, payload.Platform)
if err != nil {
return nil, err
}
break
}
}
if dir == nil {
st, err := payload.FSState()
if err != nil {
return nil, err
}
dir, err = NewDirectory(ctx, st, dirPath, payload.Platform)
if err != nil {
return nil, err
}
}
_, err = dir.Stat(ctx, gw, ".")
if err != nil {
return nil, err
}
return dir, nil
}
type mountable interface {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
Decode() (llb.State, string, specs.Platform, error)
}
func (container *Container) withMounted(ctx context.Context, target string, source mountable) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
srcSt, srcRel, srcPlatform, err := source.Decode()
if err != nil {
return nil, err
}
srcDef, err := srcSt.Marshal(ctx, llb.Platform(srcPlatform))
if err != nil {
return nil, err
}
payload.Mounts = append(payload.Mounts, ContainerMount{
Source: srcDef.ToPB(),
SourcePath: srcRel,
Target: target,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error) {
payload, err := container.ID.decode()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
return specs.ImageConfig{}, err
}
return payload.Config, nil
}
func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
payload.Config = updateFn(payload.Config)
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) Exec(ctx context.Context, gw bkgw.Client, args *[]string, opts ContainerExecOpts) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, fmt.Errorf("decode id: %w", err)
}
cfg := payload.Config
mounts := payload.Mounts
platform := payload.Platform
shimSt, err := shim.Build(ctx, gw, platform)
if err != nil {
return nil, fmt.Errorf("build shim: %w", err)
}
if args == nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
args = &[]string{}
} else if len(*args) == 0 {
*args = cfg.Cmd
}
if len(cfg.Entrypoint) > 0 {
*args = append(cfg.Entrypoint, *args...)
}
runOpts := []llb.RunOption{
llb.AddMount(shim.Path, shimSt, llb.SourcePath(shim.Path)),
llb.Args(append([]string{shim.Path}, *args...)),
llb.WithCustomName(strings.Join(*args, " ")),
llb.AddMount(
metaMount,
llb.Scratch().File(llb.Mkdir(metaSourcePath, 0777)),
llb.SourcePath(metaSourcePath)),
}
if cfg.User != "" {
runOpts = append(runOpts, llb.User(cfg.User))
}
if cfg.WorkingDir != "" {
runOpts = append(runOpts, llb.Dir(cfg.WorkingDir))
}
for _, env := range cfg.Env {
name, val, ok := strings.Cut(env, "=")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
if !ok {
_ = ok
}
runOpts = append(runOpts, llb.AddEnv(name, val))
}
for i, secret := range payload.Secrets {
secretOpts := []llb.SecretOption{llb.SecretID(string(secret.Secret))}
var secretDest string
switch {
case secret.EnvName != "":
secretDest = secret.EnvName
secretOpts = append(secretOpts, llb.SecretAsEnv(true))
case secret.MountPath != "":
secretDest = secret.MountPath
default:
return nil, fmt.Errorf("malformed secret config at index %d", i)
}
runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...))
}
fsSt, err := payload.FSState()
if err != nil {
return nil, fmt.Errorf("fs state: %w", err)
}
execSt := fsSt.Run(runOpts...)
for i, mnt := range mounts {
srcSt, err := mnt.SourceState()
if err != nil {
return nil, fmt.Errorf("mount %s: %w", mnt.Target, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
}
mountOpts := []llb.MountOption{}
if mnt.SourcePath != "" {
mountOpts = append(mountOpts, llb.SourcePath(mnt.SourcePath))
}
if mnt.CacheSharingMode != "" {
var sharingMode llb.CacheMountSharingMode
switch mnt.CacheSharingMode {
case "shared":
sharingMode = llb.CacheMountShared
case "private":
sharingMode = llb.CacheMountPrivate
case "locked":
sharingMode = llb.CacheMountLocked
default:
return nil, errors.Errorf("invalid cache mount sharing mode %q", mnt.CacheSharingMode)
}
mountOpts = append(mountOpts, llb.AsPersistentCacheDir(mnt.CacheID, sharingMode))
}
if mnt.Tmpfs {
mountOpts = append(mountOpts, llb.Tmpfs())
}
mountSt := execSt.AddMount(mnt.Target, srcSt, mountOpts...)
if !mnt.Tmpfs && mnt.CacheID == "" {
execMountDef, err := mountSt.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("propagate %s: %w", mnt.Target, err)
}
mounts[i].Source = execMountDef.ToPB()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
}
}
execDef, err := execSt.Root().Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("marshal root: %w", err)
}
metaDef, err := execSt.GetMount(metaMount).Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("get meta mount: %w", err)
}
payload.FS = execDef.ToPB()
payload.Mounts = mounts
payload.Meta = metaDef.ToPB()
id, err := payload.Encode()
if err != nil {
return nil, fmt.Errorf("encode: %w", err)
}
return &Container{ID: id}, nil
}
func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client) (*int, error) {
file, err := container.MetaFile(ctx, gw, "exitCode")
if err != nil {
return nil, err
}
if file == nil {
return nil, nil
}
content, err := file.Contents(ctx, gw)
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
}
exitCode, err := strconv.Atoi(string(content))
if err != nil {
return nil, err
}
return &exitCode, nil
}
func (container *Container) MetaFile(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
meta, err := payload.MetaState()
if err != nil {
return nil, err
}
if meta == nil {
return nil, nil
}
return NewFile(ctx, *meta, path.Join(metaSourcePath, filePath), payload.Platform)
}
func (container *Container) Publish(
ctx context.Context,
ref ContainerAddress,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
) (ContainerAddress, error) {
payload, err := container.ID.decode()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
return "", err
}
st, err := payload.FSState()
if err != nil {
return "", err
}
stDef, err := st.Marshal(ctx, llb.Platform(payload.Platform))
if err != nil {
return "", err
}
cfgBytes, err := json.Marshal(specs.Image{
Architecture: payload.Platform.Architecture,
OS: payload.Platform.OS,
OSVersion: payload.Platform.OSVersion,
OSFeatures: payload.Platform.OSFeatures,
Config: payload.Config,
})
if err != nil {
return "", err
}
solveOpts.Exports = []bkclient.ExportEntry{
{
Type: bkclient.ExporterImage,
Attrs: map[string]string{
"name": string(ref),
"push": "true",
},
},
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/container.go
|
ch := make(chan *bkclient.SolveStatus)
go func() {
for event := range ch {
solveCh <- event
}
}()
_, err = bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: stDef.ToPB(),
})
if err != nil {
return nil, err
}
res.AddMeta(exptypes.ExporterImageConfigKey, cfgBytes)
return res, nil
}, ch)
if err != nil {
return "", err
}
return ref, nil
}
type ContainerExecOpts struct {
Stdin *string
RedirectStdout *string
RedirectStderr *string
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/integration/container_test.go
|
package core
import (
"context"
"testing"
"github.com/Khan/genqlient/graphql"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
"go.dagger.io/dagger/core"
"go.dagger.io/dagger/engine"
"go.dagger.io/dagger/internal/testutil"
)
func TestContainerScratch(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,266 |
Container: add `file`
|
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
|
https://github.com/dagger/dagger/issues/3266
|
https://github.com/dagger/dagger/pull/3303
|
09c6e1f7a6405646a3c3733e9284ba94e959da36
|
44fb6275fcd9a789c905dc3570a8a506df598c36
| 2022-10-06T02:10:11Z |
go
| 2022-10-12T01:34:30Z |
core/integration/container_test.go
|
Container struct {
ID string
Rootfs struct {
Contents []string
}
}
}{}
err := testutil.Query(
`{
container {
id
rootfs {
contents
}
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Container.ID)
require.Empty(t, res.Container.Rootfs.Contents)
}
func TestContainerFrom(t *testing.T) {
t.Parallel()
res := struct {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.