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 | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | ID ProjectID
}
func (r *Client) Project(opts ...ProjectOpts) *Project {
q := r.q.Select("project")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ID) {
q = q.Arg("id", opts[i].ID)
}
}
return &Project{
q: q,
c: r.c,
}
}
type ProjectCommandOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | ID ProjectCommandID
}
func (r *Client) ProjectCommand(opts ...ProjectCommandOpts) *ProjectCommand {
q := r.q.Select("projectCommand")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ID) {
q = q.Arg("id", opts[i].ID)
}
}
return &ProjectCommand{
q: q,
c: r.c,
}
}
func (r *Client) Secret(id SecretID) *Secret {
q := r.q.Select("secret")
q = q.Arg("id", id)
return &Secret{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | q: q,
c: r.c,
}
}
func (r *Client) SetSecret(name string, plaintext string) *Secret {
q := r.q.Select("setSecret")
q = q.Arg("name", name)
q = q.Arg("plaintext", plaintext)
return &Secret{
q: q,
c: r.c,
}
}
type SocketOpts struct {
ID SocketID
}
func (r *Client) Socket(opts ...SocketOpts) *Socket {
q := r.q.Select("socket")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ID) {
q = q.Arg("id", opts[i].ID)
}
}
return &Socket{
q: q,
c: r.c,
}
}
type Secret struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
id *SecretID
plaintext *string
}
func (r *Secret) ID(ctx context.Context) (SecretID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response SecretID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Secret) XXX_GraphQLType() string {
return "Secret"
}
func (r *Secret) XXX_GraphQLIDType() string {
return "SecretID"
}
func (r *Secret) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | if err != nil {
return "", err
}
return string(id), nil
}
func (r *Secret) Plaintext(ctx context.Context) (string, error) {
if r.plaintext != nil {
return *r.plaintext, nil
}
q := r.q.Select("plaintext")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Socket struct {
q *querybuilder.Selection
c graphql.Client
id *SocketID
}
func (r *Socket) ID(ctx context.Context) (SocketID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response SocketID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Socket) XXX_GraphQLType() string {
return "Socket" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,367 | π Unable to get digest of GitRef | ### What is the issue?
Calling `digest()` on a GitRef object instance fails with `dagger.exceptions.QueryError: not implemented yet` exception
### Log output
```
Connected to engine 974d679fe8b2
Traceback (most recent call last):
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 170, in _handle_execute
yield
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 107, in execute
result = await self.session.execute(query)
File "<PATH>/lib/python3.10/site-packages/gql/client.py", line 1231, in execute
raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'not implemented yet', 'locations': [{'line': 4, 'column': 7}], 'path': ['git', 'branch', 'digest']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<PATH>/.github/workflows/minimal.py", line 13, in <module>
anyio.run(main)
File "<PATH>/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "<PATH>/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "<PATH>/.github/workflows/minimal.py", line 10, in main
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
File "<@beartype(dagger.api.gen.GitRef.digest) at 0x7f282ca6f6d0>", line 10, in digest
File "<PATH>/lib/python3.10/site-packages/dagger/api/gen.py", line 2155, in digest
return await _ctx.execute(str)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 106, in execute
with self._handle_execute(query):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "<PATH>/lib/python3.10/site-packages/dagger/api/base.py", line 196, in _handle_execute
raise error from e
dagger.exceptions.QueryError: not implemented yet
```
### Steps to reproduce
```python3
import sys, anyio, dagger
async def main():
config = dagger.Config(log_output=sys.stdout)
async with dagger.Connection(config) as client:
git_digest = await client.git("https://github.com/dagger/examples.git").branch("main").digest()
print(git_digest)
anyio.run(main)
```
### SDK version
Python SDK v0.6.2
### OS version
Linux Mint 21.1, Python 3.10 | https://github.com/dagger/dagger/issues/5367 | https://github.com/dagger/dagger/pull/5410 | 92e7a4b1d23e0f4bb67f38cf0cbbbc5e82298e4e | 9ec0d6a9625c85655e8d82f241771470fe6998aa | 2023-06-25T11:51:01Z | go | 2023-07-06T13:15:25Z | sdk/go/api.gen.go | }
func (r *Socket) XXX_GraphQLIDType() string {
return "SocketID"
}
func (r *Socket) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
type CacheSharingMode string
const (
Locked CacheSharingMode = "LOCKED"
Private CacheSharingMode = "PRIVATE"
Shared CacheSharingMode = "SHARED"
)
type ImageLayerCompression string
const (
Estargz ImageLayerCompression = "EStarGZ"
Gzip ImageLayerCompression = "Gzip"
Uncompressed ImageLayerCompression = "Uncompressed"
Zstd ImageLayerCompression = "Zstd"
)
type NetworkProtocol string
const (
Tcp NetworkProtocol = "TCP"
Udp NetworkProtocol = "UDP"
) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | package core
import (
"context"
"fmt"
"io/fs"
"path"
"path/filepath"
"reflect"
"strings"
"time"
"github.com/dagger/dagger/core/pipeline"
"github.com/dagger/dagger/router"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
fstypes "github.com/tonistiigi/fsutil/types"
)
type Directory struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | LLB *pb.Definition `json:"llb"`
Dir string `json:"dir"`
Platform specs.Platform `json:"platform"`
Pipeline pipeline.Path `json:"pipeline"`
Services ServiceBindings `json:"services,omitempty"`
}
func NewDirectory(ctx context.Context, def *pb.Definition, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) *Directory {
return &Directory{
LLB: def,
Dir: dir,
Platform: platform,
Pipeline: pipeline.Copy(),
Services: services,
}
}
func NewScratchDirectory(pipeline pipeline.Path, platform specs.Platform) *Directory {
return &Directory{
Dir: "/",
Platform: platform,
Pipeline: pipeline.Copy(),
}
}
func NewDirectorySt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) (*Directory, error) {
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | }
return NewDirectory(ctx, def.ToPB(), dir, pipeline, platform, services), nil
}
func (dir *Directory) Clone() *Directory {
cp := *dir
cp.Pipeline = cloneSlice(cp.Pipeline)
cp.Services = cloneMap(cp.Services)
return &cp
}
type DirectoryID string
func (id DirectoryID) String() string {
return string(id)
}
var _ router.Digestible = DirectoryID("")
func (id DirectoryID) Digest() (digest.Digest, error) {
return digest.FromString(id.String()), nil
}
func (id DirectoryID) ToDirectory() (*Directory, error) {
var dir Directory
if id == "" {
return &dir, nil
}
if err := decodeID(&dir, id); err != nil {
return nil, err
}
return &dir, nil
}
func (dir *Directory) ID() (DirectoryID, error) {
return encodeID[DirectoryID](dir)
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | var _ router.Pipelineable = (*Directory)(nil)
func (dir *Directory) PipelinePath() pipeline.Path {
return dir.Pipeline
}
var _ router.Digestible = (*Directory)(nil)
func (dir *Directory) Digest() (digest.Digest, error) {
id, err := dir.ID()
if err != nil {
return "", err
}
return id.Digest()
}
func (dir *Directory) State() (llb.State, error) {
if dir.LLB == nil {
return llb.Scratch(), nil
}
return defToState(dir.LLB)
}
func (dir *Directory) StateWithSourcePath() (llb.State, error) {
dirSt, err := dir.State()
if err != nil {
return llb.State{}, err
}
if dir.Dir == "/" {
return dirSt, nil
}
return llb.Scratch().File(
llb.Copy(dirSt, dir.Dir, ".", &llb.CopyInfo{
CopyDirContentsOnly: true, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | }),
), nil
}
func (dir *Directory) SetState(ctx context.Context, st llb.State) error {
def, err := st.Marshal(ctx, llb.Platform(dir.Platform))
if err != nil {
return nil
}
dir.LLB = def.ToPB()
return nil
}
func (dir *Directory) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Directory, error) {
dir = dir.Clone()
dir.Pipeline = dir.Pipeline.Add(pipeline.Pipeline{
Name: name,
Description: description,
Labels: labels,
})
return dir, nil
}
func (dir *Directory) Evaluate(ctx context.Context, gw bkgw.Client) error {
if dir.LLB == nil {
return nil
}
_, err := WithServices(ctx, gw, dir.Services, func() (*bkgw.Result, error) {
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: dir.LLB,
})
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | return err
}
func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error) {
src = path.Join(dir.Dir, src)
return WithServices(ctx, gw, dir.Services, func() (*fstypes.Stat, error) {
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: dir.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
if ref == nil {
if clean := path.Clean(src); clean == "." || clean == "/" {
return &fstypes.Stat{
Path: src,
Mode: uint32(fs.ModeDir),
}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
return ref.StatFile(ctx, bkgw.StatRequest{
Path: src,
})
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | }
func (dir *Directory) Entries(ctx context.Context, gw bkgw.Client, src string) ([]string, error) {
src = path.Join(dir.Dir, src)
return WithServices(ctx, gw, dir.Services, func() ([]string, error) {
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: dir.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
if ref == nil {
if clean := path.Clean(src); clean == "." || clean == "/" {
return []string{}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
entries, err := ref.ReadDir(ctx, bkgw.ReadDirRequest{
Path: src,
})
if err != nil {
return nil, err
}
paths := []string{}
for _, entry := range entries {
paths = append(paths, entry.GetPath()) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | }
return paths, nil
})
}
func (dir *Directory) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode, ownership *Ownership) (*Directory, error) {
dir = dir.Clone()
err := validateFileName(dest)
if err != nil {
return nil, err
}
if permissions == 0 {
permissions = 0o644
}
dest = path.Join(dir.Dir, dest)
st, err := dir.State()
if err != nil {
return nil, err
}
parent, _ := path.Split(dest)
if parent != "" {
st = st.File(llb.Mkdir(parent, 0755, llb.WithParents(true)))
}
opts := []llb.MkfileOption{}
if ownership != nil {
opts = append(opts, ownership.Opt())
}
st = st.File(llb.Mkfile(dest, permissions, content, opts...))
err = dir.SetState(ctx, st)
if err != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | return nil, err
}
return dir, nil
}
func (dir *Directory) Directory(ctx context.Context, gw bkgw.Client, subdir string) (*Directory, error) {
dir = dir.Clone()
dir.Dir = path.Join(dir.Dir, subdir)
info, err := dir.Stat(ctx, gw, ".")
if err != nil {
return nil, err
}
if !info.IsDir() {
return nil, fmt.Errorf("path %s is a file, not a directory", subdir)
}
return dir, nil
}
func (dir *Directory) File(ctx context.Context, gw bkgw.Client, file string) (*File, error) {
err := validateFileName(file)
if err != nil {
return nil, err
}
info, err := dir.Stat(ctx, gw, file)
if err != nil {
return nil, err
}
if info.IsDir() { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | return nil, fmt.Errorf("path %s is a directory, not a file", file)
}
return &File{
LLB: dir.LLB,
File: path.Join(dir.Dir, file),
Pipeline: dir.Pipeline,
Platform: dir.Platform,
Services: dir.Services,
}, nil
}
func (dir *Directory) WithDirectory(ctx context.Context, destDir string, src *Directory, filter CopyFilter, owner *Ownership) (*Directory, error) {
dir = dir.Clone()
destSt, err := dir.State()
if err != nil {
return nil, err
}
srcSt, err := src.State()
if err != nil {
return nil, err
}
if err := dir.SetState(ctx, mergeStates(mergeStateInput{
Dest: destSt,
DestDir: path.Join(dir.Dir, destDir),
Src: srcSt,
SrcDir: src.Dir,
IncludePatterns: filter.Include,
ExcludePatterns: filter.Exclude,
Owner: owner,
})); err != nil {
return nil, err |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | }
dir.Services.Merge(src.Services)
return dir, nil
}
func (dir *Directory) WithFile(ctx context.Context, destPath string, src *File, permissions fs.FileMode, owner *Ownership) (*Directory, error) {
dir = dir.Clone()
destSt, err := dir.State()
if err != nil {
return nil, err
}
srcSt, err := src.State()
if err != nil {
return nil, err
}
if err := dir.SetState(ctx, mergeStates(mergeStateInput{
Dest: destSt,
DestDir: path.Join(dir.Dir, path.Dir(destPath)),
DestFileName: path.Base(destPath),
Src: srcSt,
SrcDir: path.Dir(src.File),
SrcFileName: path.Base(src.File),
Permissions: permissions,
Owner: owner,
})); err != nil {
return nil, err
}
dir.Services.Merge(src.Services)
return dir, nil
}
type mergeStateInput struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | Dest llb.State
DestDir string
DestFileName string
Src llb.State
SrcDir string
SrcFileName string
IncludePatterns []string
ExcludePatterns []string
Permissions fs.FileMode
Owner *Ownership
}
func mergeStates(input mergeStateInput) llb.State { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | input.DestDir = path.Join("/", input.DestDir)
input.SrcDir = path.Join("/", input.SrcDir)
copyInfo := &llb.CopyInfo{
CreateDestPath: true,
CopyDirContentsOnly: true,
IncludePatterns: input.IncludePatterns,
ExcludePatterns: input.ExcludePatterns,
}
if input.DestFileName == "" && input.SrcFileName != "" {
input.DestFileName = input.SrcFileName
}
if input.Permissions != 0 {
copyInfo.Mode = &input.Permissions
}
if input.Owner != nil {
input.Owner.Opt().SetCopyOption(copyInfo)
}
canDoDirectMerge := copyInfo.Mode == nil &&
copyInfo.ChownOpt == nil &&
len(copyInfo.ExcludePatterns) == 0 &&
len(copyInfo.IncludePatterns) == 0 &&
input.DestDir == input.SrcDir &&
input.DestFileName == "" && |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | input.SrcFileName == ""
mergeStates := []llb.State{input.Dest}
if canDoDirectMerge {
mergeStates = append(mergeStates, input.Src)
} else {
mergeStates = append(mergeStates, llb.Scratch().File(llb.Copy(
input.Src, path.Join(input.SrcDir, input.SrcFileName), path.Join(input.DestDir, input.DestFileName), copyInfo,
)))
}
return llb.Merge(mergeStates)
}
func (dir *Directory) WithTimestamps(ctx context.Context, unix int) (*Directory, error) {
dir = dir.Clone()
st, err := dir.State()
if err != nil {
return nil, err
}
t := time.Unix(int64(unix), 0)
st = llb.Scratch().File(
llb.Copy(st, dir.Dir, ".", &llb.CopyInfo{
CopyDirContentsOnly: true,
CreatedTime: &t,
}), |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | )
err = dir.SetState(ctx, st)
if err != nil {
return nil, err
}
dir.Dir = ""
return dir, nil
}
func (dir *Directory) WithNewDirectory(ctx context.Context, dest string, permissions fs.FileMode) (*Directory, error) {
dir = dir.Clone()
dest = path.Clean(dest)
if strings.HasPrefix(dest, "../") {
return nil, fmt.Errorf("cannot create directory outside parent: %s", dest)
}
dest = path.Join(dir.Dir, dest)
st, err := dir.State()
if err != nil {
return nil, err
}
if permissions == 0 {
permissions = 0755
}
st = st.File(llb.Mkdir(dest, permissions, llb.WithParents(true)))
err = dir.SetState(ctx, st)
if err != nil {
return nil, err
}
return dir, nil
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error) {
dir = dir.Clone()
if dir.Dir != other.Dir {
return nil, fmt.Errorf("TODO: cannot diff with different relative paths: %q != %q", dir.Dir, other.Dir)
}
if !reflect.DeepEqual(dir.Platform, other.Platform) {
return nil, fmt.Errorf("TODO: cannot diff across platforms: %+v != %+v", dir.Platform, other.Platform)
}
lowerSt, err := dir.State()
if err != nil {
return nil, err
}
upperSt, err := other.State()
if err != nil {
return nil, err
}
err = dir.SetState(ctx, llb.Diff(lowerSt, upperSt))
if err != nil {
return nil, err
}
return dir, nil
}
func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error) {
dir = dir.Clone()
st, err := dir.State()
if err != nil {
return nil, err
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | err = dir.SetState(ctx, st.File(llb.Rm(path, llb.WithAllowWildcard(true))))
if err != nil {
return nil, err
}
return dir, nil
}
func (dir *Directory) Export(
ctx context.Context,
host *Host,
dest string,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
) error {
dest, err := host.NormalizeDest(dest)
if err != nil {
return err
}
return host.Export(ctx, bkclient.ExportEntry{
Type: bkclient.ExporterLocal,
OutputDir: dest,
}, bkClient, solveOpts, solveCh, func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
return WithServices(ctx, gw, dir.Services, func() (*bkgw.Result, error) {
src, err := dir.State()
if err != nil {
return nil, err
}
var defPB *pb.Definition
if dir.Dir != "" {
src = llb.Scratch().File(llb.Copy(src, dir.Dir, ".", &llb.CopyInfo{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/directory.go | CopyDirContentsOnly: true,
}))
def, err := src.Marshal(ctx, llb.Platform(dir.Platform))
if err != nil {
return nil, err
}
defPB = def.ToPB()
} else {
defPB = dir.LLB
}
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: defPB,
})
})
})
}
func (dir *Directory) Root() (*Directory, error) {
dir = dir.Clone()
dir.Dir = "/"
return dir, nil
}
func validateFileName(file string) error {
baseFileName := filepath.Base(file)
if len(baseFileName) > 255 {
return errors.Errorf("File name length exceeds the maximum supported 255 characters")
}
return nil
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | package core
import (
"context"
"regexp"
"strings"
"testing"
"time"
"dagger.io/dagger"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/internal/testutil"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
)
func TestEmptyDirectory(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
ID core.DirectoryID
Entries []string
}
}
err := testutil.Query(
`{
directory {
entries
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Directory.Entries)
}
func TestScratchDirectory(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
defer c.Close()
_, err := c.Container().Directory("/").Entries(ctx)
require.NoError(t, err)
}
func TestDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
WithNewFile struct {
ID core.DirectoryID
Entries []string
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
id
entries
}
}
}`, &res, nil)
require.NoError(t, err)
require.NotEmpty(t, res.Directory.WithNewFile.ID)
require.Equal(t, []string{"some-file"}, res.Directory.WithNewFile.Entries)
}
func TestDirectoryEntries(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t, []string{"some-file", "some-dir"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryEntriesOfPath(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries(path: "some-dir")
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryDirectory(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
WithNewFile struct {
WithNewFile struct {
Directory struct {
Entries []string
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
entries
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Directory.Entries)
}
func TestDirectoryDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct {
Directory struct {
WithNewFile struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | WithNewFile struct {
Directory struct {
WithNewFile struct {
Entries []string
}
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
withNewFile(path: "another-file", contents: "more-content") {
entries
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t,
[]string{"sub-file", "another-file"},
res.Directory.WithNewFile.WithNewFile.Directory.WithNewFile.Entries)
}
func TestDirectoryWithDirectory(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
c, ctx := connect(t)
defer c.Close()
dir := c.Directory().
WithNewFile("some-file", "some-content").
WithNewFile("some-dir/sub-file", "sub-content").
Directory("some-dir")
entries, err := c.Directory().WithDirectory("with-dir", dir).Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
entries, err = c.Directory().WithDirectory("sub-dir/sub-sub-dir/with-dir", dir).Entries(ctx, dagger.DirectoryEntriesOpts{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Path: "sub-dir/sub-sub-dir/with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
t.Run("copies directory contents to .", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
})
t.Run("respects permissions", func(t *testing.T) {
dir := c.Directory().
WithNewFile("some-file", "some content", dagger.DirectoryWithNewFileOpts{Permissions: 0444}).
WithNewDirectory("some-dir", dagger.DirectoryWithNewDirectoryOpts{Permissions: 0444}).
WithNewFile("some-dir/sub-file", "sub-content", dagger.DirectoryWithNewFileOpts{Permissions: 0444})
ctr := c.Container().From("alpine").WithDirectory("/permissions-test", dir)
stdout, err := ctr.WithExec([]string{"ls", "-ld", "/permissions-test"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "drwxr-xr-x")
stdout, err = ctr.WithExec([]string{"ls", "-l", "/permissions-test/some-file"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "-r--r--r--")
stdout, err = ctr.WithExec([]string{"ls", "-ld", "/permissions-test/some-dir"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "dr--r--r--")
stdout, err = ctr.WithExec([]string{"ls", "-l", "/permissions-test/some-dir/sub-file"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "-r--r--r--")
})
}
func TestDirectoryWithDirectoryIncludeExclude(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
c, ctx := connect(t)
defer c.Close()
dir := c.Directory().
WithNewFile("a.txt", "").
WithNewFile("b.txt", "").
WithNewFile("c.txt.rar", "").
WithNewFile("subdir/d.txt", "").
WithNewFile("subdir/e.txt", "").
WithNewFile("subdir/f.txt.rar", "")
t.Run("exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir, dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt", "b.txt", "subdir"}, entries)
})
t.Run("include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir, dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"c.txt.rar"}, entries)
})
t.Run("exclude overrides include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir, dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.txt"}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Exclude: []string{"b.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt"}, entries)
})
t.Run("include does not override exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir, dagger.DirectoryWithDirectoryOpts{
Include: []string{"a.txt"},
Exclude: []string{"*.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{}, entries)
})
t.Run("exclude works on directory", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", dir, dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"subdir"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt", "b.txt", "c.txt.rar"}, entries)
})
subdir := dir.Directory("subdir")
t.Run("exclude respects subdir", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(".", subdir, dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"d.txt", "e.txt"}, entries)
})
}
func TestDirectoryWithNewDirectory(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
dir := c.Directory().
WithNewDirectory("a").
WithNewDirectory("b/c")
entries, err := dir.Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a", "b"}, entries)
entries, err = dir.Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "b",
})
require.NoError(t, err)
require.Equal(t, []string{"c"}, entries)
t.Run("does not permit creating directory outside of root", func(t *testing.T) {
_, err := dir.Directory("b").WithNewDirectory("../c").ID(ctx)
require.Error(t, err)
})
}
func TestDirectoryWithFile(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
file := c.Directory().
WithNewFile("some-file", "some-content").
WithNewFile("some-other-file", "some-other-content").
File("some-file")
dirWithFile := c.Directory().WithFile("target-file", file)
content, err := dirWithFile.
File("target-file").Contents(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", content)
_, err = dirWithFile.File("some-other-file").Contents(ctx)
require.Error(t, err)
dirWithFile = c.Directory().WithFile("some-file", file)
content, err = dirWithFile.
File("some-file").Contents(ctx) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | require.NoError(t, err)
require.Equal(t, "some-content", content)
_, err = dirWithFile.File("some-other-file").Contents(ctx)
require.Error(t, err)
content, err = c.Directory().
WithFile("sub-dir/target-file", file).
File("sub-dir/target-file").Contents(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", content)
t.Run("respects permissions", func(t *testing.T) {
dir := c.Directory().
WithNewFile(
"file-with-permissions",
"this should have rwxrwxrwx permissions",
dagger.DirectoryWithNewFileOpts{Permissions: 0777})
ctr := c.Container().From("alpine").WithDirectory("/permissions-test", dir)
stdout, err := ctr.WithExec([]string{"ls", "-l", "/permissions-test/file-with-permissions"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "rwxrwxrwx")
dir2 := c.Directory().
WithNewFile(
"file-with-permissions",
"this should have rw-r--r-- permissions")
ctr2 := c.Container().From("alpine").WithDirectory("/permissions-test", dir2)
stdout2, err := ctr2.WithExec([]string{"ls", "-l", "/permissions-test/file-with-permissions"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout2, "rw-r--r--")
})
}
func TestDirectoryWithTimestamps(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
reallyImportantTime := time.Date(1985, 10, 26, 8, 15, 0, 0, time.UTC)
dir := c.Container().
From("alpine:3.16.2").
WithExec([]string{"sh", "-c", `
mkdir output
touch output/some-file
mkdir output/sub-dir |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | touch output/sub-dir/sub-file
`}).
Directory("output").
WithTimestamps(int(reallyImportantTime.Unix()))
t.Run("changes file and directory timestamps recursively", func(t *testing.T) {
ls, err := c.Container().
From("alpine:3.16.2").
WithMountedDirectory("/dir", dir).
WithEnvVariable("RANDOM", identity.NewID()).
WithExec([]string{"sh", "-c", "ls -al /dir && ls -al /dir/sub-dir"}).
Stdout(ctx)
require.NoError(t, err)
require.Regexp(t, regexp.MustCompile(`-rw-r--r--\s+1 root\s+root\s+\d+ Oct 26 1985 some-file`), ls)
require.Regexp(t, regexp.MustCompile(`drwxr-xr-x\s+2 root\s+root\s+\d+ Oct 26 1985 sub-dir`), ls)
require.Regexp(t, regexp.MustCompile(`-rw-r--r--\s+1 root\s+root\s+\d+ Oct 26 1985 sub-file`), ls)
})
t.Run("results in stable tar archiving", func(t *testing.T) {
content, err := c.Container().
From("alpine:3.16.2").
WithMountedDirectory("/dir", dir).
WithEnvVariable("RANDOM", identity.NewID()).
WithExec([]string{"sh", "-c", "tar -cf - -C /dir * | sha256sum -"}).
Stdout(ctx)
require.NoError(t, err)
require.Contains(t, content, "5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef")
})
}
func TestDirectoryWithoutDirectoryWithoutFile(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
dir1 := c.Directory().
WithNewFile("some-file", "some-content").
WithNewFile("some-dir/sub-file", "sub-content")
entries, err := dir1.
WithoutDirectory("some-dir").
Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"some-file"}, entries)
dir := c.Directory().
WithNewFile("foo.txt", "foo").
WithNewFile("a/bar.txt", "bar").
WithNewFile("a/data.json", "{\"datum\": 10}").
WithNewFile("b/foo.txt", "foo").
WithNewFile("b/bar.txt", "bar").
WithNewFile("b/data.json", "{\"datum\": 10}").
WithNewFile("c/file-a1.txt", "file-a1.txt").
WithNewFile("c/file-a1.json", "file-a1.json").
WithNewFile("c/file-b1.txt", "file-b1.txt").
WithNewFile("c/file-b1.json", "file-b1.json")
entries, err = dir.Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a", "b", "c", "foo.txt"}, entries)
entries, err = dir.
WithoutDirectory("a").
Entries(ctx) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | require.NoError(t, err)
require.Equal(t, []string{"b", "c", "foo.txt"}, entries)
entries, err = dir.
WithoutFile("b/*.txt").
Entries(ctx, dagger.DirectoryEntriesOpts{Path: "b"})
require.NoError(t, err)
require.Equal(t, []string{"data.json"}, entries)
entries, err = dir.
WithoutFile("c/*a1*").
Entries(ctx, dagger.DirectoryEntriesOpts{Path: "c"})
require.NoError(t, err)
require.Equal(t, []string{"file-b1.json", "file-b1.txt"}, entries)
dirDir := c.Directory().
WithNewFile("foo.txt", "foo").
WithNewFile("a1/a1-file", "a1-file").
WithNewFile("a2/a2-file", "a2-file").
WithNewFile("b1/b1-file", "b1-file")
entries, err = dirDir.WithoutDirectory("a*").Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"b1", "foo.txt"}, entries)
filesDir := c.Directory().
WithNewFile("some-file", "some-content").
WithNewFile("some-dir/sub-file", "sub-content").
WithoutFile("some-file")
entries, err = filesDir.Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"some-dir"}, entries)
}
func TestDirectoryDiff(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
aID := newDirWithFile(t, "a-file", "a-content")
bID := newDirWithFile(t, "b-file", "b-content")
var res struct {
Directory struct {
Diff struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Entries []string
}
}
}
diff := `query Diff($id: DirectoryID!, $other: DirectoryID!) {
directory(id: $id) {
diff(other: $other) {
entries
}
}
}`
err := testutil.Query(diff, &res, &testutil.QueryOptions{
Variables: map[string]any{
"id": aID,
"other": bID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"b-file"}, res.Directory.Diff.Entries)
err = testutil.Query(diff, &res, &testutil.QueryOptions{
Variables: map[string]any{
"id": bID,
"other": aID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"a-file"}, res.Directory.Diff.Entries)
/*
This triggers a nil panic in Buildkit!
Issue: https://github.com/dagger/dagger/issues/3337 |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | This might be fixed once we update Buildkit.
err = testutil.Query(diff, &res, &testutil.QueryOptions{
Variables: map[string]any{
"id": aID,
"other": aID,
},
})
require.NoError(t, err)
require.Empty(t, res.Directory.Diff.Entries)
*/
}
func TestDirectoryExport(t *testing.T) {
t.Parallel()
ctx := context.Background()
wd := t.TempDir()
dest := t.TempDir()
c, err := dagger.Connect(ctx, dagger.WithWorkdir(wd))
require.NoError(t, err)
defer c.Close()
dir := c.Container().From("alpine:3.16.2").Directory("/etc/profile.d")
t.Run("to absolute dir", func(t *testing.T) {
ok, err := dir.Export(ctx, dest)
require.NoError(t, err)
require.True(t, ok)
entries, err := ls(dest)
require.NoError(t, err)
require.Equal(t, []string{"README", "color_prompt.sh.disabled", "locale.sh"}, entries)
})
t.Run("to workdir", func(t *testing.T) {
ok, err := dir.Export(ctx, ".") |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | require.NoError(t, err)
require.True(t, ok)
entries, err := ls(wd)
require.NoError(t, err)
require.Equal(t, []string{"README", "color_prompt.sh.disabled", "locale.sh"}, entries)
})
t.Run("to outer dir", func(t *testing.T) {
ok, err := dir.Export(ctx, "../")
require.Error(t, err)
require.False(t, ok)
})
}
func TestDirectoryDockerBuild(t *testing.T) {
t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
contextDir := c.Directory().
WithNewFile("main.go",
`package main
import "fmt"
import "os"
func main() {
for _, env := range os.Environ() {
fmt.Println(env)
}
}`)
t.Run("default Dockerfile location", func(t *testing.T) {
src := contextDir. |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`)
env, err := src.DockerBuild().Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("custom Dockerfile location", func(t *testing.T) {
src := contextDir.
WithNewFile("subdir/Dockerfile.whee",
`FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`)
env, err := src.DockerBuild(dagger.DirectoryDockerBuildOpts{
Dockerfile: "subdir/Dockerfile.whee",
}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Run("subdirectory with default Dockerfile location", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`)
sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext")
env, err := sub.DockerBuild().Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("subdirectory with custom Dockerfile location", func(t *testing.T) {
src := contextDir.
WithNewFile("subdir/Dockerfile.whee",
`FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`)
sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext")
env, err := sub.DockerBuild(dagger.DirectoryDockerBuildOpts{
Dockerfile: "subdir/Dockerfile.whee", |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | }).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("with build args", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
ARG FOOARG=bar
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=$FOOARG
CMD goenv
`)
env, err := src.DockerBuild().Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
env, err = src.DockerBuild(dagger.DirectoryDockerBuildOpts{BuildArgs: []dagger.BuildArg{{Name: "FOOARG", Value: "barbar"}}}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=barbar\n")
})
t.Run("with target", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine AS base
CMD echo "base"
FROM base AS stage1
CMD echo "stage1" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | FROM base AS stage2
CMD echo "stage2"
`)
output, err := src.DockerBuild().Stdout(ctx)
require.NoError(t, err)
require.Contains(t, output, "stage2\n")
output, err = src.DockerBuild(dagger.DirectoryDockerBuildOpts{
Target: "stage1",
}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, output, "stage1\n")
require.NotContains(t, output, "stage2\n")
})
t.Run("with build secrets", func(t *testing.T) {
sec := c.SetSecret("my-secret", "barbar")
require.NoError(t, err)
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
WORKDIR /src
RUN --mount=type=secret,id=my-secret test "$(cat /run/secrets/my-secret)" = "barbar"
RUN --mount=type=secret,id=my-secret cp /run/secrets/my-secret /secret
CMD cat /secret
`)
stdout, err := src.DockerBuild(dagger.DirectoryDockerBuildOpts{Secrets: []*dagger.Secret{sec}}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "***")
})
}
func TestDirectoryWithNewFileExceedingLength(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
var res struct {
Directory struct {
WithNewFile struct {
ID core.DirectoryID
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "bhhivbryticrxrjssjtflvkxjsqyltawpjexixdfnzoxpoxtdheuhvqalteblsqspfeblfaayvrxejknhpezrxtwxmqzaxgtjdupwnwyosqbvypdwroozcyplzhdxrrvhpskmocmgtdnoeaecbyvpovpwdwpytdxwwedueyaxytxsnnnsfpfjtnlkrxwxtcikcocnkobvdxdqpbafqhmidqbrnhxlxqynesyijgkfepokrnsfqneixfvgsdy.txt", contents: "some-content") {
id
}
}
}`, &res, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "File name length exceeds the maximum supported 255 characters")
}
func TestDirectoryWithFileExceedingLength(t *testing.T) {
t.Parallel()
var res struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | Directory struct {
WithNewFile struct {
file struct {
ID core.DirectoryID
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "dir/bhhivbryticrxrjssjtflvkxjsqyltawpjexixdfnzoxpoxtdheuhvqalteblsqspfeblfaayvrxejknhpezrxtwxmqzaxgtjdupwnwyosqbvypdwroozcyplzhdxrrvhpskmocmgtdnoeaecbyvpovpwdwpytdxwwedueyaxytxsnnnsfpfjtnlkrxwxtcikcocnkobvdxdqpbafqhmidqbrnhxlxqynesyijgkfepokrnsfqneixfvgsdy.txt", contents: "some-content") {
file(path: "dir/bhhivbryticrxrjssjtflvkxjsqyltawpjexixdfnzoxpoxtdheuhvqalteblsqspfeblfaayvrxejknhpezrxtwxmqzaxgtjdupwnwyosqbvypdwroozcyplzhdxrrvhpskmocmgtdnoeaecbyvpovpwdwpytdxwwedueyaxytxsnnnsfpfjtnlkrxwxtcikcocnkobvdxdqpbafqhmidqbrnhxlxqynesyijgkfepokrnsfqneixfvgsdy.txt") {
id
}
}
}
}`, &res, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "File name length exceeds the maximum supported 255 characters")
}
func TestDirectoryDirectMerge(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
getDirAndInodes := func(t *testing.T, fileNames ...string) (*dagger.Directory, []string) {
t.Helper()
ctr := c.Container().From("alpine:3.16.2").
WithMountedDirectory("/src", c.Directory()).
WithWorkdir("/src")
var inodes []string
for _, fileName := range fileNames {
ctr = ctr.WithExec([]string{"sh", "-e", "-x", "-c",
"touch " + fileName + " && stat -c '%i' " + fileName,
})
out, err := ctr.Stdout(ctx)
require.NoError(t, err)
inodes = append(inodes, strings.TrimSpace(out)) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | }
return ctr.Directory("/src"), inodes
}
mergeDir := c.Directory()
fileGroups := [][]string{
{"abc", "xyz"},
{"123", "456", "789"},
{"foo"},
{"bar"},
}
fileNameToInode := map[string]string{}
for _, fileNames := range fileGroups {
newDir, inodes := getDirAndInodes(t, fileNames...)
for i, fileName := range fileNames {
fileNameToInode[fileName] = inodes[i]
}
mergeDir = mergeDir.WithDirectory("/", newDir)
}
ctr := c.Container().From("alpine:3.16.2").
WithMountedDirectory("/mnt", mergeDir).
WithWorkdir("/mnt")
for fileName, inode := range fileNameToInode {
out, err := ctr.WithExec([]string{"stat", "-c", "%i", fileName}).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, strings.TrimSpace(out), inode)
}
}
func TestDirectorySync(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,437 | π MergeOp corner case results in wrong contents | Noticed this while working on Zenith, just filing issue atm so as it not get distracted but will fix before next release.
If you use `WithDirectory` where the dest path of the source dir is the same as the internal selector of the source dir, then direct merge is incorrectly triggered, which can result in contents from above the internal selector being revealed under the `/` of the dest dir.
Just need to enforce that direct merge requires the source's selector to be `/` I think. So easy fix, but bigger thing is to go add the missing test coverage for this case.
This should be a release blocker (cc @gerhard should we add a label for release blockers?) | https://github.com/dagger/dagger/issues/5437 | https://github.com/dagger/dagger/pull/5448 | 736927938824e8c35d28aec7287e79c1f89ff3fd | 4842448132758a07be75491d73548ca9ec1edd5e | 2023-07-11T17:07:41Z | go | 2023-07-14T15:21:49Z | core/integration/directory_test.go | t.Parallel()
c, ctx := connect(t)
defer c.Close()
t.Run("empty", func(t *testing.T) {
dir, err := c.Directory().Sync(ctx)
require.NoError(t, err)
entries, err := dir.Entries(ctx)
require.NoError(t, err)
require.Empty(t, entries)
})
t.Run("triggers error", func(t *testing.T) {
_, err := c.Directory().Directory("/foo").Sync(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "no such file or directory")
_, err = c.Container().From("alpine:3.16.2").Directory("/bar").Sync(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "no such file or directory")
})
t.Run("allows chaining", func(t *testing.T) {
dir, err := c.Directory().WithNewFile("foo", "bar").Sync(ctx)
require.NoError(t, err)
entries, err := dir.Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"foo"}, entries)
})
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | package core
import (
"context"
"encoding/base32"
"encoding/binary"
"encoding/hex" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | "encoding/json"
"fmt"
"io"
"io/fs"
"os"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/pkg/transfer/archive"
"github.com/containerd/containerd/platforms"
"github.com/dagger/dagger/core/pipeline"
"github.com/dagger/dagger/router"
"github.com/docker/distribution/reference"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
"github.com/moby/buildkit/frontend/dockerui"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/vito/progrock"
"github.com/zeebo/xxh3"
)
type Container struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | FS *pb.Definition `json:"fs"`
Config specs.ImageConfig `json:"cfg"`
Pipeline pipeline.Path `json:"pipeline"`
Mounts ContainerMounts `json:"mounts,omitempty"`
Meta *pb.Definition `json:"meta,omitempty"`
Platform specs.Platform `json:"platform,omitempty"`
Secrets []ContainerSecret `json:"secret_env,omitempty"`
Sockets []ContainerSocket `json:"sockets,omitempty"`
ImageRef string `json:"image_ref,omitempty"`
Hostname string `json:"hostname,omitempty"`
Ports []ContainerPort `json:"ports,omitempty"`
Services ServiceBindings `json:"services,omitempty"`
HostAliases []HostAlias `json:"host_aliases,omitempty"`
Focused bool `json:"focused"`
}
func NewContainer(id ContainerID, pipeline pipeline.Path, platform specs.Platform) (*Container, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | container, err := id.ToContainer()
if err != nil {
return nil, err
}
container.Pipeline = pipeline.Copy()
container.Platform = platform
return container, nil
}
func (container *Container) Clone() *Container {
cp := *container
cp.Config.ExposedPorts = cloneMap(cp.Config.ExposedPorts)
cp.Config.Env = cloneSlice(cp.Config.Env)
cp.Config.Entrypoint = cloneSlice(cp.Config.Entrypoint)
cp.Config.Cmd = cloneSlice(cp.Config.Cmd)
cp.Config.Volumes = cloneMap(cp.Config.Volumes)
cp.Config.Labels = cloneMap(cp.Config.Labels)
cp.Mounts = cloneSlice(cp.Mounts)
cp.Secrets = cloneSlice(cp.Secrets)
cp.Sockets = cloneSlice(cp.Sockets)
cp.Ports = cloneSlice(cp.Ports)
cp.Services = cloneMap(cp.Services)
cp.HostAliases = cloneSlice(cp.HostAliases)
cp.Pipeline = cloneSlice(cp.Pipeline)
return &cp
}
type ContainerID string
func (id ContainerID) String() string {
return string(id)
}
var _ router.Digestible = ContainerID("") |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | func (id ContainerID) Digest() (digest.Digest, error) {
return digest.FromString(id.String()), nil
}
func (id ContainerID) ToContainer() (*Container, error) {
var container Container
if id == "" {
return &container, nil
}
if err := decodeID(&container, id); err != nil {
return nil, err
}
return &container, nil
}
func (container *Container) ID() (ContainerID, error) {
return encodeID[ContainerID](container)
}
var _ router.Pipelineable = (*Container)(nil)
func (container *Container) PipelinePath() pipeline.Path {
return container.Pipeline
}
var _ router.Digestible = (*Container)(nil)
func (container *Container) Digest() (digest.Digest, error) {
id, err := container.ID()
if err != nil {
return "", err
}
return id.Digest()
}
type HostAlias struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | Alias string `json:"alias"`
Target string `json:"target"`
}
type Ownership struct {
UID int `json:"uid"`
GID int `json:"gid"`
}
func (owner Ownership) Opt() llb.ChownOption {
return llb.WithUIDGID(owner.UID, owner.GID)
}
type ContainerSecret struct {
Secret SecretID `json:"secret"`
EnvName string `json:"env,omitempty"`
MountPath string `json:"path,omitempty"`
Owner *Ownership `json:"owner,omitempty"`
}
type ContainerSocket struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | Socket SocketID `json:"socket"`
UnixPath string `json:"unix_path,omitempty"`
Owner *Ownership `json:"owner,omitempty"`
}
type ContainerPort struct {
Port int `json:"port"`
Protocol NetworkProtocol `json:"protocol"`
Description *string `json:"description,omitempty"`
}
func (container *Container) FSState() (llb.State, error) {
if container.FS == nil {
return llb.Scratch(), nil
}
return defToState(container.FS)
}
const metaMountDestPath = "/.dagger_meta_mount"
const metaSourcePath = "meta"
func (container *Container) MetaState() (*llb.State, error) {
if container.Meta == nil {
return nil, nil
}
metaSt, err := defToState(container.Meta)
if err != nil {
return nil, err
}
return &metaSt, nil
}
type ContainerMount struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | 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) {
if mnt.Source == nil {
return llb.Scratch(), nil
}
return defToState(mnt.Source)
}
type ContainerMounts []ContainerMount
func (mnts ContainerMounts) With(newMnt ContainerMount) ContainerMounts {
mntsCp := make(ContainerMounts, 0, len(mnts))
parent := newMnt.Target + "/"
for _, mnt := range mnts {
if mnt.Target == newMnt.Target || strings.HasPrefix(mnt.Target, parent) {
continue
}
mntsCp = append(mntsCp, mnt) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | }
mntsCp = append(mntsCp, newMnt)
return mntsCp
}
func (container *Container) From(ctx context.Context, gw bkgw.Client, addr string) (*Container, error) {
container = container.Clone()
platform := container.Platform
ctx, subRecorder := progrock.WithGroup(ctx, fmt.Sprintf("from %s", addr), progrock.Weak())
refName, err := reference.ParseNormalizedNamed(addr)
if err != nil {
return nil, err
}
ref := reference.TagNameOnly(refName).String()
digest, cfgBytes, err := gw.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{
Platform: &platform,
ResolveMode: llb.ResolveModeDefault.String(),
})
if err != nil {
return nil, err
}
digested, err := reference.WithDigest(refName, digest)
if err != nil {
return nil, err
}
var imgSpec specs.Image
if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil {
return nil, err
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | fsSt := llb.Image(
digested.String(),
llb.WithCustomNamef("pull %s", ref),
)
def, err := fsSt.Marshal(ctx, llb.Platform(container.Platform))
if err != nil {
return nil, err
}
container.FS = def.ToPB()
recordVertexes(subRecorder, container.FS)
container.Config = mergeImageConfig(container.Config, imgSpec.Config)
container.ImageRef = digested.String()
return container, nil
}
const defaultDockerfileName = "Dockerfile"
var buildCache = newCacheMap[uint64, *Container]()
func cacheKey(keys ...any) uint64 {
hash := xxh3.New()
enc := json.NewEncoder(hash)
for _, key := range keys {
enc.Encode(key)
}
return hash.Sum64()
}
func (container *Container) Build(
ctx context.Context,
gw bkgw.Client,
context *Directory,
dockerfile string, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | buildArgs []BuildArg,
target string,
secrets []SecretID,
) (*Container, error) {
return buildCache.GetOrInitialize(
cacheKey(container, context, dockerfile, buildArgs, target, secrets),
func() (*Container, error) {
return container.buildUncached(ctx, gw, context, dockerfile, buildArgs, target, secrets)
},
)
}
func (container *Container) buildUncached(
ctx context.Context,
gw bkgw.Client,
context *Directory,
dockerfile string,
buildArgs []BuildArg,
target string,
secrets []SecretID,
) (*Container, error) {
container = container.Clone()
container.Services.Merge(context.Services)
for _, secretID := range secrets {
secret, err := secretID.ToSecret()
if err != nil {
return nil, err
}
container.Secrets = append(container.Secrets, ContainerSecret{
Secret: secretID,
MountPath: fmt.Sprintf("/run/secrets/%s", secret.Name), |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | })
}
container.ImageRef = ""
ctx, subRecorder := progrock.WithGroup(ctx, "docker build", progrock.Weak())
return WithServices(ctx, gw, container.Services, func() (*Container, error) {
platform := container.Platform
opts := map[string]string{
"platform": platforms.Format(platform),
"contextsubdir": context.Dir,
}
if dockerfile != "" {
opts["filename"] = path.Join(context.Dir, dockerfile)
} else {
opts["filename"] = path.Join(context.Dir, defaultDockerfileName)
}
if target != "" {
opts["target"] = target
}
for _, buildArg := range buildArgs {
opts["build-arg:"+buildArg.Name] = buildArg.Value
}
inputs := map[string]*pb.Definition{
dockerui.DefaultLocalNameContext: context.LLB,
dockerui.DefaultLocalNameDockerfile: context.LLB,
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Frontend: "dockerfile.v0",
FrontendOpt: opts, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | FrontendInputs: inputs,
})
if err != nil {
return nil, err
}
bkref, err := res.SingleRef()
if err != nil {
return nil, err
}
var st llb.State
if bkref == nil {
st = llb.Scratch()
} else {
st, err = bkref.ToState()
if err != nil {
return nil, err
}
}
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
recordVertexes(subRecorder, def.ToPB())
container.FS = def.ToPB()
container.FS.Source = nil
cfgBytes, found := res.Metadata[exptypes.ExporterImageConfigKey]
if found {
var imgSpec specs.Image
if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return nil, err
}
container.Config = mergeImageConfig(container.Config, imgSpec.Config)
}
return container, nil
})
}
func (container *Container) RootFS(ctx context.Context) (*Directory, error) {
return &Directory{
LLB: container.FS,
Dir: "/",
Platform: container.Platform,
Pipeline: container.Pipeline,
Services: container.Services,
}, nil
}
func (container *Container) WithRootFS(ctx context.Context, dir *Directory) (*Container, error) {
container = container.Clone()
dirSt, err := dir.StateWithSourcePath()
if err != nil {
return nil, err
}
def, err := dirSt.Marshal(ctx, llb.Platform(dir.Platform))
if err != nil {
return nil, err
}
container.FS = def.ToPB()
container.Services.Merge(dir.Services)
container.ImageRef = "" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return container, nil
}
func (container *Container) WithDirectory(ctx context.Context, gw bkgw.Client, subdir string, src *Directory, filter CopyFilter, owner string) (*Container, error) {
container = container.Clone()
return container.writeToPath(ctx, gw, subdir, func(dir *Directory) (*Directory, error) {
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, err
}
return dir.WithDirectory(ctx, ".", src, filter, ownership)
})
}
func (container *Container) WithFile(ctx context.Context, gw bkgw.Client, destPath string, src *File, permissions fs.FileMode, owner string) (*Container, error) {
container = container.Clone()
return container.writeToPath(ctx, gw, path.Dir(destPath), func(dir *Directory) (*Directory, error) {
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, err
}
return dir.WithFile(ctx, path.Base(destPath), src, permissions, ownership)
})
}
func (container *Container) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte, permissions fs.FileMode, owner string) (*Container, error) {
container = container.Clone()
dir, file := filepath.Split(dest)
return container.writeToPath(ctx, gw, dir, func(dir *Directory) (*Directory, error) {
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, err
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return dir.WithNewFile(ctx, file, content, permissions, ownership)
})
}
func (container *Container) WithMountedDirectory(ctx context.Context, gw bkgw.Client, target string, dir *Directory, owner string) (*Container, error) {
container = container.Clone()
return container.withMounted(ctx, gw, target, dir.LLB, dir.Dir, dir.Services, owner)
}
func (container *Container) WithMountedFile(ctx context.Context, gw bkgw.Client, target string, file *File, owner string) (*Container, error) {
container = container.Clone()
return container.withMounted(ctx, gw, target, file.LLB, file.File, file.Services, owner)
}
func (container *Container) WithMountedCache(ctx context.Context, gw bkgw.Client, target string, cache *CacheVolume, source *Directory, concurrency CacheSharingMode, owner string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
cacheSharingMode := ""
switch concurrency {
case CacheSharingModePrivate:
cacheSharingMode = "private"
case CacheSharingModeLocked:
cacheSharingMode = "locked"
default:
cacheSharingMode = "shared"
}
mount := ContainerMount{
Target: target,
CacheID: cache.Sum(),
CacheSharingMode: cacheSharingMode,
}
if source != nil {
mount.Source = source.LLB |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | mount.SourcePath = source.Dir
}
if owner != "" {
var err error
mount.Source, mount.SourcePath, err = container.chown(
ctx,
gw,
mount.Source,
mount.SourcePath,
owner,
llb.Platform(container.Platform),
)
if err != nil {
return nil, err
}
}
container.Mounts = container.Mounts.With(mount)
container.ImageRef = ""
return container, nil
}
func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
container.Mounts = container.Mounts.With(ContainerMount{
Target: target,
Tmpfs: true,
})
container.ImageRef = "" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return container, nil
}
func (container *Container) WithMountedSecret(ctx context.Context, gw bkgw.Client, target string, source *Secret, owner string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, err
}
secretID, err := source.ID()
if err != nil {
return nil, err
}
container.Secrets = append(container.Secrets, ContainerSecret{
Secret: secretID,
MountPath: target,
Owner: ownership,
})
container.ImageRef = ""
return container, nil
}
func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
var found bool
var foundIdx int
for i := len(container.Mounts) - 1; i >= 0; i-- {
if container.Mounts[i].Target == target {
found = true |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | foundIdx = i
break
}
}
if found {
container.Mounts = append(container.Mounts[:foundIdx], container.Mounts[foundIdx+1:]...)
}
container.ImageRef = ""
return container, nil
}
func (container *Container) MountTargets(ctx context.Context) ([]string, error) {
mounts := []string{}
for _, mnt := range container.Mounts {
mounts = append(mounts, mnt.Target)
}
return mounts, nil
}
func (container *Container) WithUnixSocket(ctx context.Context, gw bkgw.Client, target string, source *Socket, owner string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, err
}
socketID, err := source.ID()
if err != nil {
return nil, err
}
newSocket := ContainerSocket{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | Socket: socketID,
UnixPath: target,
Owner: ownership,
}
var replaced bool
for i, sock := range container.Sockets {
if sock.UnixPath == target {
container.Sockets[i] = newSocket
replaced = true
break
}
}
if !replaced {
container.Sockets = append(container.Sockets, newSocket)
}
container.ImageRef = ""
return container, nil
}
func (container *Container) WithoutUnixSocket(ctx context.Context, target string) (*Container, error) {
container = container.Clone()
target = absPath(container.Config.WorkingDir, target)
for i, sock := range container.Sockets {
if sock.UnixPath == target {
container.Sockets = append(container.Sockets[:i], container.Sockets[i+1:]...)
break
}
}
container.ImageRef = "" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return container, nil
}
func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) {
container = container.Clone()
secretID, err := secret.ID()
if err != nil {
return nil, err
}
container.Secrets = append(container.Secrets, ContainerSecret{
Secret: secretID,
EnvName: name,
})
container.ImageRef = ""
return container, nil
}
func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error) {
dir, _, err := locatePath(ctx, container, dirPath, NewDirectory)
if err != nil {
return nil, err
}
info, err := dir.Stat(ctx, gw, ".")
if err != nil {
return nil, err
}
if !info.IsDir() {
return nil, fmt.Errorf("path %s is a file, not a directory", dirPath)
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return dir, nil
}
func (container *Container) File(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) {
file, _, err := locatePath(ctx, container, filePath, NewFile)
if err != nil {
return nil, err
}
info, err := file.Stat(ctx, gw)
if err != nil {
return nil, err
}
if info.IsDir() {
return nil, fmt.Errorf("path %s is a directory, not a file", filePath)
}
return file, nil
}
func locatePath[T *File | *Directory](
ctx context.Context,
container *Container,
containerPath string,
init func(context.Context, *pb.Definition, string, pipeline.Path, specs.Platform, ServiceBindings) T,
) (T, *ContainerMount, error) {
containerPath = absPath(container.Config.WorkingDir, containerPath)
for i := len(container.Mounts) - 1; i >= 0; i-- {
mnt := container.Mounts[i]
if containerPath == mnt.Target || strings.HasPrefix(containerPath, mnt.Target+"/") {
if mnt.Tmpfs { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return nil, nil, fmt.Errorf("%s: cannot retrieve path from tmpfs", containerPath)
}
if mnt.CacheID != "" {
return nil, nil, fmt.Errorf("%s: cannot retrieve path from cache", containerPath)
}
sub := mnt.SourcePath
if containerPath != mnt.Target {
dirSub := strings.TrimPrefix(containerPath, mnt.Target+"/")
if dirSub != "" {
sub = path.Join(sub, dirSub)
}
}
return init(
ctx,
mnt.Source,
sub,
container.Pipeline,
container.Platform,
container.Services,
), &mnt, nil
}
}
return init(
ctx,
container.FS,
containerPath,
container.Pipeline,
container.Platform, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | container.Services,
), nil, nil
}
func (container *Container) withMounted(
ctx context.Context,
gw bkgw.Client,
target string,
srcDef *pb.Definition,
srcPath string,
svcs ServiceBindings,
owner string,
) (*Container, error) {
target = absPath(container.Config.WorkingDir, target)
var err error
if owner != "" {
srcDef, srcPath, err = container.chown(ctx, gw, srcDef, srcPath, owner, llb.Platform(container.Platform))
if err != nil {
return nil, err
}
}
container.Mounts = container.Mounts.With(ContainerMount{
Source: srcDef,
SourcePath: srcPath,
Target: target,
})
container.Services.Merge(svcs)
container.ImageRef = ""
return container, nil
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | func (container *Container) chown(
ctx context.Context,
gw bkgw.Client,
srcDef *pb.Definition,
srcPath string,
owner string,
opts ...llb.ConstraintsOpt,
) (*pb.Definition, string, error) {
ownership, err := container.ownership(ctx, gw, owner)
if err != nil {
return nil, "", err
}
if ownership == nil {
return srcDef, srcPath, nil
}
var srcSt llb.State
if srcDef == nil {
srcSt = llb.Scratch().File(
llb.Mkdir("/chown", 0o755, ownership.Opt()),
)
srcPath = "/chown"
} else {
srcSt, err = defToState(srcDef)
if err != nil {
return nil, "", err
}
def, err := srcSt.Marshal(ctx, opts...)
if err != nil {
return nil, "", err |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | }
ref, err := gwRef(ctx, gw, def.ToPB())
if err != nil {
return nil, "", err
}
stat, err := ref.StatFile(ctx, bkgw.StatRequest{
Path: srcPath,
})
if err != nil {
return nil, "", err
}
if stat.IsDir() {
chowned := "/chown"
srcSt = llb.Scratch().File(
llb.Mkdir(chowned, os.FileMode(stat.Mode), ownership.Opt()).
Copy(srcSt, srcPath, chowned, &llb.CopyInfo{
CopyDirContentsOnly: true,
}, ownership.Opt()),
)
srcPath = chowned
} else {
srcSt = llb.Scratch().File(
llb.Copy(srcSt, srcPath, ".", ownership.Opt()),
)
srcPath = filepath.Base(srcPath)
}
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | def, err := srcSt.Marshal(ctx, opts...)
if err != nil {
return nil, "", err
}
return def.ToPB(), srcPath, nil
}
func (container *Container) writeToPath(ctx context.Context, gw bkgw.Client, subdir string, fn func(dir *Directory) (*Directory, error)) (*Container, error) {
dir, mount, err := locatePath(ctx, container, subdir, NewDirectory)
if err != nil {
return nil, err
}
dir.Pipeline = container.Pipeline
dir, err = fn(dir)
if err != nil {
return nil, err
}
if mount == nil {
root, err := dir.Root()
if err != nil {
return nil, err
}
return container.WithRootFS(ctx, root)
}
return container.withMounted(ctx, gw, mount.Target, dir.LLB, mount.SourcePath, nil, "")
}
func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error) {
return container.Config, nil
}
func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | container = container.Clone()
container.Config = updateFn(container.Config)
return container, nil
}
func (container *Container) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Container, error) {
container = container.Clone()
container.Pipeline = container.Pipeline.Add(pipeline.Pipeline{
Name: name,
Description: description,
Labels: labels,
})
return container, nil
}
func (container *Container) WithExec(ctx context.Context, gw bkgw.Client, progSock *Socket, defaultPlatform specs.Platform, opts ContainerExecOpts) (*Container, error) {
container = container.Clone()
cfg := container.Config
mounts := container.Mounts
platform := container.Platform
if platform.OS == "" {
platform = defaultPlatform
}
args := opts.Args
if len(args) == 0 {
args = cfg.Cmd
}
if len(cfg.Entrypoint) > 0 && !opts.SkipEntrypoint {
args = append(cfg.Entrypoint, args...)
}
if len(args) == 0 { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return nil, errors.New("no command has been set")
}
var namef string
if container.Focused {
namef = focusPrefix + "exec %s"
} else {
namef = "exec %s"
}
runOpts := []llb.RunOption{
llb.Args(args),
llb.WithCustomNamef(namef, strings.Join(args, " ")),
}
if opts.ExperimentalPrivilegedNesting {
sid, err := progSock.ID()
if err != nil {
return nil, err
}
runOpts = append(runOpts,
llb.AddEnv("_DAGGER_ENABLE_NESTING", ""),
llb.AddSSHSocket(
llb.SSHID(sid.LLBID()),
llb.SSHSocketTarget("/.progrock.sock"),
),
)
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | meta := llb.Mkdir(metaSourcePath, 0o777)
if opts.Stdin != "" {
meta = meta.Mkfile(path.Join(metaSourcePath, "stdin"), 0o600, []byte(opts.Stdin))
}
runOpts = append(runOpts,
llb.AddMount(metaMountDestPath,
llb.Scratch().File(meta, llb.WithCustomName(internalPrefix+"creating dagger metadata")),
llb.SourcePath(metaSourcePath)))
if opts.RedirectStdout != "" {
runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDOUT", opts.RedirectStdout))
}
if opts.RedirectStderr != "" {
runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDERR", opts.RedirectStderr))
}
for _, alias := range container.HostAliases {
runOpts = append(runOpts, llb.AddEnv("_DAGGER_HOSTNAME_ALIAS_"+alias.Alias, alias.Target))
}
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, "=")
if !ok {
_ = ok |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | }
if name == "_DAGGER_ENABLE_NESTING" && !opts.ExperimentalPrivilegedNesting {
continue
}
if name == DebugFailedExecEnv {
continue
}
runOpts = append(runOpts, llb.AddEnv(name, val))
}
secretsToScrub := SecretToScrubInfo{}
for i, secret := range container.Secrets {
secretOpts := []llb.SecretOption{llb.SecretID(secret.Secret.String())}
var secretDest string
switch {
case secret.EnvName != "":
secretDest = secret.EnvName
secretOpts = append(secretOpts, llb.SecretAsEnv(true))
secretsToScrub.Envs = append(secretsToScrub.Envs, secret.EnvName)
case secret.MountPath != "":
secretDest = secret.MountPath
secretsToScrub.Files = append(secretsToScrub.Files, secret.MountPath)
if secret.Owner != nil {
secretOpts = append(secretOpts, llb.SecretFileOpt(
secret.Owner.UID,
secret.Owner.GID,
0o400,
)) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | }
default:
return nil, fmt.Errorf("malformed secret config at index %d", i)
}
runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...))
}
if len(secretsToScrub.Envs) != 0 || len(secretsToScrub.Files) != 0 {
sort.Strings(secretsToScrub.Envs)
sort.Strings(secretsToScrub.Files)
secretsToScrubJSON, err := json.Marshal(secretsToScrub)
if err != nil {
return nil, fmt.Errorf("scrub secrets json: %w", err)
}
runOpts = append(runOpts, llb.AddEnv("_DAGGER_SCRUB_SECRETS", string(secretsToScrubJSON)))
}
for _, socket := range container.Sockets {
if socket.UnixPath == "" {
return nil, fmt.Errorf("unsupported socket: only unix paths are implemented")
}
socketOpts := []llb.SSHOption{
llb.SSHID(socket.Socket.LLBID()),
llb.SSHSocketTarget(socket.UnixPath),
}
if socket.Owner != nil {
socketOpts = append(socketOpts,
llb.SSHSocketOpt(
socket.UnixPath,
socket.Owner.UID,
socket.Owner.GID, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | 0o600,
))
}
runOpts = append(runOpts, llb.AddSSHSocket(socketOpts...))
}
for _, mnt := range mounts {
srcSt, err := mnt.SourceState()
if err != nil {
return nil, fmt.Errorf("mount %s: %w", mnt.Target, err)
}
mountOpts := []llb.MountOption{}
if mnt.SourcePath != "" {
mountOpts = append(mountOpts, llb.SourcePath(mnt.SourcePath))
}
if mnt.CacheID != "" {
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()) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | }
runOpts = append(runOpts, llb.AddMount(mnt.Target, srcSt, mountOpts...))
}
if opts.InsecureRootCapabilities {
runOpts = append(runOpts, llb.Security(llb.SecurityModeInsecure))
}
fsSt, err := container.FSState()
if err != nil {
return nil, fmt.Errorf("fs state: %w", err)
}
execStNoHostname := fsSt.Run(runOpts...)
constraints := llb.NewConstraints(llb.Platform(platform))
rootVtx := execStNoHostname.Root().Output().Vertex(ctx, constraints)
digest, _, _, _, err := rootVtx.Marshal(ctx, constraints)
if err != nil {
return nil, fmt.Errorf("marshal: %w", err)
}
hostname := hostHash(digest)
container.Hostname = hostname
runOpts = append(runOpts, llb.Hostname(hostname))
execSt := fsSt.Run(runOpts...)
execDef, err := execSt.Root().Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("marshal root: %w", err)
}
container.FS = execDef.ToPB()
metaDef, err := execSt.GetMount(metaMountDestPath).Marshal(ctx, llb.Platform(platform)) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | if err != nil {
return nil, fmt.Errorf("get meta mount: %w", err)
}
container.Meta = metaDef.ToPB()
for i, mnt := range mounts {
if mnt.Tmpfs || mnt.CacheID != "" {
continue
}
mountSt := execSt.GetMount(mnt.Target)
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()
}
container.Mounts = mounts
container.ImageRef = ""
return container, nil
}
func (container *Container) Evaluate(ctx context.Context, gw bkgw.Client) error {
if container.FS == nil {
return nil
}
_, err := WithServices(ctx, gw, container.Services, func() (*bkgw.Result, error) {
st, err := container.FSState()
if err != nil {
return nil, err
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | def, err := st.Marshal(ctx, llb.Platform(container.Platform))
if err != nil {
return nil, err
}
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: def.ToPB(),
})
})
return err
}
func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client, progSock *Socket) (int, error) {
content, err := container.MetaFileContents(ctx, gw, progSock, "exitCode")
if err != nil {
return 0, err
}
return strconv.Atoi(content)
}
func (container *Container) Start(ctx context.Context, gw bkgw.Client) (*Service, error) {
if container.Hostname == "" {
return nil, ErrContainerNoExec
}
health := newHealth(gw, container.Hostname, container.Ports)
rec := progrock.RecorderFromContext(ctx).
WithGroup(
fmt.Sprintf("service %s", container.Hostname),
progrock.Weak(),
) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | svcCtx, stop := context.WithCancel(context.Background())
svcCtx = progrock.RecorderToContext(svcCtx, rec)
checked := make(chan error, 1)
go func() {
checked <- health.Check(svcCtx)
}()
exited := make(chan error, 1)
go func() {
exited <- container.Evaluate(svcCtx, gw)
}()
select {
case err := <-checked:
if err != nil {
stop()
return nil, fmt.Errorf("health check errored: %w", err)
}
_ = stop
return &Service{
Container: container,
Detach: stop,
}, nil
case err := <-exited:
stop()
if err != nil {
return nil, fmt.Errorf("exited: %w", err)
}
return nil, fmt.Errorf("service exited before healthcheck")
}
}
func (container *Container) MetaFileContents(ctx context.Context, gw bkgw.Client, progSock *Socket, filePath string) (string, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | if container.Meta == nil {
ctr, err := container.WithExec(ctx, gw, progSock, container.Platform, ContainerExecOpts{})
if err != nil {
return "", err
}
return ctr.MetaFileContents(ctx, gw, progSock, filePath)
}
file := NewFile(
ctx,
container.Meta,
path.Join(metaSourcePath, filePath),
container.Pipeline,
container.Platform,
container.Services,
)
content, err := file.Contents(ctx, gw)
if err != nil {
return "", err
}
return string(content), nil
}
func (container *Container) Publish(
ctx context.Context,
ref string,
platformVariants []ContainerID,
forcedCompression ImageLayerCompression,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
) (string, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | exportOpts := bkclient.ExportEntry{
Type: bkclient.ExporterImage,
Attrs: map[string]string{
"name": ref,
"push": strconv.FormatBool(true),
"oci-mediatypes": strconv.FormatBool(true),
},
}
if forcedCompression != "" {
exportOpts.Attrs["compression"] = strings.ToLower(string(forcedCompression))
exportOpts.Attrs["force-compression"] = strconv.FormatBool(true)
}
solveOpts.Exports = []bkclient.ExportEntry{exportOpts}
ch, wg := mirrorCh(solveCh)
defer wg.Wait()
res, err := bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
return container.export(ctx, gw, platformVariants)
}, ch)
if err != nil {
return "", err
}
refName, err := reference.ParseNormalizedNamed(ref)
if err != nil {
return "", err
}
imageDigest, found := res.ExporterResponse[exptypes.ExporterImageDigestKey] |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | if found {
dig, err := digest.Parse(imageDigest)
if err != nil {
return "", fmt.Errorf("parse digest: %w", err)
}
withDig, err := reference.WithDigest(refName, dig)
if err != nil {
return "", fmt.Errorf("with digest: %w", err)
}
return withDig.String(), nil
}
return ref, nil
}
func (container *Container) Export(
ctx context.Context,
host *Host,
dest string,
platformVariants []ContainerID,
forcedCompression ImageLayerCompression,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
) error {
dest, err := host.NormalizeDest(dest)
if err != nil {
return err
}
if err := os.MkdirAll(filepath.Dir(dest), 0o700); err != nil {
return err
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | out, err := os.Create(dest)
if err != nil {
return err
}
defer out.Close()
exportOpts := bkclient.ExportEntry{
Type: bkclient.ExporterOCI,
Attrs: map[string]string{
"oci-mediatypes": strconv.FormatBool(true),
},
}
if forcedCompression != "" {
exportOpts.Attrs["compression"] = strings.ToLower(string(forcedCompression))
exportOpts.Attrs["force-compression"] = strconv.FormatBool(true)
}
platformCount := len(platformVariants)
if container.FS != nil {
platformCount++
}
if platformCount == 1 {
exportOpts.Type = bkclient.ExporterDocker
}
exportOpts.Output = func(map[string]string) (io.WriteCloser, error) {
return out, nil
}
return host.Export(ctx, exportOpts, bkClient, solveOpts, solveCh, func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return container.export(ctx, gw, platformVariants)
})
}
const OCIStoreName = "dagger-oci"
var importCache = newCacheMap[uint64, *Container]()
func (container *Container) Import(
ctx context.Context,
gw bkgw.Client,
host *Host,
source FileID,
tag string,
store content.Store,
) (*Container, error) {
return importCache.GetOrInitialize(
cacheKey(container, source, tag),
func() (*Container, error) {
return container.importUncached(ctx, gw, host, source, tag, store)
},
)
}
func (container *Container) importUncached(
ctx context.Context,
gw bkgw.Client,
host *Host,
source FileID,
tag string,
store content.Store,
) (*Container, error) {
file, err := source.ToFile()
if err != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return nil, err
}
src, err := file.Open(ctx, host, gw)
if err != nil {
return nil, err
}
defer src.Close()
container = container.Clone()
stream := archive.NewImageImportStream(src, "")
desc, err := stream.Import(ctx, store)
if err != nil {
return nil, fmt.Errorf("image archive import: %w", err)
}
manifestDesc, err := resolveIndex(ctx, store, desc, container.Platform, tag)
if err != nil {
return nil, fmt.Errorf("image archive resolve index: %w", err)
}
dummyRepo := "dagger/import"
st := llb.OCILayout(
fmt.Sprintf("%s@%s", dummyRepo, manifestDesc.Digest),
llb.OCIStore("", OCIStoreName),
llb.Platform(container.Platform),
)
execDef, err := st.Marshal(ctx, llb.Platform(container.Platform))
if err != nil {
return nil, fmt.Errorf("marshal root: %w", err)
}
container.FS = execDef.ToPB() |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | manifestBlob, err := content.ReadBlob(ctx, store, *manifestDesc)
if err != nil {
return nil, fmt.Errorf("image archive read manifest blob: %w", err)
}
var man specs.Manifest
err = json.Unmarshal(manifestBlob, &man)
if err != nil {
return nil, fmt.Errorf("image archive unmarshal manifest: %w", err)
}
configBlob, err := content.ReadBlob(ctx, store, man.Config)
if err != nil {
return nil, fmt.Errorf("image archive read image config blob %s: %w", man.Config.Digest, err)
}
var imgSpec specs.Image
err = json.Unmarshal(configBlob, &imgSpec)
if err != nil {
return nil, fmt.Errorf("load image config: %w", err)
}
container.Config = imgSpec.Config
return container, nil
}
func (container *Container) HostnameOrErr() (string, error) {
if container.Hostname == "" {
return "", ErrContainerNoExec
}
return container.Hostname, nil
}
func (container *Container) Endpoint(port int, scheme string) (string, error) {
if port == 0 {
if len(container.Ports) == 0 { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,433 | π Engine 0.6.3 breaks docker publish for non OCI supporting registry | ### What is the issue?
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
The specific PR that affected this - https://github.com/dagger/dagger/pull/5365
### Log output
HTTP 400 from Artifactory
### SDK version
Go SDK 0.7.2
### OS version
macOS | https://github.com/dagger/dagger/issues/5433 | https://github.com/dagger/dagger/pull/5467 | 13aea3dbfb15226f9b8ffede05e98c805cc2fe53 | e9d557a7ed6e8b6dd3cc8cae79df6f4f9bbff517 | 2023-07-10T19:05:44Z | go | 2023-07-15T18:39:14Z | core/container.go | return "", fmt.Errorf("no ports exposed")
}
port = container.Ports[0].Port
}
host, err := container.HostnameOrErr()
if err != nil {
return "", err
}
endpoint := fmt.Sprintf("%s:%d", host, port)
if scheme != "" {
endpoint = scheme + ":" + endpoint
}
return endpoint, nil
}
func (container *Container) WithExposedPort(port ContainerPort) (*Container, error) {
container = container.Clone()
gotOne := false
for i, p := range container.Ports {
if p.Port == port.Port && p.Protocol == port.Protocol {
container.Ports[i] = port
gotOne = true
break
}
}
if !gotOne {
container.Ports = append(container.Ports, port)
}
if container.Config.ExposedPorts == nil {
container.Config.ExposedPorts = map[string]struct{}{} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.