name: inverse class: title,inverse <img src="./logo1.png" width="100" /> Dagger # A Portable devkit for CI/CD pipelines <br /> ## anarcher@gmail.com ## 2022-04-15 --- class: inverse # Why Dagger? - A developer's dream is a devops engineer's nightmare - Modernizing the CI/CD development experience - Write your pipeline once, run anywhere   [INTRODUCING DAGGER: A NEW WAY TO CREATE CI/CD PIPELINES](https://dagger.io/blog/public-launch-announcement) [Dagger vs. Other Software](https://docs.dagger.io/1220/vs) --- class: inverse # Getting Started - hello world <pre><code class="hljs remark-code" style="font-size: 85%;">// dagger do hello --log-format=plain package helloworld import ( "dagger.io/dagger" "dagger.io/dagger/core" ) dagger.#Plan & { actions: { _alpine: core.#Pull & { source: "alpine:3" } // hello world hello: core.#Exec & { input: _alpine.output args: ["echo","hello, world!"] always: true } } } </code></pre> [helloworld.cue](https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/examples/helloworld/helloworld.cue) --- class: inverse # Getting Started - Summary `dagger = buildkit + CUE` - Containers for executing all Dagger Actions - Cue for describing action steps  Copyright by dagger.io --- class: inverse # Plan One simple configuration for everything: the Plan(`dagger.#Plan`) ```cue dagger.#Plan & { client: { filesystem: { ... } env: { ... } } actions: { deps: docker.#Build & { ... } test: bash.#Run & { ... } build: { run: bash.#Run & { ... } contents: core.#Subdir & { ... } } deploy: netlify.#Deploy & { ... } } } ``` [dagger.io/dagger/plan.cue](https://github.com/dagger/dagger/blob/main/pkg/dagger.io/dagger/plan.cue) --- class: inverse # Action Lego for your pipelines: the Action API - As of Dagger 0.2, the Dagger CUE API can be imported via `dagger.io/dagger` & `dagger.io/dagger/core` - [Core Actions Reference](https://docs.dagger.io/1222/core-actions-reference) - `#GitPull`: [git.cue](https://github.com/dagger/dagger/blob/main/pkg/dagger.io/dagger/core/git.cue): Download a repository from a remote git server <pre><code class="hljs remark-code" style="font-size: 80%;">#SomeAction: { url: string deployUrl: string } dagger.#Plan & { client: filesystem: "output.json": write: contents: json.Marshal({ url: actions.test.url deployUrl: actions.test.deployUrl }) actions: { test: #SomeAction & {} } } </code></pre> --- class: inverse # Action API: `universe.dagger.io` - Safely reuse code from the Dagger community - Dagger community, curated by Dagger ## Docker API Import paths: [universe.dagger.io/docker](https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/docker) - `#Image`: a container image - `#Run`: run a command in a container - `#Push`: upload an image to a repository - `#Pull`: download an image from a repository - `#Build`: build an image - [universe.dagger.io/examples](https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/examples) - [universe.dagger.io/x](https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/x) --- # Buildkit LLB(Low Level Builder)  - [Introducing BuildKit](https://blog.mobyproject.org/introducing-buildkit-17e056cc5317) - DAG([Directed acyclic grapch](https://en.wikipedia.org/wiki/Directed_acyclic_graph))ger --- # CUE: Configure Unify Execute - [Hello: CUE:](https://slide.anarcher.dev/2020/hello-cue/#1) - [Order is irrelevant](https://cuelang.org/docs/tutorials/tour/intro/order/) - [dagger: What is CUE?](https://docs.dagger.io/1215/what-is-cue/) --- # Dagger An over-simplified description of how `Dagger` works under the hood might be: a `DAG` compute engine powered by `Buildkit` and programmable in `Cue` from Solomon Hykes(Docker & Dagger founder) - https://dagger.io - https://docs.dagger.io 