Commit Graph

41 Commits

Author SHA1 Message Date
Andrea Luzzardi
a61e8dcb62 prepare the transition to #Plan.context
This change helps the transition between `dagger input` and `#Plan.context`.

In summary, the codebase now relies on a *context* for execution with mapping to *IDs*.
In the future, *context* will come from a `#Plan.context`.
In the meantime, a bridge converts `dagger input` to a plan context. This allows both *old* and *new* style configurations to co-exist with the same underlying engine.

- Implement `plancontext`. Context holds the execution context for a plan. Currently this includes the platform, local directories, secrets and services (e.g. unix/npipe).
- Contextual data can be registered at any point. In the future, this will be done by `#Plan.context`
- Migrated the `dagger input` codebase to register inputs in a `plancontext`
- Migrated low-level types/operations to the *Context ID* pattern.
  - `dagger.#Stream` now only includes an `id` (instead of `unix` path)
  - `dagger.#Secret` still includes only an ID, but now it's based off `plancontext`
  - `op.#Local` now only includes an `id` (instead of `path`, `include`, `exclude`.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-11-19 11:29:38 -08:00
Sam Alba
a4761c0f64 stdlib/docker: #Run do not fail if container exists and recreate is false
Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
2021-11-02 15:09:15 -07:00
Sam Alba
72723c4ca7 stdlib/docker: #Run checks if the container exists and can optionnally recreate it
Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
2021-11-02 11:41:53 -07:00
Andrea Luzzardi
50d55a8885 op.#SaveImage: export the image ID
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-10-12 15:39:04 -07:00
Andrea Luzzardi
5a1d4bff62 Support loading artifacts into a Docker Engine
This adds support to loading artifacts (e.g. docker.#Build,
os.#Container, ...) into any arbitrary docker engine (through a
dagger.#Stream for UNIX sockets or SSH for a remote engine)

Implementation:
- Add op.#SaveImage which serializes an artifact into an arbitrary path
  (docker tarball format)
- Add docker.#Load which uses op.#SaveImage to serialize to disk and
  executes `docker load` to load it back

Caveats: Because we're doing this in userspace rather than letting
dagger itself load the image, the performance is pretty bad.

The buildkit API is meant for streaming (get a stream of a docker image
pipe it into docker load). Because of userspace, we have to load the
entire docker image into memory, then serialize it in a single WriteFile
LLB operation.

Example:

```cue
package main

import (
	"alpha.dagger.io/dagger"
	"alpha.dagger.io/docker"
)

source: dagger.#Input & dagger.#Artifact

dockersocket: dagger.#Input & dagger.#Stream

build: docker.#Build & {
	"source": source
}

load: docker.#Load & {
	source: build
	tag:    "testimage"
	socket: dockersocket
}
```

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-10-12 14:16:01 -07:00
Richard Jones
c04ef323d2
cue fmt
Signed-off-by: Richard Jones <richard@dagger.io>
2021-09-27 20:40:55 -06:00
Richard Jones
9f16bcdadb added ports to docker.#Run
Signed-off-by: Richard Jones <richard@dagger.io>
2021-09-27 20:39:28 -06:00
Sam Alba
e757af6706
Merge pull request #980 from VazeeKevin/tasks/docker-args-secrets
Add #Secret type to Docker #Build args
2021-09-23 15:31:03 -07:00
Kevin Poirot
51f96172bd Add #Secret type to Docker #Build args
Signed-off-by: Kevin Poirot <kevin@vazee.fr>
2021-09-23 11:13:59 +02:00
Sam Alba
eaa965127a stdlib: added support for local docker socket
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-09-21 17:19:00 -07:00
Kevin Poirot
3e14920062 Update Docker #Build to incorporate image from Dockerfile
Signed-off-by: Kevin Poirot <kevin@vazee.fr>
2021-09-15 08:55:59 +02:00
Kevin Poirot
924fd163eb Add args option to Docker #Build
Signed-off-by: Kevin Poirot <kevin@vazee.fr>
2021-09-13 14:38:20 +02:00
Tom Chauveau
7cc1c8e5dd
Update docker package according to op.#PushContainer improvement
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-08-31 13:05:22 +02:00
Guillaume de Rouville
ecd409951c docker.#Push: Set auth as optional
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
2021-07-02 01:21:56 +02:00
Tom Chauveau
d10f2a49a5 Rename field according to @shykes review
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-30 16:58:04 +02:00
Tom Chauveau
5468f60e39 Normalize reference to login on registry
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-30 16:58:04 +02:00
Tom Chauveau
7d1bbcc416 Fix docker hub login error when using image ref as target
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-30 16:58:04 +02:00
Tom Chauveau
f842f1ed1d Remove old docker push and pull test
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-30 16:58:04 +02:00
Tom Chauveau
b1ed40ffed Improve #docker.Push definition :
- Push to private registry
- Output ref and digest
- Update doc
- Add tests to universe.bats

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-30 16:58:04 +02:00
Solomon Hykes
d7a805f42b stdlib: move all imports to alpha.dagger.io
Signed-off-by: Solomon Hykes <solomon@dagger.io>
2021-06-25 10:31:22 +00:00
Sam Alba
6422b4d36d stdlib: cue fmt
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-06-15 10:47:39 +02:00
Sam Alba
9281967e16 stdlib: added package doc strings
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-06-15 10:46:56 +02:00
Tom Chauveau
b8a97fb6e7 Update docker.#Run definition and tests
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-12 12:04:47 +02:00
Andrea Luzzardi
2acf0ce4e5 stdlib: docker: disable local #Run
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-06-07 16:33:10 -07:00
Andrea Luzzardi
ce5accd09c stdlib: docker: support running containers on the local docker engine
Depends on #570

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-06-07 16:33:07 -07:00
Tom Chauveau
a39e87b179 docker.#Run now use secrets from dagger.#Secret
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-03 14:03:33 +02:00
Tom Chauveau
4b6315e2fc Handle fingerprint option for auth
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-29 18:29:39 +02:00
Tom Chauveau
7c4df827c3 Add docker.#Client definition
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-27 18:15:36 +02:00
Tom Chauveau
27a60d3cdf Add tests for docker.#Run
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-27 18:15:36 +02:00
Tom Chauveau
f8760213bd Add #Run definition in docker stdlib package.
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-27 18:15:36 +02:00
Sam Alba
a4167dc3f4 cue fmt
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-05-26 12:28:24 +02:00
Sam Alba
7009d01835 stdlib: added @dagger(input) and @dagger(output) attributes
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-05-26 12:23:44 +02:00
Tom Chauveau
8ce8e8e01f Add #Push definition and tests
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-13 21:38:15 +02:00
Solomon Hykes
98b3951c73 stdlib: os package
Signed-off-by: Solomon Hykes <solomon@dagger.io>
2021-05-11 17:32:50 -07:00
Solomon Hykes
647e4c898b stdlib: improved Docker package
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-04-06 15:41:36 -07:00
Solomon Hykes
299a38c6b1 Simplify "dev dagger with dagger" example
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-04-06 13:41:21 -07:00
Solomon Hykes
6673ae69b3 stdlib: rename dagger.io/llb to dagger.io/dagger/op
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-04-06 10:28:40 -07:00
Andrea Luzzardi
c16455249e cue files: #compute -> #up
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-02 16:08:15 -07:00
Andrea Luzzardi
1a3dc3debc dagger spec: fix Artifact definition
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-31 14:20:31 -07:00
Solomon Hykes
54a2fe4393 stdlib package: llb
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-03-15 22:25:18 -07:00
Solomon Hykes
41c973ba04 stdlib package: docker
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-03-12 18:10:36 -08:00