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,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Owner string } func (r *Container) WithUnixSocket(path string, source *Socket, opts ...ContainerWithUnixSocketOpts) *Container { q := r.q.Select("withUnixSocket") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Owner) { q = q.Arg("owner", opts[i].Owner) } } q = q.Arg("path", path) q = q.Arg("source", source) return &Container{ q: q, c: r.c, } } func (r *Container) WithUser(name string) *Container {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q := r.q.Select("withUser") q = q.Arg("name", name) return &Container{ q: q, c: r.c, } } func (r *Container) WithWorkdir(path string) *Container { q := r.q.Select("withWorkdir") q = q.Arg("path", path) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutEnvVariable(name string) *Container { q := r.q.Select("withoutEnvVariable") q = q.Arg("name", name) return &Container{ q: q, c: r.c, } } type ContainerWithoutExposedPortOpts struct { Protocol NetworkProtocol } func (r *Container) WithoutExposedPort(port int, opts ...ContainerWithoutExposedPortOpts) *Container { q := r.q.Select("withoutExposedPort") for i := len(opts) - 1; i >= 0; i-- {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
if !querybuilder.IsZeroValue(opts[i].Protocol) { q = q.Arg("protocol", opts[i].Protocol) } } q = q.Arg("port", port) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutFocus() *Container { q := r.q.Select("withoutFocus") return &Container{ q: q, c: r.c, } } func (r *Container) WithoutLabel(name string) *Container { q := r.q.Select("withoutLabel") q = q.Arg("name", name) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutMount(path string) *Container { q := r.q.Select("withoutMount") q = q.Arg("path", path) return &Container{
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q: q, c: r.c, } } func (r *Container) WithoutRegistryAuth(address string) *Container { q := r.q.Select("withoutRegistryAuth") q = q.Arg("address", address) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutUnixSocket(path string) *Container { q := r.q.Select("withoutUnixSocket") q = q.Arg("path", path) return &Container{ q: q, c: r.c, } } func (r *Container) Workdir(ctx context.Context) (string, error) { if r.workdir != nil { return *r.workdir, nil } q := r.q.Select("workdir") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client export *bool id *DirectoryID sync *DirectoryID } type WithDirectoryFunc func(r *Directory) *Directory func (r *Directory) With(f WithDirectoryFunc) *Directory { return f(r) } func (r *Directory) Diff(other *Directory) *Directory { q := r.q.Select("diff") q = q.Arg("other", other) return &Directory{ q: q, c: r.c, } } func (r *Directory) Directory(path string) *Directory { q := r.q.Select("directory") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } type DirectoryDockerBuildOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Dockerfile string Platform Platform BuildArgs []BuildArg Target string Secrets []*Secret }
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
func (r *Directory) DockerBuild(opts ...DirectoryDockerBuildOpts) *Container { q := r.q.Select("dockerBuild") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Dockerfile) { q = q.Arg("dockerfile", opts[i].Dockerfile) } if !querybuilder.IsZeroValue(opts[i].Platform) { q = q.Arg("platform", opts[i].Platform) } if !querybuilder.IsZeroValue(opts[i].BuildArgs) { q = q.Arg("buildArgs", opts[i].BuildArgs) } if !querybuilder.IsZeroValue(opts[i].Target) { q = q.Arg("target", opts[i].Target) } if !querybuilder.IsZeroValue(opts[i].Secrets) { q = q.Arg("secrets", opts[i].Secrets) } } return &Container{ q: q, c: r.c, } } type DirectoryEntriesOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Path string } func (r *Directory) Entries(ctx context.Context, opts ...DirectoryEntriesOpts) ([]string, error) { q := r.q.Select("entries") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Path) { q = q.Arg("path", opts[i].Path) } } var response []string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Directory) Export(ctx context.Context, path string) (bool, error) { if r.export != nil { return *r.export, nil } q := r.q.Select("export") q = q.Arg("path", path) var response bool q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Directory) File(path string) *File {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q := r.q.Select("file") q = q.Arg("path", path) return &File{ q: q, c: r.c, } } func (r *Directory) ID(ctx context.Context) (DirectoryID, error) { if r.id != nil { return *r.id, nil } q := r.q.Select("id") var response DirectoryID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Directory) XXX_GraphQLType() string { return "Directory" } func (r *Directory) XXX_GraphQLIDType() string { return "DirectoryID" } func (r *Directory) XXX_GraphQLID(ctx context.Context) (string, error) { id, err := r.ID(ctx) if err != nil { return "", err } return string(id), nil } type DirectoryPipelineOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Description string Labels []PipelineLabel } func (r *Directory) Pipeline(name string, opts ...DirectoryPipelineOpts) *Directory { q := r.q.Select("pipeline") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Description) { q = q.Arg("description", opts[i].Description) } if !querybuilder.IsZeroValue(opts[i].Labels) { q = q.Arg("labels", opts[i].Labels) } } q = q.Arg("name", name) return &Directory{ q: q, c: r.c, } } func (r *Directory) Sync(ctx context.Context) (*Directory, error) { q := r.q.Select("sync") return r, q.Execute(ctx, r.c) } type DirectoryWithDirectoryOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Exclude []string Include []string } func (r *Directory) WithDirectory(path string, directory *Directory, opts ...DirectoryWithDirectoryOpts) *Directory { q := r.q.Select("withDirectory") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Exclude) { q = q.Arg("exclude", opts[i].Exclude) } if !querybuilder.IsZeroValue(opts[i].Include) { q = q.Arg("include", opts[i].Include) } } q = q.Arg("path", path) q = q.Arg("directory", directory) return &Directory{ q: q, c: r.c, } } type DirectoryWithFileOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Permissions int } func (r *Directory) WithFile(path string, source *File, opts ...DirectoryWithFileOpts) *Directory { q := r.q.Select("withFile") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Permissions) { q = q.Arg("permissions", opts[i].Permissions) } } q = q.Arg("path", path) q = q.Arg("source", source) return &Directory{ q: q, c: r.c, } } type DirectoryWithNewDirectoryOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Permissions int } func (r *Directory) WithNewDirectory(path string, opts ...DirectoryWithNewDirectoryOpts) *Directory { q := r.q.Select("withNewDirectory") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Permissions) { q = q.Arg("permissions", opts[i].Permissions) } } q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } type DirectoryWithNewFileOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Permissions int } func (r *Directory) WithNewFile(path string, contents string, opts ...DirectoryWithNewFileOpts) *Directory { q := r.q.Select("withNewFile") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Permissions) { q = q.Arg("permissions", opts[i].Permissions) } } q = q.Arg("path", path) q = q.Arg("contents", contents)
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
return &Directory{ q: q, c: r.c, } } func (r *Directory) WithTimestamps(timestamp int) *Directory { q := r.q.Select("withTimestamps") q = q.Arg("timestamp", timestamp) return &Directory{ q: q, c: r.c, } } func (r *Directory) WithoutDirectory(path string) *Directory { q := r.q.Select("withoutDirectory") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } func (r *Directory) WithoutFile(path string) *Directory { q := r.q.Select("withoutFile") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } type EnvVariable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client name *string value *string } func (r *EnvVariable) Name(ctx context.Context) (string, error) { if r.name != nil { return *r.name, nil } q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *EnvVariable) Value(ctx context.Context) (string, error) { if r.value != nil { return *r.value, nil } q := r.q.Select("value") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type File struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client contents *string export *bool id *FileID size *int sync *FileID } type WithFileFunc func(r *File) *File func (r *File) With(f WithFileFunc) *File { return f(r) } func (r *File) Contents(ctx context.Context) (string, error) { if r.contents != nil { return *r.contents, nil } q := r.q.Select("contents") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type FileExportOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
AllowParentDirPath bool } func (r *File) Export(ctx context.Context, path string, opts ...FileExportOpts) (bool, error) { if r.export != nil { return *r.export, nil } q := r.q.Select("export") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].AllowParentDirPath) { q = q.Arg("allowParentDirPath", opts[i].AllowParentDirPath) } } q = q.Arg("path", path) var response bool q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *File) ID(ctx context.Context) (FileID, error) { if r.id != nil { return *r.id, nil } q := r.q.Select("id") var response FileID q = q.Bind(&response) return response, q.Execute(ctx, r.c) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
func (r *File) XXX_GraphQLType() string { return "File" } func (r *File) XXX_GraphQLIDType() string { return "FileID" } func (r *File) XXX_GraphQLID(ctx context.Context) (string, error) { id, err := r.ID(ctx) if err != nil { return "", err } return string(id), nil } func (r *File) Size(ctx context.Context) (int, error) { if r.size != nil { return *r.size, nil } q := r.q.Select("size") var response int q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *File) Sync(ctx context.Context) (*File, error) { q := r.q.Select("sync") return r, q.Execute(ctx, r.c) } func (r *File) WithTimestamps(timestamp int) *File { q := r.q.Select("withTimestamps") q = q.Arg("timestamp", timestamp) return &File{
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q: q, c: r.c, } } type GitRef struct { q *querybuilder.Selection c graphql.Client } type GitRefTreeOpts struct { SSHKnownHosts string SSHAuthSocket *Socket } func (r *GitRef) Tree(opts ...GitRefTreeOpts) *Directory { q := r.q.Select("tree") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].SSHKnownHosts) { q = q.Arg("sshKnownHosts", opts[i].SSHKnownHosts) } if !querybuilder.IsZeroValue(opts[i].SSHAuthSocket) { q = q.Arg("sshAuthSocket", opts[i].SSHAuthSocket) } } return &Directory{ q: q, c: r.c, } } type GitRepository struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *GitRepository) Branch(name string) *GitRef { q := r.q.Select("branch") q = q.Arg("name", name) return &GitRef{ q: q, c: r.c, } } func (r *GitRepository) Commit(id string) *GitRef { q := r.q.Select("commit") q = q.Arg("id", id) return &GitRef{ q: q, c: r.c, } } func (r *GitRepository) Tag(name string) *GitRef { q := r.q.Select("tag") q = q.Arg("name", name) return &GitRef{ q: q, c: r.c, } } type Host struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client } type HostDirectoryOpts struct { Exclude []string Include []string } func (r *Host) Directory(path string, opts ...HostDirectoryOpts) *Directory { q := r.q.Select("directory") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Exclude) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q = q.Arg("exclude", opts[i].Exclude) } if !querybuilder.IsZeroValue(opts[i].Include) { q = q.Arg("include", opts[i].Include) } } q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } func (r *Host) File(path string) *File { q := r.q.Select("file") q = q.Arg("path", path) return &File{ q: q, c: r.c, } } func (r *Host) UnixSocket(path string) *Socket { q := r.q.Select("unixSocket") q = q.Arg("path", path) return &Socket{ q: q, c: r.c, } } type Label struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client name *string value *string } func (r *Label) Name(ctx context.Context) (string, error) { if r.name != nil { return *r.name, nil } q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Label) Value(ctx context.Context) (string, error) { if r.value != nil { return *r.value, nil } q := r.q.Select("value") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Port struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q *querybuilder.Selection c graphql.Client description *string port *int protocol *NetworkProtocol } func (r *Port) Description(ctx context.Context) (string, error) { if r.description != nil { return *r.description, nil } q := r.q.Select("description") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Port) Port(ctx context.Context) (int, error) { if r.port != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
return *r.port, nil } q := r.q.Select("port") var response int q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Port) Protocol(ctx context.Context) (NetworkProtocol, error) { if r.protocol != nil { return *r.protocol, nil } q := r.q.Select("protocol") var response NetworkProtocol q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Project struct { q *querybuilder.Selection c graphql.Client id *ProjectID name *string } type WithProjectFunc func(r *Project) *Project func (r *Project) With(f WithProjectFunc) *Project { return f(r) } func (r *Project) Commands(ctx context.Context) ([]ProjectCommand, error) { q := r.q.Select("commands") q = q.Select("description id name resultType") type commands struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Description string Id ProjectCommandID Name string ResultType string } convert := func(fields []commands) []ProjectCommand { out := []ProjectCommand{} for i := range fields { out = append(out, ProjectCommand{description: &fields[i].Description, id: &fields[i].Id, name: &fields[i].Name, resultType: &fields[i].ResultType}) } return out } var response []commands q = q.Bind(&response) err := q.Execute(ctx, r.c) if err != nil { return nil, err } return convert(response), nil } func (r *Project) ID(ctx context.Context) (ProjectID, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
if r.id != nil { return *r.id, nil } q := r.q.Select("id") var response ProjectID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Project) XXX_GraphQLType() string { return "Project" } func (r *Project) XXX_GraphQLIDType() string { return "ProjectID" } func (r *Project) XXX_GraphQLID(ctx context.Context) (string, error) { id, err := r.ID(ctx) if err != nil { return "", err } return string(id), nil } func (r *Project) Load(source *Directory, configPath string) *Project { q := r.q.Select("load") q = q.Arg("source", source) q = q.Arg("configPath", configPath) return &Project{ q: q, c: r.c, } }
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
func (r *Project) Name(ctx context.Context) (string, error) { if r.name != nil { return *r.name, nil } q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type ProjectCommand struct { q *querybuilder.Selection c graphql.Client description *string id *ProjectCommandID name *string resultType *string } func (r *ProjectCommand) Description(ctx context.Context) (string, error) { if r.description != nil { return *r.description, nil } q := r.q.Select("description") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *ProjectCommand) Flags(ctx context.Context) ([]ProjectCommandFlag, error) { q := r.q.Select("flags") q = q.Select("description name") type flags struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Description string Name string } convert := func(fields []flags) []ProjectCommandFlag { out := []ProjectCommandFlag{} for i := range fields { out = append(out, ProjectCommandFlag{description: &fields[i].Description, name: &fields[i].Name}) } return out } var response []flags q = q.Bind(&response) err := q.Execute(ctx, r.c) if err != nil { return nil, err } return convert(response), nil } func (r *ProjectCommand) ID(ctx context.Context) (ProjectCommandID, error) { if r.id != nil { return *r.id, nil } q := r.q.Select("id") var response ProjectCommandID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *ProjectCommand) XXX_GraphQLType() string { return "ProjectCommand"
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
} func (r *ProjectCommand) XXX_GraphQLIDType() string { return "ProjectCommandID" } func (r *ProjectCommand) XXX_GraphQLID(ctx context.Context) (string, error) { id, err := r.ID(ctx) if err != nil { return "", err } return string(id), nil } func (r *ProjectCommand) Name(ctx context.Context) (string, error) { if r.name != nil { return *r.name, nil } q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *ProjectCommand) ResultType(ctx context.Context) (string, error) { if r.resultType != nil { return *r.resultType, nil } q := r.q.Select("resultType") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *ProjectCommand) Subcommands(ctx context.Context) ([]ProjectCommand, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q := r.q.Select("subcommands") q = q.Select("description id name resultType") type subcommands struct { Description string Id ProjectCommandID Name string ResultType string } convert := func(fields []subcommands) []ProjectCommand { out := []ProjectCommand{} for i := range fields { out = append(out, ProjectCommand{description: &fields[i].Description, id: &fields[i].Id, name: &fields[i].Name, resultType: &fields[i].ResultType}) } return out } var response []subcommands q = q.Bind(&response) err := q.Execute(ctx, r.c) if err != nil { return nil, err } return convert(response), nil } type ProjectCommandFlag struct { q *querybuilder.Selection c graphql.Client description *string name *string } func (r *ProjectCommandFlag) Description(ctx context.Context) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
if r.description != nil { return *r.description, nil } q := r.q.Select("description") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *ProjectCommandFlag) Name(ctx context.Context) (string, error) { if r.name != nil { return *r.name, nil } q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type WithClientFunc func(r *Client) *Client func (r *Client) With(f WithClientFunc) *Client { return f(r) } func (r *Client) CacheVolume(key string) *CacheVolume { q := r.q.Select("cacheVolume") q = q.Arg("key", key) return &CacheVolume{ q: q, c: r.c, } } type ContainerOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
ID ContainerID Platform Platform } func (r *Client) Container(opts ...ContainerOpts) *Container { q := r.q.Select("container") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].ID) { q = q.Arg("id", opts[i].ID) } if !querybuilder.IsZeroValue(opts[i].Platform) { q = q.Arg("platform", opts[i].Platform) } } return &Container{ q: q, c: r.c, } } func (r *Client) DefaultPlatform(ctx context.Context) (Platform, error) { q := r.q.Select("defaultPlatform") var response Platform q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type DirectoryOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
ID DirectoryID } func (r *Client) Directory(opts ...DirectoryOpts) *Directory { q := r.q.Select("directory") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].ID) { q = q.Arg("id", opts[i].ID) } } return &Directory{ q: q, c: r.c, } } func (r *Client) File(id FileID) *File { q := r.q.Select("file") q = q.Arg("id", id) return &File{ q: q, c: r.c, } } type GitOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
KeepGitDir bool ExperimentalServiceHost *Container } func (r *Client) Git(url string, opts ...GitOpts) *GitRepository { q := r.q.Select("git") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].KeepGitDir) { q = q.Arg("keepGitDir", opts[i].KeepGitDir) } if !querybuilder.IsZeroValue(opts[i].ExperimentalServiceHost) { q = q.Arg("experimentalServiceHost", opts[i].ExperimentalServiceHost) } } q = q.Arg("url", url) return &GitRepository{
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
q: q, c: r.c, } } func (r *Client) Host() *Host { q := r.q.Select("host") return &Host{ q: q, c: r.c, } } type HTTPOpts struct { ExperimentalServiceHost *Container } func (r *Client) HTTP(url string, opts ...HTTPOpts) *File { q := r.q.Select("http") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].ExperimentalServiceHost) { q = q.Arg("experimentalServiceHost", opts[i].ExperimentalServiceHost) } } q = q.Arg("url", url) return &File{ q: q, c: r.c, } } type PipelineOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
Description string Labels []PipelineLabel } func (r *Client) Pipeline(name string, opts ...PipelineOpts) *Client { q := r.q.Select("pipeline") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Description) { q = q.Arg("description", opts[i].Description) } if !querybuilder.IsZeroValue(opts[i].Labels) { q = q.Arg("labels", opts[i].Labels) } } q = q.Arg("name", name) return &Client{ q: q, c: r.c, } } type ProjectOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
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,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
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,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
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,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
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) if err != nil { return "", err } return string(id), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
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" } func (r *Socket) XXX_GraphQLIDType() string { return "SocketID" } func (r *Socket) XXX_GraphQLID(ctx context.Context) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
sdk/go/api.gen.go
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 ImageMediaTypes string const ( Dockermediatypes ImageMediaTypes = "DockerMediaTypes" Ocimediatypes ImageMediaTypes = "OCIMediaTypes" ) type NetworkProtocol string const ( Tcp NetworkProtocol = "TCP" Udp NetworkProtocol = "UDP" )
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
secret/store.go
package secret import ( "context" "errors" "sync" "github.com/dagger/dagger/core" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/session/secrets" ) var ErrNotFound = errors.New("secret not found") func NewStore() *Store { return &Store{ secrets: map[string]string{}, } } var _ secrets.SecretStore = &Store{} type Store struct { gw bkgw.Client
closed
dagger/dagger
https://github.com/dagger/dagger
5,069
Handling Binary Data
## Background While trying to implement examples for issue [Allow directories to be mounted as secrets](https://github.com/dagger/dagger/issues/4896), it became apparent that there are limitations when dealing with binary data in GraphQL using strings. This is relevant for the purpose of mounting directories as secrets, where binary data needs to be handled. I encountered a problem when attempting to handle GPG files. The goal was to create and GPG-sign a built binary with Dagger by mounting the `~/.gnupg` directory into the container and running `gpg --detach-sign --armor binary-name`. This required the following files: - ~/.gnupg/pubring.kbx - ~/.gnupg/trustdb.gpg - ~/.gnupg/private-keys-v1.d/* Handling binary data like GPG files in GraphQL led to errors due to improper escaping: ```shell go run . Connected to engine c01f0fd17590 panic: input:1: Syntax Error GraphQL request (1:49) Invalid character escape sequence: \\x. ``` The initial idea was to implement a union type `SecretData = String | Bytes` in the `setSecret` query. However, according to the [discussion](https://github.com/dagger/dagger/issues/5000#issuecomment-1518352932), using unions as input values in GraphQL is not feasible. ## Issue The main issue is finding a solution to handle both string and binary data when setting secrets in GraphQL, as the initial proposal of using a union type is not possible. This is important for mounting directories as secrets and handling binary data efficiently. ## Proposed Solution Based on the comments and limitations mentioned in the discussion, the best solution seems to be to create a new function that accepts binary data as Base64 encoded string as input. This function would be a variation of withSecretVariable and handle binary data separately. ### Advantages - No character encoding issues: By using Base64 encoding, we can ensure that all binary data is properly serialized and deserialized without any issues related to character encoding. - Efficient data transfer: Base64-encoded binary data is more compact than a string representation, reducing the overhead associated with transferring binary data in GraphQL queries or mutations. - Clear type information: Defining a custom type allows us to be explicit regarding the expected encoded format #### Steps to implement the solution: 1. Create a new custom type `Base64` in the GraphQL schema to handle binary data. ```graphql type Base64 string ``` 2. Define a new function in the client SDK called WithSecretBytes that accepts an environment variable name and Base64 data as input. ```go func (c *Container) setSecretBytes(name string, data Base64) *Container ``` 3. Update the GraphQL schema to include the new function setSecretBytes. ```graphql extend type Query { "Sets a secret given a user-defined name to its binary data and returns the secret." setSecretBytes( """ The user-defined name for this secret """ name: String! """ The binary data of the secret """ data: Base64! ): Secret! } ``` 4. Implement deserialization functions for the Base64 `setSecretBytes`, handling the decoding of binary from Base64. 5. Update the SDK example to show how to convert binary data to Base64-encoded strings before sending them as secret arguments. By implementing this new function, we can effectively handle binary data in GraphQL, making it possible to mount directories as secrets in a more convenient and efficient manner. cc @vikram-dagger @helderco @vito
https://github.com/dagger/dagger/issues/5069
https://github.com/dagger/dagger/pull/5500
99a054bc0bc14baf91783871d8364b5be5d10177
09677c0311acb73891b7798d65777957f1a5d513
2023-05-02T14:47:43Z
go
2023-07-28T00:04:29Z
secret/store.go
mu sync.Mutex secrets map[string]string } func (store *Store) SetGateway(gw bkgw.Client) { store.gw = gw } func (store *Store) AddSecret(_ context.Context, name, plaintext string) (core.SecretID, error) { store.mu.Lock() defer store.mu.Unlock() secret := core.NewDynamicSecret(name) store.secrets[secret.Name] = plaintext return secret.ID() } func (store *Store) GetSecret(_ context.Context, idOrName string) ([]byte, error) { store.mu.Lock() defer store.mu.Unlock() var name string if secret, err := core.SecretID(idOrName).ToSecret(); err == nil { name = secret.Name } else { name = idOrName } plaintext, ok := store.secrets[name] if !ok { return nil, ErrNotFound } return []byte(plaintext), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
core/schema/query.go
package schema import ( "fmt" "strings" "github.com/blang/semver" "github.com/vito/progrock" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/engine" ) type querySchema struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
core/schema/query.go
*MergedSchemas } var _ ExecutableSchema = &querySchema{} func (s *querySchema) Name() string { return "query" } func (s *querySchema) Schema() string { return Query } func (s *querySchema) Resolvers() Resolvers { return Resolvers{ "Query": ObjectResolver{ "pipeline": ToResolver(s.pipeline), "checkVersionCompatibility": ToResolver(s.checkVersionCompatibility), }, } } func (s *querySchema) Dependencies() []ExecutableSchema { return nil } type pipelineArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
core/schema/query.go
Name string Description string Labels []pipeline.Label } func (s *querySchema) pipeline(ctx *core.Context, parent *core.Query, args pipelineArgs) (*core.Query, error) { if parent == nil { parent = &core.Query{} } parent.Context.Pipeline = parent.Context.Pipeline.Add(pipeline.Pipeline{ Name: args.Name, Description: args.Description, Labels: args.Labels, }) return parent, nil } type checkVersionCompatibilityArgs struct { Version string } func (s *querySchema) checkVersionCompatibility(ctx *core.Context, _ *core.Query, args checkVersionCompatibilityArgs) (bool, error) { recorder := progrock.RecorderFromContext(ctx) if strings.Contains(engine.Version, "devel") { recorder.Warn("Using development engine; skipping version compatibility check.") return true, nil
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
core/schema/query.go
} engineVersion, err := semver.Parse(engine.Version) if err != nil { return false, err } sdkVersion, err := semver.Parse(args.Version) if err != nil { return false, err } if engineVersion.Major > sdkVersion.Major { recorder.Warn(fmt.Sprintf("Dagger engine version (%s) is significantly newer than the SDK's required version (%s). Please update your SDK.", engineVersion, sdkVersion)) return false, nil } if engineVersion.LT(sdkVersion) { recorder.Warn(fmt.Sprintf("Dagger engine version (%s) is older than the SDK's required version (%s). Please update your Dagger CLI.", engineVersion, sdkVersion)) return false, nil } if engineVersion.Minor > sdkVersion.Minor { recorder.Warn(fmt.Sprintf("Dagger engine version (%s) is newer than the SDK's required version (%s). Consider updating your SDK.", engineVersion, sdkVersion)) } return true, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
package client import ( "context" "encoding/base64" "encoding/json" "errors" "fmt" "io" "net" "net/http" "net/url" "os" "path/filepath" "strconv" "strings" "sync" "time" "github.com/Khan/genqlient/graphql" "github.com/cenkalti/backoff/v4" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/telemetry" "github.com/docker/cli/cli/config" "github.com/google/uuid" controlapi "github.com/moby/buildkit/api/services/control" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/identity"
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
bksession "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth/authprovider" "github.com/moby/buildkit/session/filesync" "github.com/moby/buildkit/session/grpchijack" "github.com/tonistiigi/fsutil" fstypes "github.com/tonistiigi/fsutil/types" "github.com/vito/progrock" "golang.org/x/sync/errgroup" "google.golang.org/grpc" ) const OCIStoreName = "dagger-oci" type Params struct { ServerID string ParentClientIDs []string SecretToken string RunnerHost string UserAgent string DisableHostRW bool JournalFile string ProgrockWriter progrock.Writer EngineNameCallback func(string) CloudURLCallback func(string) } type Client struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
Params eg *errgroup.Group internalCtx context.Context internalCancel context.CancelFunc closeCtx context.Context closeRequests context.CancelFunc closeMu sync.RWMutex Recorder *progrock.Recorder httpClient *http.Client bkClient *bkclient.Client bkSession *bksession.Session upstreamCacheOptions []*controlapi.CacheOptionsEntry hostname string nestedSessionPort int } func Connect(ctx context.Context, params Params) (_ *Client, _ context.Context, rerr error) { c := &Client{Params: params} if c.SecretToken == "" { c.SecretToken = uuid.New().String() } if c.ServerID == "" { c.ServerID = identity.NewID() } c.internalCtx, c.internalCancel = context.WithCancel(context.Background()) c.eg, c.internalCtx = errgroup.WithContext(c.internalCtx) defer func() { if rerr != nil { c.internalCancel() } }()
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
c.closeCtx, c.closeRequests = context.WithCancel(context.Background()) progMultiW := progrock.MultiWriter{} if c.ProgrockWriter != nil { progMultiW = append(progMultiW, c.ProgrockWriter) } if c.JournalFile != "" { fw, err := newProgrockFileWriter(c.JournalFile) if err != nil { return nil, nil, err } progMultiW = append(progMultiW, fw) } tel := telemetry.New() var cloudURL string if tel.Enabled() { cloudURL = tel.URL() progMultiW = append(progMultiW, telemetry.NewWriter(tel)) } if c.CloudURLCallback != nil && cloudURL != "" { c.CloudURLCallback(cloudURL) } recorder := progrock.NewPassthroughRecorder(progMultiW) c.Recorder = recorder
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
ctx = progrock.RecorderToContext(ctx, c.Recorder) nestedSessionPortVal, isNestedSession := os.LookupEnv("DAGGER_SESSION_PORT") if isNestedSession { nestedSessionPort, err := strconv.Atoi(nestedSessionPortVal) if err != nil { return nil, nil, fmt.Errorf("parse DAGGER_SESSION_PORT: %w", err) } c.nestedSessionPort = nestedSessionPort c.SecretToken = os.Getenv("DAGGER_SESSION_TOKEN") c.httpClient = &http.Client{ Transport: &http.Transport{ DialContext: c.NestedDialContext, DisableKeepAlives: true, }, } return c, ctx, nil } cacheConfigType, cacheConfigAttrs, err := cacheConfigFromEnv() if err != nil { return nil, nil, fmt.Errorf("cache config from env: %w", err) } if cacheConfigType != "" { c.upstreamCacheOptions = []*controlapi.CacheOptionsEntry{{ Type: cacheConfigType, Attrs: cacheConfigAttrs, }} }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
remote, err := url.Parse(c.RunnerHost) if err != nil { return nil, nil, fmt.Errorf("parse runner host: %w", err) } bkClient, err := newBuildkitClient(ctx, remote, c.UserAgent) if err != nil { return nil, nil, fmt.Errorf("new client: %w", err) } c.bkClient = bkClient defer func() { if rerr != nil { c.bkClient.Close() } }() if c.EngineNameCallback != nil { info, err := c.bkClient.Info(ctx) if err != nil { return nil, nil, fmt.Errorf("get info: %w", err) } engineName := fmt.Sprintf("%s (version %s)", info.BuildkitVersion.Package, info.BuildkitVersion.Version) c.EngineNameCallback(engineName) } hostname, err := os.Hostname() if err != nil { return nil, nil, fmt.Errorf("get hostname: %w", err) } c.hostname = hostname sharedKey := c.ServerID bkSession, err := bksession.NewSession(ctx, identity.NewID(), sharedKey) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
return nil, nil, fmt.Errorf("new s: %w", err) } c.bkSession = bkSession defer func() { if rerr != nil { c.bkSession.Close() } }() workdir, err := os.Getwd() if err != nil { return nil, nil, fmt.Errorf("get workdir: %w", err) } c.internalCtx = engine.ContextWithClientMetadata(c.internalCtx, &engine.ClientMetadata{ ClientID: c.ID(), ClientSecretToken: c.SecretToken, ServerID: c.ServerID, ClientHostname: c.hostname, Labels: pipeline.LoadVCSLabels(workdir), ParentClientIDs: c.ParentClientIDs, }) bkSession.Allow(progRockAttachable{progMultiW}) if !c.DisableHostRW { bkSession.Allow(AnyDirSource{}) bkSession.Allow(AnyDirTarget{}) } bkSession.Allow(SocketProvider{ EnableHostNetworkAccess: !c.DisableHostRW,
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
}) bkSession.Allow(authprovider.NewDockerAuthProvider(config.LoadDefaultConfigFile(os.Stderr))) c.eg.Go(func() error { return bkSession.Run(c.internalCtx, func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error) { return grpchijack.Dialer(c.bkClient.ControlClient())(ctx, proto, engine.ClientMetadata{ RegisterClient: true, ClientID: c.ID(), ClientSecretToken: c.SecretToken, ServerID: c.ServerID, ParentClientIDs: c.ParentClientIDs, ClientHostname: hostname, UpstreamCacheConfig: c.upstreamCacheOptions, }.AppendToMD(meta)) }) }) c.httpClient = &http.Client{Transport: &http.Transport{ DialContext: c.DialContext, DisableKeepAlives: true, }} bo := backoff.NewExponentialBackOff() bo.InitialInterval = 100 * time.Millisecond connectRetryCtx, connectRetryCancel := context.WithTimeout(ctx, 300*time.Second) defer connectRetryCancel()
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
err = backoff.Retry(func() error { ctx, cancel := context.WithTimeout(connectRetryCtx, bo.NextBackOff()) defer cancel() return c.Do(ctx, `{defaultPlatform}`, "", nil, nil) }, backoff.WithContext(bo, connectRetryCtx)) if err != nil { return nil, nil, fmt.Errorf("connect: %w", err) } return c, ctx, nil } func (c *Client) Close() (rerr error) { c.closeMu.Lock() defer c.closeMu.Unlock() select { case <-c.closeCtx.Done(): return nil default: } if len(c.upstreamCacheOptions) > 0 { cacheExportCtx, cacheExportCancel := context.WithTimeout(c.internalCtx, 600*time.Second) defer cacheExportCancel() _, err := c.bkClient.ControlClient().Solve(cacheExportCtx, &controlapi.SolveRequest{ Cache: controlapi.CacheOptions{ Exports: c.upstreamCacheOptions, }, }) rerr = errors.Join(rerr, err) } c.closeRequests()
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
if c.internalCancel != nil { c.internalCancel() } if c.httpClient != nil { c.eg.Go(func() error { c.httpClient.CloseIdleConnections() return nil }) } if c.bkSession != nil { c.eg.Go(c.bkSession.Close) } if c.bkClient != nil { c.eg.Go(c.bkClient.Close) } if err := c.eg.Wait(); err != nil { rerr = errors.Join(rerr, err) } if c.Recorder != nil { c.Recorder.Complete() c.Recorder.Close() } return rerr } func (c *Client) withClientCloseCancel(ctx context.Context) (context.Context, context.CancelFunc, error) { c.closeMu.RLock() defer c.closeMu.RUnlock() select {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
case <-c.closeCtx.Done(): return nil, nil, errors.New("client closed") default: } ctx, cancel := context.WithCancel(ctx) go func() { select { case <-c.closeCtx.Done(): cancel() case <-ctx.Done(): } }() return ctx, cancel, nil } func (c *Client) ID() string { return c.bkSession.ID() } func (c *Client) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return nil, err } conn, err := grpchijack.Dialer(c.bkClient.ControlClient())(ctx, "", engine.ClientMetadata{ ClientID: c.ID(), ClientSecretToken: c.SecretToken, ServerID: c.ServerID, ClientHostname: c.hostname, ParentClientIDs: c.ParentClientIDs,
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
}.ToGRPCMD()) if err != nil { return nil, err } go func() { <-c.closeCtx.Done() cancel() conn.Close() }() return conn, nil } func (c *Client) NestedDialContext(ctx context.Context, _, _ string) (net.Conn, error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return nil, err } conn, err := (&net.Dialer{ Cancel: ctx.Done(), KeepAlive: -1, }).Dial("tcp", "127.0.0.1:"+strconv.Itoa(c.nestedSessionPort)) if err != nil { return nil, err } go func() { <-c.closeCtx.Done() cancel() conn.Close() }() return conn, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
func (c *Client) Do( ctx context.Context, query string, opName string, variables map[string]any, data any, ) (rerr error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return err } defer cancel() gqlClient := graphql.NewClient("http:dagger/query", doerWithHeaders{ inner: c.httpClient, headers: http.Header{ "Authorization": []string{"Basic " + base64.StdEncoding.EncodeToString([]byte(c.SecretToken+":"))}, }, }) req := &graphql.Request{ Query: query, Variables: variables, OpName: opName, } resp := &graphql.Response{} err = gqlClient.MakeRequest(ctx, req, resp) if err != nil { return fmt.Errorf("make request: %w", err) } if resp.Errors != nil { errs := make([]error, len(resp.Errors))
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
for i, err := range resp.Errors { errs[i] = err } return errors.Join(errs...) } if data != nil { dataBytes, err := json.Marshal(resp.Data) if err != nil { return fmt.Errorf("marshal data: %w", err) } err = json.Unmarshal(dataBytes, data) if err != nil { return fmt.Errorf("unmarshal data: %w", err) } } return nil } func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx, cancel, err := c.withClientCloseCancel(r.Context()) if err != nil { w.WriteHeader(http.StatusBadGateway) w.Write([]byte("client has closed: " + err.Error())) return } r = r.WithContext(ctx) defer cancel() if c.SecretToken != "" { username, _, ok := r.BasicAuth() if !ok || username != c.SecretToken { w.Header().Set("WWW-Authenticate", `Basic realm="Access to the Dagger engine session"`)
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
w.WriteHeader(http.StatusUnauthorized) return } } resp, err := c.httpClient.Do(&http.Request{ Method: r.Method, URL: &url.URL{ Scheme: "http", Host: "dagger", Path: r.URL.Path, }, Header: r.Header, Body: r.Body, }) if err != nil { w.WriteHeader(http.StatusBadGateway) w.Write([]byte("http do: " + err.Error())) return } defer resp.Body.Close() for k, v := range resp.Header { w.Header()[k] = v } w.WriteHeader(resp.StatusCode) _, err = io.Copy(w, resp.Body) if err != nil { panic(err) } } type AnyDirSource struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
func (s AnyDirSource) Register(server *grpc.Server) { filesync.RegisterFileSyncServer(server, s) } func (s AnyDirSource) TarStream(stream filesync.FileSync_TarStreamServer) error { return fmt.Errorf("tarstream not supported") }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
func (s AnyDirSource) DiffCopy(stream filesync.FileSync_DiffCopyServer) error { opts, err := engine.LocalImportOptsFromContext(stream.Context()) if err != nil { return fmt.Errorf("get local import opts: %w", err) } if opts.ReadSingleFileOnly { fileContents, err := os.ReadFile(opts.Path) if err != nil { return fmt.Errorf("read file: %w", err) } if len(fileContents) > int(opts.MaxFileSize) { return fmt.Errorf("file contents too large: %d > %d", len(fileContents), opts.MaxFileSize) } return stream.SendMsg(&filesync.BytesMessage{Data: fileContents}) } return fsutil.Send(stream.Context(), stream, fsutil.NewFS(opts.Path, &fsutil.WalkOpt{ IncludePatterns: opts.IncludePatterns, ExcludePatterns: opts.ExcludePatterns, FollowPaths: opts.FollowPaths, Map: func(p string, st *fstypes.Stat) fsutil.MapResult { st.Uid = 0 st.Gid = 0 return fsutil.MapResultKeep }, }), nil) } type AnyDirTarget struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
func (t AnyDirTarget) Register(server *grpc.Server) { filesync.RegisterFileSendServer(server, t) } func (AnyDirTarget) DiffCopy(stream filesync.FileSend_DiffCopyServer) (rerr error) { opts, err := engine.LocalExportOptsFromContext(stream.Context()) if err != nil { return fmt.Errorf("get local export opts: %w", err) } if !opts.IsFileStream { if err := os.MkdirAll(opts.Path, 0700); err != nil { return fmt.Errorf("failed to create synctarget dest dir %s: %w", opts.Path, err) } err := fsutil.Receive(stream.Context(), stream, opts.Path, fsutil.ReceiveOpt{ Merge: true, Filter: func(path string, stat *fstypes.Stat) bool { stat.Uid = uint32(os.Getuid()) stat.Gid = uint32(os.Getgid()) return true }, }) if err != nil { return fmt.Errorf("failed to receive fs changes: %w", err) } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
allowParentDirPath := opts.AllowParentDirPath fileOriginalName := opts.FileOriginalName var destParentDir string var finalDestPath string stat, err := os.Lstat(opts.Path) switch { case errors.Is(err, os.ErrNotExist): destParentDir = filepath.Dir(opts.Path) finalDestPath = opts.Path case err != nil: return fmt.Errorf("failed to stat synctarget dest %s: %w", opts.Path, err) case !stat.IsDir(): destParentDir = filepath.Dir(opts.Path) finalDestPath = opts.Path case !allowParentDirPath: return fmt.Errorf("destination %q is a directory; must be a file path unless allowParentDirPath is set", opts.Path) default:
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
if fileOriginalName == "" { return fmt.Errorf("cannot export container tar to existing directory %q", opts.Path) } destParentDir = opts.Path finalDestPath = filepath.Join(destParentDir, fileOriginalName) } if err := os.MkdirAll(destParentDir, 0700); err != nil { return fmt.Errorf("failed to create synctarget dest dir %s: %w", destParentDir, err) } destF, err := os.OpenFile(finalDestPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) if err != nil { return fmt.Errorf("failed to create synctarget dest file %s: %w", finalDestPath, err) } defer destF.Close() for { msg := filesync.BytesMessage{} if err := stream.RecvMsg(&msg); err != nil { if errors.Is(err, io.EOF) { return nil } return err } if _, err := destF.Write(msg.Data); err != nil { return err } } } type progRockAttachable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
writer progrock.Writer } func (a progRockAttachable) Register(srv *grpc.Server) { progrock.RegisterProgressServiceServer(srv, progrock.NewRPCReceiver(a.writer)) } const ( cacheConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_CONFIG" ) func cacheConfigFromEnv() (string, map[string]string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
envVal, ok := os.LookupEnv(cacheConfigEnvName) if !ok { return "", nil, nil } kvs := strings.Split(envVal, ",") if len(kvs) == 0 { return "", nil, nil } attrs := make(map[string]string) for _, kv := range kvs { parts := strings.SplitN(kv, "=", 2) if len(parts) != 2 { return "", nil, fmt.Errorf("invalid form for cache config %q", kv) } attrs[parts[0]] = parts[1] } typeVal, ok := attrs["type"] if !ok { return "", nil, fmt.Errorf("missing type in cache config: %q", envVal) } delete(attrs, "type") return typeVal, attrs, nil } type doerWithHeaders struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
engine/client/client.go
inner graphql.Doer headers http.Header } func (d doerWithHeaders) Do(req *http.Request) (*http.Response, error) { for k, v := range d.headers { req.Header[k] = v } return d.inner.Do(req) }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
package mage import ( "context" "fmt" "os" "os/exec" "path" "path/filepath" "runtime" "strings" "time" "dagger.io/dagger" "github.com/dagger/dagger/internal/mage/sdk" "github.com/dagger/dagger/internal/mage/util" "github.com/magefile/mage/mg" "golang.org/x/mod/semver" ) var publishedEngineArches = []string{"amd64", "arm64"} func parseRef(tag string) error {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
if tag == "main" { return nil } if ok := semver.IsValid(tag); !ok { return fmt.Errorf("invalid semver tag: %s", tag) } return nil } type Engine mg.Namespace func (t Engine) Build(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("build") _, err = util.HostDaggerBinary(c).Export(ctx, "./bin/dagger") return err } func (t Engine) Lint(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("lint") repo := util.RepositoryGoCodeOnly(c) _, err = c.Container(). From("golangci/golangci-lint:v1.51-alpine"). WithMountedDirectory("/app", repo). WithWorkdir("/app"). WithExec([]string{"golangci-lint", "run", "-v", "--timeout", "5m"}). Sync(ctx) return err } func (t Engine) Publish(ctx context.Context, version string) error { if err := parseRef(version); err != nil { return err } c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("publish") var ( engineImage = util.GetHostEnv("DAGGER_ENGINE_IMAGE") ref = fmt.Sprintf("%s:%s", engineImage, version) ) digest, err := c.Container().Publish(ctx, ref, dagger.ContainerPublishOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
PlatformVariants: util.DevEngineContainer(c, publishedEngineArches), }) if err != nil { return err } if semver.IsValid(version) { sdks := sdk.All{} if err := sdks.Bump(ctx, version); err != nil { return err } } else { fmt.Printf("'%s' is not a semver version, skipping image bump in SDKs", version) } time.Sleep(3 * time.Second) fmt.Println("PUBLISHED IMAGE REF:", digest) return nil } func (t Engine) TestPublish(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("test-publish") _, err = c.Container().Export(ctx, "./engine.tar.gz", dagger.ContainerExportOpts{ PlatformVariants: util.DevEngineContainer(c, publishedEngineArches), }) return err } func registry(c *dagger.Client) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
return c.Pipeline("registry").Container().From("registry:2"). WithExposedPort(5000, dagger.ContainerWithExposedPortOpts{Protocol: dagger.Tcp}). WithExec(nil) } func privateRegistry(c *dagger.Client) *dagger.Container { const htpasswd = "john:$2y$05$/iP8ud0Fs8o3NLlElyfVVOp6LesJl3oRLYoc3neArZKWX10OhynSC" return c.Pipeline("private registry").Container().From("registry:2"). WithNewFile("/auth/htpasswd", dagger.ContainerWithNewFileOpts{Contents: htpasswd}). WithEnvVariable("REGISTRY_AUTH", "htpasswd"). WithEnvVariable("REGISTRY_AUTH_HTPASSWD_REALM", "Registry Realm"). WithEnvVariable("REGISTRY_AUTH_HTPASSWD_PATH", "/auth/htpasswd"). WithExposedPort(5000, dagger.ContainerWithExposedPortOpts{Protocol: dagger.Tcp}). WithExec(nil) } func (t Engine) test(ctx context.Context, race bool) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("test") opts := util.DevEngineOpts{ ConfigEntries: map[string]string{ `registry."registry:5000"`: "http = true", `registry."privateregistry:5000"`: "http = true", }, } devEngine := util.DevEngineContainer(c.Pipeline("dev-engine"), []string{runtime.GOARCH}, util.DefaultDevEngineOpts, opts)[0]
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
tmpDir, err := os.MkdirTemp("", "dagger-dev-engine-*") if err != nil { return err } defer os.RemoveAll(tmpDir) _, err = devEngine.Export(ctx, path.Join(tmpDir, "engine.tar")) if err != nil { return err } testEngineUtils := c.Host().Directory(tmpDir, dagger.HostDirectoryOpts{ Include: []string{"engine.tar"}, }).WithFile("/dagger", util.DaggerBinary(c), dagger.DirectoryWithFileOpts{ Permissions: 0755, }) registrySvc := registry(c) devEngine = devEngine. WithServiceBinding("registry", registrySvc). WithServiceBinding("privateregistry", privateRegistry(c)). WithExposedPort(1234, dagger.ContainerWithExposedPortOpts{Protocol: dagger.Tcp}). WithMountedCache("/var/lib/dagger", c.CacheVolume("dagger-dev-engine-test-state")). WithExec(nil, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, }) endpoint, err := devEngine.Endpoint(ctx, dagger.ContainerEndpointOpts{Port: 1234, Scheme: "tcp"}) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
return err } cgoEnabledEnv := "0" args := []string{ "gotestsum", "--format", "testname", "--no-color=false", "--jsonfile=./tests.log", "--", "-parallel=16", "-count=1", "-timeout=15m", } if race { args = append(args, "-race", "-timeout=1h") cgoEnabledEnv = "1" } args = append(args, "./...") cliBinPath := "/.dagger-cli" utilDirPath := "/dagger-dev" tests := util.GoBase(c). WithExec([]string{"go", "install", "gotest.tools/gotestsum@v1.10.0"}). WithMountedDirectory("/app", util.Repository(c)). WithMountedDirectory(utilDirPath, testEngineUtils). WithEnvVariable("_DAGGER_TESTS_ENGINE_TAR", filepath.Join(utilDirPath, "engine.tar")). WithWorkdir("/app"). WithServiceBinding("dagger-engine", devEngine). WithServiceBinding("registry", registrySvc). WithEnvVariable("CGO_ENABLED", cgoEnabledEnv)
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
cacheEnv, set := os.LookupEnv("_EXPERIMENTAL_DAGGER_CACHE_CONFIG") if set { tests = tests.WithEnvVariable("_EXPERIMENTAL_DAGGER_CACHE_CONFIG", cacheEnv) } _, err = tests. WithMountedFile(cliBinPath, util.DaggerBinary(c)). WithEnvVariable("_EXPERIMENTAL_DAGGER_CLI_BIN", cliBinPath). WithEnvVariable("_EXPERIMENTAL_DAGGER_RUNNER_HOST", endpoint). WithMountedDirectory("/root/.docker", util.HostDockerDir(c)). WithExec(args). WithExec([]string{"gotestsum", "tool", "slowest", "--jsonfile=./tests.log", "--threshold=1s"}). Sync(ctx) return err } func (t Engine) Test(ctx context.Context) error { return t.test(ctx, false) } func (t Engine) TestRace(ctx context.Context) error { return t.test(ctx, true) } func (t Engine) Dev(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() c = c.Pipeline("engine").Pipeline("dev") arches := []string{runtime.GOARCH} tarPath := "./bin/engine.tar"
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
_, err = c.Container().Export(ctx, tarPath, dagger.ContainerExportOpts{ PlatformVariants: util.DevEngineContainer(c, arches), }) if err != nil { return err } volumeName := util.EngineContainerName imageName := fmt.Sprintf("localhost/%s:latest", util.EngineContainerName) loadCmd := exec.CommandContext(ctx, "docker", "load", "-i", tarPath) output, err := loadCmd.CombinedOutput() if err != nil { return fmt.Errorf("docker load failed: %w: %s", err, output) } _, imageID, ok := strings.Cut(string(output), "sha256:") if !ok { return fmt.Errorf("unexpected output from docker load: %s", output) } imageID = strings.TrimSpace(imageID) if output, err := exec.CommandContext(ctx, "docker", "tag", imageID, imageName, ).CombinedOutput(); err != nil { return fmt.Errorf("docker tag: %w: %s", err, output) } if output, err := exec.CommandContext(ctx, "docker", "rm", "-fv", util.EngineContainerName,
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/engine.go
).CombinedOutput(); err != nil { return fmt.Errorf("docker rm: %w: %s", err, output) } runArgs := []string{ "run", "-d", "-e", util.CacheConfigEnvName, "-e", util.ServicesDNSEnvName, "-e", "_EXPERIMENTAL_DAGGER_CLOUD_TOKEN", "-e", "_EXPERIMENTAL_DAGGER_CLOUD_URL", "-v", volumeName + ":" + util.EngineDefaultStateDir, "--name", util.EngineContainerName, "--privileged", } runArgs = append(runArgs, imageName, "--debug") if output, err := exec.CommandContext(ctx, "docker", runArgs...).CombinedOutput(); err != nil { return fmt.Errorf("docker run: %w: %s", err, output) } binDest := filepath.Join(os.Getenv("DAGGER_SRC_ROOT"), "bin", "dagger") _, err = util.HostDaggerBinary(c).Export(ctx, binDest) if err != nil { return err } fmt.Println("export _EXPERIMENTAL_DAGGER_CLI_BIN=" + binDest) fmt.Println("export _EXPERIMENTAL_DAGGER_RUNNER_HOST=docker-container://" + util.EngineContainerName) return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
package util import ( "bytes" "context" "fmt" "runtime" "sort" "text/template" "dagger.io/dagger" "golang.org/x/exp/maps" ) const ( engineBinName = "dagger-engine" shimBinName = "dagger-shim" alpineVersion = "3.18" runcVersion = "v1.1.5" cniVersion = "v1.2.0" qemuBinImage = "tonistiigi/binfmt:buildkit-v7.1.0-30@sha256:45dd57b4ba2f24e2354f71f1e4e51f073cb7a28fd848ce6f5f2a7701142a6bf0" engineTomlPath = "/etc/dagger/engine.toml"
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
EngineDefaultStateDir = "/var/lib/dagger" engineEntrypointPath = "/usr/local/bin/dagger-entrypoint.sh" CacheConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_CONFIG" ServicesDNSEnvName = "_EXPERIMENTAL_DAGGER_SERVICES_DNS" ) const engineEntrypointTmpl = `#!/bin/sh set -e # cgroup v2: enable nesting # see https://github.com/moby/moby/blob/38805f20f9bcc5e87869d6c79d432b166e1c88b4/hack/dind#L28 if [ -f /sys/fs/cgroup/cgroup.controllers ]; then # move the processes from the root group to the /init group, # otherwise writing subtree_control fails with EBUSY. # An error during moving non-existent process (i.e., "cat") is ignored. mkdir -p /sys/fs/cgroup/init xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || : # enable controllers sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \ > /sys/fs/cgroup/cgroup.subtree_control fi exec {{.EngineBin}} --config {{.EngineConfig}} {{ range $key := .EntrypointArgKeys -}}--{{ $key }}="{{ index $.EntrypointArgs $key }}" {{ end -}} "$@" ` const engineConfigTmpl = ` debug = true insecure-entitlements = ["security.insecure"] {{ range $key := .ConfigKeys }} [{{ $key }}] {{ index $.ConfigEntries $key }} {{ end -}} ` type DevEngineOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
EntrypointArgs map[string]string ConfigEntries map[string]string Name string } func getEntrypoint(opts ...DevEngineOpts) (string, error) { mergedOpts := map[string]string{} for _, opt := range opts { maps.Copy(mergedOpts, opt.EntrypointArgs) } keys := maps.Keys(mergedOpts) sort.Strings(keys) var entrypoint string type entrypointTmplParams struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
Bridge string EngineBin string EngineConfig string EntrypointArgs map[string]string EntrypointArgKeys []string } tmpl := template.Must(template.New("entrypoint").Parse(engineEntrypointTmpl)) buf := new(bytes.Buffer) err := tmpl.Execute(buf, entrypointTmplParams{ EngineBin: "/usr/local/bin/" + engineBinName, EngineConfig: engineTomlPath, EntrypointArgs: mergedOpts, EntrypointArgKeys: keys, }) if err != nil { panic(err) } entrypoint = buf.String() return entrypoint, nil } func getConfig(opts ...DevEngineOpts) (string, error) { mergedOpts := map[string]string{} for _, opt := range opts { maps.Copy(mergedOpts, opt.ConfigEntries) } keys := maps.Keys(mergedOpts) sort.Strings(keys) var config string type configTmplParams struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
ConfigEntries map[string]string ConfigKeys []string } tmpl := template.Must(template.New("config").Parse(engineConfigTmpl)) buf := new(bytes.Buffer) err := tmpl.Execute(buf, configTmplParams{ ConfigEntries: mergedOpts, ConfigKeys: keys, }) if err != nil { panic(err) } config = buf.String() return config, nil } func CIDevEngineContainerAndEndpoint(ctx context.Context, c *dagger.Client, opts ...DevEngineOpts) (*dagger.Container, string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
devEngine := CIDevEngineContainer(c, opts...) endpoint, err := devEngine.Endpoint(ctx, dagger.ContainerEndpointOpts{Port: 1234, Scheme: "tcp"}) if err != nil { return nil, "", err } return devEngine, endpoint, nil } var DefaultDevEngineOpts = DevEngineOpts{ EntrypointArgs: map[string]string{ "network-name": "dagger-dev", "network-cidr": "10.88.0.0/16", }, ConfigEntries: map[string]string{ "grpc": `address=["unix:///var/run/buildkit/buildkitd.sock", "tcp://0.0.0.0:1234"]`, `registry."docker.io"`: `mirrors = ["mirror.gcr.io"]`, }, } func CIDevEngineContainer(c *dagger.Client, opts ...DevEngineOpts) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
engineOpts := []DevEngineOpts{} engineOpts = append(engineOpts, DefaultDevEngineOpts) engineOpts = append(engineOpts, opts...) var cacheVolumeName string if len(opts) > 0 { for _, opt := range opts { if opt.Name != "" { cacheVolumeName = opt.Name } } } if cacheVolumeName != "" { cacheVolumeName = "dagger-dev-engine-state-" + cacheVolumeName } else { cacheVolumeName = "dagger-dev-engine-state" } devEngine := devEngineContainer(c, runtime.GOARCH, engineOpts...) devEngine = devEngine.WithExposedPort(1234, dagger.ContainerWithExposedPortOpts{Protocol: dagger.Tcp}). WithMountedCache("/var/lib/dagger", c.CacheVolume(cacheVolumeName)). WithExec(nil, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, ExperimentalPrivilegedNesting: true, }) return devEngine } func DevEngineContainer(c *dagger.Client, arches []string, opts ...DevEngineOpts) []*dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
return devEngineContainers(c, arches, opts...) } func devEngineContainer(c *dagger.Client, arch string, opts ...DevEngineOpts) *dagger.Container { engineConfig, err := getConfig(opts...) if err != nil { panic(err) } engineEntrypoint, err := getEntrypoint(opts...) if err != nil { panic(err)
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
} return c.Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From("alpine:"+alpineVersion). WithExec([]string{ "apk", "add", "git", "openssh", "pigz", "xz", "iptables", "ip6tables", "dnsmasq", }). WithFile("/usr/local/bin/runc", runcBin(c, arch), dagger.ContainerWithFileOpts{ Permissions: 0o700, }). WithFile("/usr/local/bin/buildctl", buildctlBin(c, arch)). WithFile("/usr/local/bin/"+shimBinName, shimBin(c, arch)). WithFile("/usr/local/bin/"+engineBinName, engineBin(c, arch)). WithDirectory("/usr/local/bin", qemuBins(c, arch)). WithDirectory("/opt/cni/bin", cniPlugins(c, arch)). WithDirectory(EngineDefaultStateDir, c.Directory()). WithNewFile(engineTomlPath, dagger.ContainerWithNewFileOpts{ Contents: engineConfig, Permissions: 0o600, }). WithNewFile(engineEntrypointPath, dagger.ContainerWithNewFileOpts{ Contents: engineEntrypoint, Permissions: 0o755, }). WithEntrypoint([]string{"dagger-entrypoint.sh"}) } func devEngineContainers(c *dagger.Client, arches []string, opts ...DevEngineOpts) []*dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
platformVariants := make([]*dagger.Container, 0, len(arches)) for _, arch := range arches { platformVariants = append(platformVariants, devEngineContainer(c, arch, opts...)) } return platformVariants } func cniPlugins(c *dagger.Client, arch string) *dagger.Directory { cniURL := fmt.Sprintf( "https://github.com/containernetworking/plugins/releases/download/%s/cni-plugins-%s-%s-%s.tgz", cniVersion, "linux", arch, cniVersion, ) return c.Container(). From("alpine:"+alpineVersion). WithMountedFile("/tmp/cni-plugins.tgz", c.HTTP(cniURL)). WithDirectory("/opt/cni/bin", c.Directory()). WithExec([]string{ "tar", "-xzf", "/tmp/cni-plugins.tgz", "-C", "/opt/cni/bin", "./bridge", "./firewall", "./loopback", "./host-local", }). WithFile("/opt/cni/bin/dnsname", dnsnameBinary(c, arch)). Directory("/opt/cni/bin") } func dnsnameBinary(c *dagger.Client, arch string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/dnsname", "-ldflags", "-s -w", "/app/cmd/dnsname", }). File("./bin/dnsname") } func buildctlBin(c *dagger.Client, arch string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/buildctl", "-ldflags", "-s -w", "github.com/moby/buildkit/cmd/buildctl", }). File("./bin/buildctl") } func runcBin(c *dagger.Client, arch string) *dagger.File { return c.HTTP(fmt.Sprintf( "https://github.com/opencontainers/runc/releases/download/%s/runc.%s", runcVersion, arch, )) } func shimBin(c *dagger.Client, arch string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
5,572
🐞 `dagger run` is reporting an incorrect Engine version
### What is the issue? When running `dagger run` with `v0.8.0`, the Engine version is reported incorrectly: <img width="607" alt="image" src="https://github.com/dagger/dagger/assets/3342/4c6fcc9e-985b-4032-95e7-ebeed03f94b2"> For comparison, this is what the output looks like for `v0.6.4`: <img width="509" alt="image" src="https://github.com/dagger/dagger/assets/3342/1f94f12c-a46b-4c2a-8cf4-cd078d446ebd"> <img width="587" alt="image" src="https://github.com/dagger/dagger/assets/3342/b27d01d7-c137-4485-9006-6deb7fa01574"> --- I suspect that this is related to https://github.com/dagger/dagger/pull/5315, but I did not spend time digging into it. cc @TomChv @vito ### Log output _No response_ ### Steps to reproduce _No response_ ### SDK version Go SDK v0.8.0 ### OS version SDK / CLI on macOS 12.6 & Engine on NixOS 22.11 (Linux 5.15)
https://github.com/dagger/dagger/issues/5572
https://github.com/dagger/dagger/pull/5578
0a46ff767287dfadaa403c0882d24983eb2c8713
1d802ce9b96ccac30bd179eae86c50d1a92698d6
2023-08-03T19:23:31Z
go
2023-08-04T16:07:38Z
internal/mage/util/engine.go
return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/" + shimBinName, "-ldflags", "-s -w", "/app/cmd/shim", }). File("./bin/" + shimBinName) } func engineBin(c *dagger.Client, arch string) *dagger.File { return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/" + engineBinName, "-ldflags", "-s -w", "/app/cmd/engine", }). File("./bin/" + engineBinName) } func qemuBins(c *dagger.Client, arch string) *dagger.Directory { return c. Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From(qemuBinImage). Rootfs() }
closed
dagger/dagger
https://github.com/dagger/dagger
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
package templates import ( "regexp" "sort" "strings" "text/template" "github.com/iancoleman/strcase" "github.com/dagger/dagger/codegen/generator" "github.com/dagger/dagger/codegen/introspection" ) var ( commonFunc = generator.NewCommonFunctions(&FormatTypeFunc{})
closed
dagger/dagger
https://github.com/dagger/dagger
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
funcMap = template.FuncMap{ "CommentToLines": commentToLines, "FormatDeprecation": formatDeprecation, "FormatReturnType": commonFunc.FormatReturnType, "FormatInputType": commonFunc.FormatInputType, "FormatOutputType": commonFunc.FormatOutputType, "FormatEnum": formatEnum, "FormatName": formatName, "GetOptionalArgs": getOptionalArgs, "GetRequiredArgs": getRequiredArgs, "HasPrefix": strings.HasPrefix, "PascalCase": pascalCase, "IsArgOptional": isArgOptional, "IsCustomScalar": isCustomScalar, "IsEnum": isEnum, "ArgsHaveDescription": argsHaveDescription, "SortInputFields": sortInputFields, "SortEnumFields": sortEnumFields, "Solve": solve, "Subtract": subtract, "ConvertID": commonFunc.ConvertID, "IsSelfChainable": commonFunc.IsSelfChainable, "IsListOfObject": commonFunc.IsListOfObject, "GetArrayField": commonFunc.GetArrayField, "ToLowerCase": commonFunc.ToLowerCase, "ToUpperCase": commonFunc.ToUpperCase, "ToSingleType": toSingleType, } ) func pascalCase(name string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
return strcase.ToCamel(name) } func solve(field introspection.Field) bool { if field.TypeRef == nil { return false } return field.TypeRef.IsScalar() || field.TypeRef.IsList() } func subtract(a, b int) int { return a - b } func commentToLines(s string) []string { s = strings.TrimSpace(s) if s == "" { return []string{} } split := strings.Split(s, "\n") return split } func formatDeprecation(s string) []string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
r := regexp.MustCompile("`[a-zA-Z0-9_]+`") matches := r.FindAllString(s, -1) for _, match := range matches { replacement := strings.TrimPrefix(match, "`") replacement = strings.TrimSuffix(replacement, "`") replacement = formatName(replacement) s = strings.ReplaceAll(s, match, replacement) } return commentToLines("@deprecated " + s) } func isCustomScalar(t *introspection.Type) bool { switch introspection.Scalar(t.Name) { case introspection.ScalarString, introspection.ScalarInt, introspection.ScalarFloat, introspection.ScalarBoolean: return false default: return t.Kind == introspection.TypeKindScalar } } func isEnum(t *introspection.Type) bool { return t.Kind == introspection.TypeKindEnum && !strings.HasPrefix(t.Name, "__") } func formatName(s string) string { if s == generator.QueryStructName { return generator.QueryStructClientName } return s } func formatEnum(s string) string {