#general
1 messages · Page 17 of 1
Consider docker.#Build as a syntaxique sugar to avoid repetitive input/output, but sometime we want to exports things or do stuff that feels more natural with chained docker.#Run
Ok, so under the wood is the same. docker.#Run not means it run container somewhere (docker run). All run in build
getting an error when following the dagger local CI/CD here https://docs.dagger.io/1200/local-dev
dagger do build
failed to load plan: "client.env.APP_NAME" is not set
Everyone should be able to develop, test and run their CI/CD pipeline locally.
tried setting the APP_NAME but still didn't help
everything is local on my Macbook
Hi, we've just found out that we might have introduced a breaking change #help-old-do-not-post message. Basically, we introduced checks on the concreteness of a Plan prior a run, and it seems to have impacted the client API
Hah! I added dagger to my general-purpose, downloading-random-binaries-off-t'internets ASDF plugin just yesterday 🙂 https://github.com/jpluscplusm/asdf-arbitrary-code-execution/ & https://github.com/jpluscplusm/asdf-arbitrary-code-execution/blob/main/examples/dagger/config.cue
Checked out v0.2.8 and everything seemed to work as documented. Thanks! Looking forward to working and contributing to dagger!
Anyone using Dagger with Concourse CI and have an example pipeline they'd be willing to share?
Anyone using Dagger with Concourse CI
Anyone encountered ERR failed to pull buildkit image....output=Error response from daemon: Get "https://registry-1.docker.io/v2/": tls: first record does not look like a TLS handshake. I have proxy set on my Docker Desktop.
Interesting, I was looking way to integrate our existing plugin system to the dagger. Nice approach 👍
Hi guys! I am a Software Engineer interested in the latest DevOps technologies and happy to contribute to this community!
You’ve come to the right place 🙂 Welcome!
Thanks @winter linden I will start playing with the project to learn more!
registry TLS error
very new to dagger is there a way to include the Dockerfile by filename instead of by string contents (under https://docs.dagger.io/1205/container-images/#executing-a-dockerfile) or native CUE (https://docs.dagger.io/1205/container-images/#executing-a-dockerfile)? Want to test what Dockerfiles I already have without duplicating them in dagger files
You can use Dagger to build container images, either by executing a Dockerfile, or specifying the build steps natively in CUE. Which method to choose depends on the requirements of your project. You can mix and match builds from both methods in the same plan.
Yes you can set the path field instead of contents. https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/docker/build.cue#L75
is it possible to run composite Service containers (e.g., up DB container before running test cases in case of DB dependency) with dagger
As far as I know there is not a built in mechanism to do that, what you could do is execute the command at the client level to start your DB by doing docker run or even docker-compose -d, example here -> https://docs.dagger.io/1203/client/#running-commands
Then just work with the container where want to run the test cases 🤔
dagger.#Plan has a client field that allows interaction with the local machine where the dagger command line client is run. You can:
I tried to find an answer in the online docs. Does anyone know if there is a parameter for parallelizing the dagger build?
@rough galleon dagger automatically runs your actions in parallel depending on your input / outputs. For example, given the followin plan file:
dagger.#Plan & {
actions: {
_alpine: alpine.#Build & {
packages: bash: _
}
// Hello world
hello: {
hello1: bash.#Run & {
input: _alpine.output
script: contents: "sleep 5"
always: true
}
hello2: bash.#Run & {
input: _alpine.output
script: contents: "sleep 10"
always: true
}
}
}
}
the hello action will run both hello1 and hello2 in parallel
consecutively, if you make the actions depend on each other like this: (note the input of hello2 is hello1.output)
dagger.#Plan & {
actions: {
_alpine: alpine.#Build & {
packages: bash: _
}
// Hello world
hello: {
hello1: bash.#Run & {
input: _alpine.output
script: contents: "sleep 5"
always: true
}
hello2: bash.#Run & {
input: hello1.output
script: contents: "sleep 10"
always: true
}
}
}
}
In this case, they'll run sequentially as they have dependent inputs/outputs
Great, thank you. For jobs with lots of dependencies, does it limit the number of parallel jobs to the number of cores, or does it start them all?
@pseudo stream Can you speak to how buildkit would handle parallelization. Figure "it will use whatever is there, but it depends" is the short answer, but likely depends on factors like VM/phsyical machine config, container runtime config, Buildkit config, etc.
https://docs.docker.com/config/containers/resource_constraints/
@rough galleon By default there is no limit, but BuildKit has a mechanism to limit the amount of parallelization through its config file, search for max-parallelism here: https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md
That config setting won't be set by the default Buildkit setup by Dagger, but if you setup your own buildkitd you can customize it: https://docs.dagger.io/1223/custom-buildkit/
Hi all, I'm running Dagger 0.28 and it looks like some of the "progress" has gone when running actions. Is there a new command line option I need to pass?
Effectively, I am running an action that takes about 30 minutes to complete, and the timer has stopped at 1.2s evening though the action is still busy?
...and, is it possible to get feedback, via different steps in an SSH section?
Can you report it on github? @sharp marsh may know something about it.
@faint sleet can you try with the latest dagger version from main and see if the problem persists?
Is that a binary release?
no, you need to compile it from source. You can clone the dagger repo and run make dagger to get the latest binary
Hi. Could someone help review this feature https://github.com/dagger/dagger/pull/2310
It looks like it's fixed now. Thank you 🙂
However, I've done a dagger project update but now some of my dagger do actions aren't working?
update breaking change
Design for testability as a first-class concern
Hey all 👋 So I’m starting to mull over how “we” test shell scripts; and how we might use the CUE-abstraction-building-factory to help do that; and what Dagger can bring to the table in this space.
I’m really really interested in your thoughts in this area - particularly (but not exclusively!) about these 2 topics:
-
custom dagger modules (such as those in the universe and universe/x hierarchies) often ultimately reduce down to running some bundled shell script, in a dagger-orchestrated container; which isn’t a fantastic state of affairs, overall. Is this a temporary state of affairs, or something that folks have a plan to make significantly better? A public plan?? 🙂
-
we have, of course, “bats” as a unit/int testing tool. Is the dagger ecosystem actually a poor choice of place to thrash out an abstraction over the top of bats because — AFAICT — we’re a pretty “good” consumers of bats, being very boring and “just” using it as a shim into dagger, in the vast majority of cases?
Anyone here using [neo]vim for Dagger/CUE work? Wouldn't mind seeing some example config and plugin use.
It is quite limited as it is.
We're currently working on having some LSP available for CUE. So I guess, then you could use any good LSP plugin out there to have it natively in vim.
For now, I use vim, and I have the https://github.com/jjo/vim-cue plugin for CUE.
Somehow, the syntax highlighting doesn't automatically activate.
There is no code exploration (jump to definition, lists of reference). That would come with the LSP.
Thanks. That's basically what I have now, plus the autocmd settings. I guess CUE support is just limited across the board.
I have written a tree-sitter parser that you can use for better syntax highlighting https://github.com/eonpatapon/tree-sitter-cue 😉
Awesome! Just got it set up 😎
how to refer to environment variable $UID in cue file? trying to get this to work with rootless docker socket: For example, need to use this: client: network: "unix:///run/user/$UID/docker.sock": connect: dagger.#Socket
Use this form:
client: {
env: UID: string
network: docker: {
address: "unix:///run/user/\(env.UID)/docker.sock"
connect: dagger.#Socket
}
}
Reference with client.network.docker.connect.
hmm, now got this error: failed to load plan: expected selector, found "INTERPOLATION" ...
Can you show me what you have?
02:09:38 dagger1 → dagger do build
failed to load plan: expected selector, found 'INTERPOLATION'
"unix:///run/user/(:
./testdocker.cue:32:31
expected '}', found 'EOF':
./testdocker.cue:35:3
// Example usage in a plan
dagger.#Plan & {
env: UID: string
client: filesystem: "./src": read: contents: dagger.#FS
client: network: "unix:///run/user/(env.UID)/docker.sock":
connect: dagger.#Socket
actions: build: #PythonBuild & {
source: client.filesystem."./src".read.contents
}
actions: load: cli.#Load & {
image: actions.build.output
host: client.network."unix:///run/user/\(env.UID)/docker.sock".connect
tag: "myimage"
}
}
Look at my example, you need to use the other form. That path needs to be static, you need to use the address field instead.
ok
env: UID needs to be inside client.
makes sense! that helps with first one, but what about this one? host: client.network."unix:///run/user/(env.UID)/docker.sock".connect
Check just below my example. What key you used after client: network? If docker, then ---> client.network.docker.connect.
perfect, working now! Thanks!
I guess I am still missing something: it is working with this in place client: { env: UID: string | *"1025" .... but it still failed with this in place: client: { env: UID: string .... in this case, it keeps saying "FTL failed to execute plan: task failed: client.env: environment variable "UID" not set. But I could do "echo $UID" and see my UID..
interesting, if using this client: { env: MYUID: string ..., then run it like this: MYUID=1025 dagger do build, it would work. so dagger by default won't read from user shell environment variables?
Can you tell me how you're exporting that var?
UID is an environment variable set by bash. it would always be available for bash users. see: man bash | grep UID
Oh right, forgot about that.
Not all shell variables are exported.
This is one of those cases, it should be read-only, not exported.
What I do is: export PUID=$UID and then use that.
makes perfect sense now! UID is a bash built-in variable, not exported. for rootless docker, there is another exported variable to use in this case. This is now working, no need to use UID: client: { env: XDG_RUNTIME_DIR: string ...
then do: ```
network: {
docker: {
address: "unix://(env.XDG_RUNTIME_DIR)/docker.sock"
Awesome, even better 🙂
just curious... are there any codegen scripts for compdef so that I could add auto-completions for a given project's "dagger do" actions?
and if not... I guess it feels like a fun idea to add either some core scripts or some libs for letting folks quickly add the action.
AFAIK, the only way to list actions is dagger do with no arguments, but it would be pretty nice if the actions list integrates with the dagger completion command as well
dagger do —help works too. Yes auto-completion would be 🤯
G'day, everyone. I just discovered dagger today, but it already sounds very similar to a proprietary/non-public project of mine of a smaller scope. Reproducible multi-step deployment pipelines, able to run against multiple environments, passing inputs/outputs around, etc. Python, scripts, terraform, secret management, and "CI/CD favourite of the day" integration. I'll say something more interesting after I dig around a bit. ;-)
this is being answered in a thread in #help-old-do-not-post
i posted there first but got this response from a bot
Sorry about that! Looks like we prob don't have any Discord shared servers in common.
How did you join Dagger Discord? Via our webpage by clicking Discord icon?
https://dagger.io/
Or a different way.
I think if you click the icon, you'll get an invite to this Discord server and won't have the problem anymore.
yes, through the discord button at the top right from dagger.io. but now i think it is fixed, but i was able to interact with @turbid tulip from there
When I have lint errors locally, when running dagger do lint can I silence all the lines that look like this?
#25 0.224 deleted: website/static/img/use-cases/build-action.png
#25 0.224 deleted: website/static/img/use-cases/client-api.png
#25 0.224 deleted: website/static/img/use-cases/particubes-actions.png
#25 0.224 deleted: website/static/img/use-cases/particubes.com.png
#25 0.224 deleted: website/static/img/what-is-dagger.png
#25 0.224 deleted: website/yarn.lock ```
This is the head of the log in plain format:
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 Your branch is up to date with 'origin/1password'.
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 Changes not staged for commit:
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 (use "git add/rm <file>..." to update what will be committed)
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 (use "git restore <file>..." to discard changes in working directory)
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 deleted: .github/dependabot.yml
6:54PM INF actions.lint.cue._dag."4"._exec | #24 0.107 deleted: .github/workflows/add-issues-to-backlog.yml
Hey everyone, can anyone explain how we can use javascript to write cicd pipelines in dagger? as this paragraph suggests that we can write in javascript https://docs.dagger.io/1235/what#how-does-it-work see here. Please guide...
Dagger is a portable devkit for CICD.
You can use javascript to write Actions, not pipelines. The pipelines are all in CUE.
ok got it. thanks
As this image suggests, if anyone has written actions in javascript then please share, thanks
https://twitter.com/biradarsangam/status/1524277005667037185
👆 does anyone else think that we should make a docker desktop extension for dagger?
@solomonstre Since developer use docker desktop and are lot of universal packages in dagger anybody can play with it in dev environments or extension itself test run build there cicd pipeline with there fav tool !
not sure honestly, I still haven't wrapped my head around a real usecase (excluding the certainly good looking "we integrate with it!")
Still reading through the docs, but perhaps someone can answer. Is it possible to a generic list of actions? Use-case: China and the Great Firewall (aka constant network interruptions). Secondary use case: Security, avoiding dependency injections.
What do you mean by list of actions?
Basically an action is a set of one or more task and you can create dependency between actions, so by definition : a list of actions
Indeed you can also compose an action from a set of other actions
See https://docs.dagger.io/1221/action for complete explanation
Actions are the basic building block of the Dagger platform.
Terminology, sorry. Q: Is there anything that is downloaded from the Internet at "dagger do" time? eg. Docker images, plugins, etc.
If so, is there a way to easily parameterized the locations, eg. To download from a mirror, or pre-bake these dependencies. In the China use-case, we want to develop in Rest-Of-World, then have the same code also work in China, where github, docker registries, etc. are slow and unreliable.
At my org, we mirror some repos with deployment scripts to China, but have separate configuration repos. For terraform, we build a docker image with all the relevant providers, and mirror that to our docker registry in China.
We try very hard to avoid any network dependencies outside of China, because of the Great Firewall that always leads to Great Frustration.
does dagger support gitops? https://www.gitops.tech/
Yes, if you keep everything declarative 🙂
Oh goodtcha! Currently yes dagger do downloads image etc from internet but if you already have it cache in buildkit, it shouldn't be downloaded again.
I do not know any other workaround for know :/
you could perhaps probably play with the http(s)_proxy variable for buildkit to make it go through a (local?) proxy and then have policies there... I guess, haven't tried
Yeah, I've been thinking about a proxy there. Either caching with eventually-cached. Or we also have a private line, so could theoretically bypass the Firewall.. but the latter opens up security Qs that we'd rather not have. The simpler, the better.
I think yes, at least that should be configure in buildkit, not dagger IMO since we are using buildkit daemon for all our actions
Dagger doesn't download anything that you do not specify, if you already have a buildkit instance running (that's the only thing we download, if you don't have one). When downloading an image, you can just set the URL of the private registry/mirror and it will just download from that source
indeed I was thinking about the build-arg:http_proxy= command line args in buildkit rather than dagger
OK. If we can parameterize the docker registry/imageURL easily, then we can make it work without proxies, too. Our mirroring has extensive retries... ;-)
That's the case, you won't have any problem. I usually test Dagger against my own private registries. Don't hesitate to ask for help anytime on the #help channel 😇
Ack. :-)
I'm running Mage (go based Make alternative) for a lot of automation steps in my pipelines.
Is there a simple example of invoking a binary like Mage instead of wrapping in bash scripts so I could play around with this?
Ie mage pulumi:preview app dev currently is invoked via bash. If I have mage go binary already installed though, can I just invoke mage?
You can invoke mage directly in a container. You do need to build or download the image for that container first.
So your dagger action must specify 1) how to get mage installed in a container image, 2) how to run mage in that container
Can you please give any small example for this?
hi, is there a way to test a http endpoint and if it fails, fail the action?
also: is there a way to pass arguments to dagger cli that can be used within the cue file?
definitely worth it GO FOR IT
gitops
Would you use it? For what?
hi all! 👋
I'd love to start a discussion around MLOps and similar execution engines (Argo, Airflow, Kubeflow, etc) - anyone interested? Or is there a place to talk about this?
Nice to meet you! The community discussions board would be a great place for this topic - https://github.com/dagger/dagger/discussions
By posting there, it will allow everyone in any timezone to contribute to the conversation. Thanks in advance for posting!
Absolutely! dagger do --with
tyty
Yes, you can run a curl or wget with bash.#Run for example.
@karmic sand I worked on your spectral action today 🙂
oh nice
2 ideas in my mind:
- a dagger UI
- using dagger with a local CI "built in" (thinking about drone as a local powerful and lightweight CI)
I’m here (I worked on the extensions) if you need help just ping me
Hi, I’m trying to follow on the best practices as mentioned in the docs. Is there a cli help for explaining an action? I.e., field docs? The help for action doesn’t display it
What ?! This is great ! How do you use it in the cue file ?
Normally the comment for your action definition should appear in the help message with dagger do YOURACTION —help
Is there any Dagger/CUE way to pin dependencies to a particular version right now?
Hi @candid gyro,
For external dependencies yes, for universe.dagger.io and dagger.io not at the moment, but we are working on it
That sounds like it should be enough for my use-case. I just want to make a shared module X and then use it in module Y, but pin it in Y to a specific version so I can keep working on X without potentially breaking Y. Where in Y would I specify such a constraint?
Perfect: you can retrieve that version with dagger project update url@tag. The tag would represent the version you tagged on your external repo
This doc can help you: https://docs.dagger.io/1239/making-reusable-package
Whilst splitting your plan into several files is a good idea, you will sometimes need to create standalone packages aiming to be reusable and shared. Let's explore how to do that.
Basically, with the dagger project update, you will locally copy a specific version of your package
hellowwww my dear friend :p
--with
Hello, if anyone is open to give feedback after trying Dagger (good or bad!), or have difficulty using it, or just want to discuss about CICD challenges, here is link to schedule time to chat live: https://savvycal.com/samalba/fe5156ba
Let's find a time to meet!
I just went thru a build tool evaluation between Dagger, Earthly, Make+BuildKit. We ended up picking Earthly. The main thing that disqualified Dagger for us was that there was no easy way to start services or run interactive command from within Dagger (at least I didn't find one). Other things that worked against Dagger was the steep learning curve (need to learn cue), the documentation can sometime difficult to follow (thing started to make more sense when I started to read the cue code in dagger.io package). The main advantage of Dagger is that it's highly composable which make it easy to write reusable components. Depending on how Dagger and Earthly evolve we might re-evaluate our choice. If you are interested in more details, let me know I can schedule a chat.
Thanks for the feedback, and definitely interested in a chat, especially to dig into the cue learning curve and what we can improve there. Also curious to dig into your use case.
I think dagger autorelease is failed, is it possible to restart ?
I think we'll have to wait for @sharp marsh, I don't have the rights. Thanks for pointing it out 🙏
I have this in the cue file
strings.Replace(strings.toLower(client.env.NAME), " ", "-", -1)
and for some reasons, I get the following error.
cannot call non-function strings.toLower (type _|_):
the name comes from the environment and I want to sanatize before I can use itg
Hello,
Can you put client.env.NAME in a key for which you make sure it is of type string ?
foo: string
foo: client.env.NAME
strings.Replace(strings.toLower(foo), " ", "-", -1)
or with a string interpolation:
foo: "\(client.env.NAME)"
strings.Replace(strings.toLower(foo), " ", "-", -1)
Ah, wait I think declaring it at client.env was enough 🤔
here's how I declare it
dagger.#Plan & {
client: {
// reading the environment variables
env: {
NAME: *" " | string
}
}
but I'll try what you suggested
@boreal tide Ok, I checked: it's strings.ToLower not strings.toLower. Can you please try with your current implementation ? It should work, you're right
I'm screaming rn! .. thank you 🙏
https://cuelang.org/play/?id=WvgD3hslwlj#cue@export@cue. I usually test my Cue with the playground, it brings a fast feedback loop 😇
Awesome, don't hesitate to ping anytime 
yup. The cue-lang isn't as straight forward as I'd imagine.
hmmm I don't have admin on dagger/dagger but I can check 👀
just re-run the GA job and it passed now. Dagger v0.2.11 is on the way 🚀
› I just posted a discussion around CUE and making it easier to understand for our community. If you have suggestions on how we can improve our documentation for CUE, please add it here: https://github.com/dagger/dagger/discussions/2473 Thanks in advance!
Thank you, this helped
What tool do you folks use to format cue files? its been really an issue formatting the cue files
cue fmt does that. But there is a VSCode extension: https://marketplace.visualstudio.com/items?itemName=jallen7usa.vscode-cue-fmt
Ah thanks! I use intellij but I found that cue fmt works
Great to hear. We are working on improving our CUE docs, so any input from the community and yourself will help us know exactly which topics to start with.
For some strange reason - dagger does not recognise an action. Is there a reason is this could happen?
is there a way to throw an error - if a field is missing? I have a case where I have two fields, only one of the fields is optional. How do I enforce it?
I don't have a fallback where both are missing
I'm sorry, not sure to follow 😇
Every field is mandatory unless it is made optional
Before running the plan, it should automatically error
Yeah I understand that but I want to have a case where I have field1 and field2 and I don't want to make both mandatory both of them but only one of them
Oh, either field1 or field2. I see
Yup. This is an issue I always have difficulty in working out. cuelang doesn't really offer anything equivalent
What is the difference between field1 and field2 ?
both represent the samething but in a different format, you could imagine something like : field2 = field1+field3
field3 is mandatory
{
field1: string
foo: field1
} | {
field2: string
foo: field2
}
@boreal tide @swift inlet
I think I saw this notation. so how would I use it?
I have something like this
#method: {
field1: *null | string
field2: *null | string
field3: string
// more 4 fields
_somemethod: lib.#method1 & {
// more stuff here
}
}
#method: {
{
field1: string
} | {
field2: string
}
field3: string
// more 4 fields
_somemethod: lib.#method1 & {
// more stuff here
}
}
The tricky part is how to reference field1 and field2. There are different patterns for this, honestly I don't know which one is best, or if one is officially recommended by the cue community.
Hi from London, just like to try out and see if there are minimal hello world CI/CD examples to fully understand this before planning to migrate existing CI/CD pipeline to here. This CI/CD is managing a dockerized Django app with MongoDB backend. Currently using Devtron so anyone who also used that too would like to share your experience is appreciated.
Hello! There are a few example configurations, but you can check out this "todoapp" sample app with build, test, deploy automated using Dagger: https://github.com/dagger/todoapp
Thanks @winter linden
Why are there:
dagger do build
dagger do deploy
dagger do test etc
why not just
dagger build
dagger deploy
etc
build, deploy, test are not actions defined by dagger. They are defined by you, in your Dagger project. So they can be anything you want
Project-defined actions are scoped in dagger do, to avoid conflicting with dagger's own built-in commands
I see
There is a proposal to combine everything in the top-level, as you describe, but we don't have consensus on it at the moment, because of the naming conflict. In doubt, it's safer to not cross that one-way door
It compliments other CI tools? Currently using Devtron CI/CD so not sure if they are doing the same thing, migrate to here and use both together.
Yes it complements them. Typically you would 1) automate an action or workflow using Dagger, 2) run it locally during development, 3) run it in your existing CI environment.
Assuming Devtron CI/CD has a way to run docker containers, then it's almost certainly possible to run Dagger actions as part of your Devtron setup
After cloning todoapp
@arctic edge I might have just broken that... 😅 sorry.
@arctic edge would you mind running git pull and trying again?
By coincidence we just migrated this todoapp today
@arctic edge could you remove cue.mod/dagger.* ?
note: all dependencies are vendored in that app so you don't actually need to update dependencies to run (as you discovered).
delete:
dagger.mod
dagger.sum
only?
yes, that should fix dagger project update
(I also pushed that fix to the repo just now, plus an update of all dependencies, so feel free to pull that too if you want)
sorry about that
git pull
dagger do build
open build/index.html
still a blank todoapp page? Chrome
file:///$HOME/Documents/dagger/todoapp/build/index.html in chrome is showing blank page?
main branch correct in this todoapp?
yes, main branch is correct. Probably another problem introduced today... Weird I tried dagger do deploy just earlier and it worked fine online (hosted on netlify)
git remote -v
origin https://github.com/dagger/todoapp (fetch)
origin https://github.com/dagger/todoapp (push)
in main branch
dagger 0.2.12 (21a15a84) darwin/amd64
public/index.html also blank page
Weird, dagger itself seems to run just fine, yarn build seems fine too
yarn version v1.22.10
info Current version: 0.1.0
the contents of public/index.html looks like a regular horribly obsfucated html/js file...
@arctic edge do you have a netlify account, to try dagger do deploy?
not yet, sorry did we have to yarn install first
no, dagger runs everything in containers, so you don't need to install anything on your client machine
@arctic edge we have found the issue, it's a tweak of the JS app itself, we'll fix it right away
no, by default dagger will use your DOCKER_HOST to install a buildkit daemon on docker, then everything happens in that buildkit daemon
you can also override that by setting BUILDKIT_HOST directly (for example to connect to a remote buildkit runner)
so instead of pushing to git repo and then start the Devtron CI/CD pipeline on AKS, dagger can tell locally if things are ok when dagger do build? This is for case of say dockerized django app for example
Yes
But usually you still keep your CI/CD steps - dagger helps you run more builds & tests locally, in addition to CI/CD
And it helps you streamline configuration between local automation and CI automation - you can write it once for Dagger, and run it in both environments
@arctic edge if you pull the latest version of todoapp, the "blank page" should be fixed
courtesy of @wraith niche
Some of the use cases appear to be the same (deploy environments on-demand; better automation of integration tests). But there are differences too.
One major difference is that Garden seems to only run on Kubernetes, and advocates for no more local execution of pipelines. By contrast, Dagger can run anywhere (local, kubernetes, CI) and supports both local and remote execution.
local will always be great
yeah that's what I was wondering. Can you show some of the patterns you'd use - the cue community didn't recommend any for this. thank you 🙏
I'm not entirely sure what you need, but have you seen the OneOf (https://cuetorials.com/patterns/fields/#oneof) and switch (https://cuetorials.com/patterns/switch/) patterns?
i guess I am using #OneOf field pattern now. For context : https://discord.com/channels/707636530424053791/978999374858317884
So I know that it's been decided that any kind of DAG visualization is out of scope for Dagger currently. However, I'd like to know how possible writing something like that currently is ? Is there any way to externally observe a dagger execution ? I assume stdout is not enough to properly express dependencies and such ?
DAG Visualizer
Heya are there any good examples of embedding dagger within a go program rather than running it from the cli?
Not at the moment, we don’t have a go API and don’t recommend doing this at the moment. This might change in the future and we’d love to learn more about your use case.
(also if you really want to do it, you can, but if you can use dagger in such a way that you don’t have to do this, you will probably avoid headaches)
Thanks for the quick reply @winter linden!
We currently have a golang Github App that watches repos and builds docker images using Kaniko in Kubernetes. I would like to replace Kaniko with buildkit, and was thinking, what if the app were integrated with Dagger. We could then use Dagger to not only build containers but run pre-defined linters and tests as well.
For this use case would you recommend something like exec.Command to run dagger instead?
I see. Yes you can start with exec.Command as a quick an easy way, and if you run into specific issues we can figure out the best solution together. I’m confident that we can get this use case working well for you.
hey there 👋 ,
just saying hi and starting to play around with dagger
Would it be beneficial to have a GitHub issue or a page somewhere which shows who is using dagger and links to their examples?
Also i guess this is mee being a noob with cue. But are you looking at its usability aspect and current DX? I know its not exactly the problem of dagger but as its the main interface i guess its also important for you?
Like lack of "properly maintained" ide support, language server, etc...
i see your pushing on the package management of cue aswell (https://github.com/cue-lang/cue/issues/851#issuecomment-1119501797)
Yes that is a major focus for us. We are getting more actively involved in both of these things (actively developing them instead of passively waiting for upstream).
i feel like it would be quite a "blocker" for getting any kind of major adoption right now you will end up with a few people knowing the system inside out and then anyone who doesn't have an IDE holding their hand will put their hands up and say "i dont know what this is and i dont know how to write it im not touching my CI config"
which is a shame because so far im really enjoying it
Yes I agree 100%, and glad you are enjoying it 🙂 There are also DX improvements we can make that are specific to Dagger. Hopefully you will enjoy it even more in a few months!
if someone is wondering about some opensource examlpes of how dagger is being used: https://sourcegraph.com/search?q=context:global+dagger.%23Plan+-file:.*cue\.mod/pkg/*+-repo:dagger/dagger+lang:cue+&patternType=literal
Sourcegraph is a web-based code search and navigation tool for dev teams. Search, navigate, and review code. Find answers.
Do you guys by any chance have some presentation that I could use?
IMO the major issue right now for any bigger adoption is the support for proper tooling such as formatter (of course cue fmt works but would expect dagger fmt ) , IDE support (vscode, intellij) , language server and docs and examples. But I see an improvements every day. Also I can not co-relate - actions project and plan to the current cicd solution.
I think i have what i need working, at least enough to present to other people on my team. But yea my main concerns are the same as yours tkcb.
We are currently migrating to github actions (away from drone). So ideally would be the perfect time to consider dagger but im not super sure its ready right now (for those DX reasons).
Im gonna give it a damn good go though 😹
Very helpful feedback thank you, and it validates our current priorities which is encouraging 🙂
-
Vscode extension (and language server) is under development by @swift inlet and @wispy tapir
-
fmtand more generally exposing cue tooling directly indagger: makes sense, it is on the list but we could move up in priority , what other commands did you have in mind? -
docs improvements, more examples -> +1000 we are actively working on that (and always have extra work if anyone wants to make a contribution 🙂
fmt is also going to be part of the language server 😇 at least, the language server + extension shall have it by default
Also something to consider @random hearth : you can use dagger for one action inside your drone/gha workflow, then gradually use it more over time. One way to hedge adoption risk & smooth out the learning curve
yea ill probally be back in here next week asking some more questions once i discussed it with the team>
Do you have any kind of public roadmap with the higest priority things your working on?
Soon 🙂 For now you can look at assigned issues
We’ll add more in the next couple weeks
this is my main reason for looking at dagger. movement between cicd vendors is a pita. Do the same boiler plate stuff twice.
I’m sure we can arrange that 😁 Can you email @slender star at jeremy@dagger.io ? If you can share a little bit about your requirements with him, he can point you in the right direction
Nah, don't wanna waste his time.
In my company we have weekly presentations about cool projects, and it is my turn on Monday, so I thought someone may already have presentation about this project, nvm.
edit:
I think I've found solution to my problems, you guys already have docs in markdown 😄
https://gist.github.com/johnloy/27dd124ad40e210e91c70dd1c24ac8c8
nice! let me know if I can help. It's no bother 😁
so... quick question, when i use docker.#Run to launch a container from an image i just built and i use a mount... it seems to copy the content into the mount location rather than do an actual mount (ie whatever changes i make in the mounted fs inside the container are not persisted) ... is there away to have a real mount?
sorry, looks like i should have posted in #help-old-do-not-post maybe ?
It’s a real mount. Could you share details of your issue?
It’s fine, don’t worry 🙂
so i'm using this... https://gist.github.com/rockyburt/f4c780797d1bd259a7a210a91821e8ca ... the ls command afterwards shows that the .build dir i was expecting exists... but when i check my local filesystem, there is no .build dir
it's my first day with daggio.io so i'm learning as quickly as i can 😉 (and i have no experience with cue syntax)
what i'm planning on doing, is using the image i just built (with makeBuilder) to build all of the wheels for my python project
but if the mount isn't working as i expect... then the generated wheels won't be present unless i copy them back out of the container which i'd like to avoid
Ah, I see what the problem is. You’re thinking of docker CLI volume mounts (docker run -v) which are bidirectional. You need cli.#Run for that, from the package universe.dagger.io/docker/cli
The mounts in docker.#Run are different, they use buildkit mounts which are the same tech that make mounts available in a dockerfile. So it’s one-way (the source of the mount is not modified)
python wheels
I think I have mentioned before with the latest version I get error everytime I update my library.
dagger project update -u
8:54AM INF system | updating all installed packages...
8:54AM ERR system | error installing/updating packages: repo doesn't have any tags matching the required version
dagger project update
9:00AM INF system | installing all packages...
9:00AM ERR system | error installing/updating packages: github.com/xxxx/mylib@0.0.1: checksum didn't match
contents of dagger.mod
github.com/xxxx/mylib 0.0.1
contents of dagger.sum
github.com/xxxx/mylib h1:LoLXEl81GRmsO4NYQ7Rmr3aktV43KPtbhl7qTj3N5sQ=
This issue started with 0.2.10 release I believe, I'm currently on 0.2.12
to be clear: this works the first time when you are adding the packages. When you try to update it again - it fails
do you have an example of using cli.#Run ? not meant as a criticism, but i find docs a bit lacking (i know it's early days)
some repository of tons and tons of snippets for doing everything from the mundane to perhaps more complicated would be highly useful
some repository of tons and tons of
Hi, In what scenario dagger can be used to support or speed up development processes where other CI/CD like Jenkins are already in-place for developers. do anyone had insight on that.
@winter linden
Sure. Dagger can help in 4 ways:
-
same automation available in dev and CI. Instead of maintaining separate scripts. So your cicd pipeline can start before committing and pushing the code
-
less CI lockin. Run the same Dagger actions on top of jenkins or another CI, without rewriting everything
-
easier to test & debug your cicd pipelines locally
-
it’s easier to create more advanced cicd workflows , for example live e2e testing, on-demand staging environments etc
Also 4) it’s easier to create more advanced cicd workflows , for example live e2e testing, on-demand staging environments etc
#3 is really the big one for me. I can't tell you how many "fixing jenkins" commits I have in my stupid repos because I thought, "This change will just be a quick little fix, no need to create a branch where I can squash all my commits" 🤦♂️
same 🙂
Also just started using dagger for docker builds. It's a pretty standard need for every company. You need some list of in house base images, often just using standard base images in docker hub, but they need some small tweak. like adding a corporate self signed cert authority to the ca list. I used it to add the cert authority once to a single folder. then copy that file in with a definition to every image we are building. It also comes with a built in build narrower. If I just want to build all images, I just run dagger do build if I want to build one set of base images I just do dagger do build my-base-image I can even narrow it to a single tag! And it all just comes for free with the way you write dagger builds. I'm very in love with it.
Starting out on my POC -- you guys might already be working on this, but it'd be really helpful to have the list of available actions surfaced a bit more prominently on the site! I had to dig down to https://docs.dagger.io/1202/plan/ before anything linked me to the universe repo
Plan structure
Thanks for the feedback! Good luck on your POC, and please feel free to reach out if you need any help. Our team is actively working on improving documentation, but I created an issue to make sure that we track this specific request - https://github.com/dagger/dagger/issues/2585
Thanks! Erik also reached out earlier. Good to see how active and involved the team is. I'm sure I'll have more questions soon 🙂
how do you properly python dependencies? is there an example somwhere I can lookup
Hi,
What do you mean exactly by that ? 😇
I would use: python.#Image (https://github.com/dagger/dagger/tree/bbfddcbe82f8b19c76af7a3f413e613098ff6c68/pkg/universe.dagger.io/python) as a step in a docker.#Build, and do a pip install in a following step: https://github.com/dagger/dagger/blob/bbfddcbe82f8b19c76af7a3f413e613098ff6c68/pkg/universe.dagger.io/docker/test/build.cue#L14-L28 => You just replace alpine.#Build by python.#Image and in the docker.#Run step, you run the pip install.
This new image would become your base python image that has all the dependencies installed
I am building a (sort of) meta-framework using dagger focusing on developing AI-based solutions (like next is for react). Just got done with the feature of building development containers (going to add actions for labeling, creating web APIs based on a model, generating docs, etc in the future) and I am open-sourcing it.
Thank you dagger team for being so helpful
It has a nice pattern that overcomes https://github.com/dagger/dagger/issues/1466 (lack of nested builds) if anyone wants to check it out. (Probably has some antipatterns too as I am new to CUE lol)
I created a main.cue and imported the github.com/mlkmhd/dagger-maven project in it, but it does not resolve my dependency when I run dagger project update command:
main.cue:
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"github.com/mlkmhd/dagger-maven"
)
dagger.#Plan & {
...
I run this command:
$ dagger project update
but it does not resolve imported dependency and my tree is like this:
$ tree -L 3
.
├── cue.mod
│ ├── module.cue
│ ├── pkg
│ │ ├── dagger.io
│ │ └── universe.dagger.io
│ └── usr
└── main.cue
Am I doing something wrong?
What is a the stage?
Improvised comunity call. Various demos and discussions 🙂
Is migrating from GitLab to Dagger - in terms of CI/CD - a performance plus and or any other benefit?
Technically you would be migrating from Gitlab to "Dagger on Gitlab" 🙂
Yes there can be indirect performance benefits, for example with automatic caching and more granular actions. But it depends on your configuration, it's not always guaranteed to be faster. The main benefits are 1) Parity between CI and dev 2) portability between CIs, 3) local testing/debugging of your CICD setup, 4) easier to create more powerful workflows
👆
Here is something I've been thinking about lately: in our organization (Cisco ET&I) we have a central Jenkins pipeline that most of our teams use.
The benefit of having a central pipeline is we can make sure everyone goes through the same compliance checks, every team submits the necessary reports before releasing a new version, etc. Another benefit is that new teams can start with a ready made CI pipeline easily.
The pipeline is more or less customizable/composable, but the high level steps are dictated by the pipeline.
Dagger would be an interesting addition to this setup, because it would allow way more customization for the development teams which is often desirable, but at the same time would take away some of the control from the team owning the pipeline itself.
So in order for us to integrate Dagger, we would need some sort of validation that the pipeline includes the required steps.
We could obviously run a hybrid pipeline where Dagger is just a part of the whole thing, but it would be nice to move the central pieces to Dagger as well (for the same reason why anyone would use Dagger: build and test locally).
Bottom line: it would be interesting to see how we can validate that a certain plan would complete certain actions (eg. defined in a central repository). One possible solution is evaluating the plan with Cue and doing some sort of validation (or using Cue itself to validate the Dagger plan).
What do you think?
Is this going to be a real issue? Does Dagger have an (unintentional?) decentralization effect?
Org Compliance of Dagger plans on Jenkins
Hey Dagger Community! We just created a tool that gives you the ability to centralize telemetry from your engines and visualize it, which will help you debug faster! Follow our guide here on how to access it: https://docs.dagger.io/1241/dagger-cloud If are still struggling with your run, we have provided an easy way for you to request help from our team through the Dagger Cloud UI too. You can follow the instructions below to learn how to submit your request through the UI: https://docs.dagger.io/1241/dagger-cloud#how-to-submit-a-help-request Note: We'd love feedback, so please reach out to me directly with any feedback that you have on the tool!
Hey Dagger Community We just created a
I wrote a blog post about how Dagger transformed my perspective on development environments: https://twitter.com/sagikazarmark/status/1536122881326866432
https://sagikazarmark.hu/blog/the-perfect-development-environment-2022/
Blogged about my latest thoughts about developer experience and development environments.
I’m a huge fan of Developer Experience and I continuously chase The Perfect Development Environment every day.
Not just for my sake, but to make the development process as painless as possible for my peers.
But after pursuing the dream environment for years, I had to realize it’s a moving target:
technology evolves every day and development proc...
Thanks for sharing!
That was a nice read. It resonated with me on several points.
Thanks!
FYI I opened an issue with VsCode dev-container to make it easier to work with dagger. I mentioned earthly, but should make it easier for dagger too. If you are interested you can go upvote https://github.com/microsoft/vscode-remote-release/issues/6811
Thanks @halcyon island! Makes sense. Upvoted!
Hi Dagger Community! We did a first alpha release of Dagger Cloud last week. The tool gives you the ability to centralize telemetry from your engines and visualize it, which will help you debug faster. Dagger Cloud Docs: [https://docs.dagger.io/1241/dagger-cloud]
Thank you to everyone who has taken the time to try it out and provide feedback. If you have already tried the tool, but haven’t been able to provide feedback, we’d appreciate if you could give us some feedback here: [https://blocklayer.typeform.com/to/wuQLS5Gz]
If you haven’t tried it yet and want to learn more, I’d be happy to walk you through a live demo with myself and one of our engineers. We are looking to meet with users who haven’t had a chance to try it out, so we can gather live feedback on your experience with the UI. If this is interesting to you, please contact me and we can get something scheduled. I look forward to meeting you!
Posting here as I am sure it'll help a lot of people: a new guide is live for the docker package. It covers in details everything you need to know for building Docker images: https://docs.dagger.io/1241/docker - credits to @rain oriole who contributed this page.
The universe.dagger.io module is meant to provide higher level abstractions on top of core actions. Of these, the universe.dagger.io/docker package provides a general base for building and running docker images.
This is a great guide, thanks!
Hey, how do I run dagger actions locally, with the output of commands being streamed to the terminal? In gh actions they show up by default, but not using dagger locally...
Hi Tomas, you can use dagger do --log-format plain
Will try, thanks!
Note that because of caching, there's no guarantee that the command will be executed each time. That's a good thing, since it will make execution faster. But it also means you won't see the output of every command streamed every time.
Here is another post about Dagger:
https://dev.to/sagikazarmark/building-a-ci-pipeline-for-a-go-library-with-dagger-2an7
https://twitter.com/sagikazarmark/status/1539384940856475648
This time it's about building a pipeline for a Go library.
You can find the complete example here: https://github.com/sagikazarmark/dagger-go-library
Let me know what you think!
Originally published at https://sagikazarmark.hu. I've been playing with Dagger for months now...
Blogged about building a CI pipeline for a @golang library with @dagger_io
The complete example is available here: https://t.co/h2YydAMXFn
Has anyone successfully created a jenkins shared library that calls a dagger task? I'm not sure I want to push dagger onto all the devs just yet, but I am getting pretty freaking tired of git, commit, pushing my shared library files only to find out I missed a comma after 5 minutes of running some other build. I would really love a way to expose a shared library as a groovy function, but just have it call a dagger command on the backend.
Hi @frozen spindle 👋 I haven't heard of anyone doing that yet, but it does sound like you'd not be alone in using something like that. How simple could it be and still be useful? Would you package the Dagger CUE files in the Jenkins resource files? Looks like it could be pretty easy to get a proof of concept going 🙂
https://www.jenkins.io/doc/book/pipeline/shared-libraries/#writing-libraries
Yeah so I jumped down that rabbit hole a bit today. And the main issue is that the libraryResource function returns the content of the file instead of the path 🤦 . Maybe there's another way of getting the resources directory that I'm not aware of? If I could do that I'm guessing I could do dagger do --plan=resources/com/company/dagger/dagger.cue or something
Extending with Shared Libraries
Is this issue relevant? https://github.com/dagger/dagger/issues/2165
cc @slender star
GoRepleaser like configuration showcase: (#Push is incompatible)
https://github.com/octohelm/cuemod/blob/main/dagger.cue#L37-L87
actions: go: golang.#Project & {
source: {
path: "."
include: [
"cmd/",
"pkg/",
"go.mod",
"go.sum",
]
}
version: "\(actions.version.output)"
revision: "\(client.env.GIT_SHA)"
goos: ["linux", "darwin"]
goarch: ["amd64", "arm64"]
main: "./cmd/cuem"
ldflags: [
"-s -w",
"-X \(go.module)/pkg/version.Version=\(go.version)",
"-X \(go.module)/pkg/version.Revision=\(go.revision)",
]
env: {
GOPROXY: client.env.GOPROXY
GOPRIVATE: client.env.GOPRIVATE
GOSUMDB: client.env.GOSUMDB
}
build: {
pre: [
"go mod download",
]
}
auths: "ghcr.io": {
username: client.env.GH_USERNAME
secret: client.env.GH_PASSWORD
}
mirror: {
linux: client.env.LINUX_MIRROR
}
ship: {
name: "\(strings.Replace(go.module, "github.com/", "ghcr.io/", -1))/\(go.binary)"
from: "gcr.io/distroless/static-debian11:debug"
}
}
client: filesystem: "build/output": write: contents: actions.go.archive.output
Available Actions:
version
go
go source
go ship
go ship pushx Push all images as multi-arch images
go ship push
go ship push x Merge pushed arch suffix images into mutli-arch image
go ship push amd64 Push <arch> suffix image
go ship push arm64 Push <arch> suffix image
go build Go build binary for special platform
go build linux/amd64
go build linux/arm64
go build darwin/amd64
go build darwin/arm64
go archive Archive all built binaries into local (need to define client: `filesytem: "x": write: contents: actions.go.archive.output`)
i don't suppose there's any docs that describe how the dagger package/module loader works? how it finds modules, installs them, etc
does this help? https://docs.dagger.io/1238/project-file-organization
As time will pass, your Dagger configuration will grow. You will feel the need to better organise your config by splitting it into multiple files.
it's a good start (and i've actually read it a few times to make sure i fully understand things) but i think for me is what comes after this ... ie hosting reusable modules in private and/or public repos as an example
i'm also thinking of versioned namespaces as well... like i know i can reference tags via @ and what not, but i kind of feel like this large reusable set of actions i'm building out atm will ultimately be thrown out in favour of a huge set of v2 versions that are structured very differently since i look back at some of them already and cringe lol
Some of the slated improvements for Package Management here: https://github.com/dagger/dagger/issues/2163
interesting
is there any current dagger project syntax to add a module to my current project that exists simply in some other directory on the filesystem that mimicks a github.com/*** style url ?
or is it simply manual copying and whatnot (i'm currently using a symlink so i can work on the actions in combination)
I've done copying and symlinking too.
do you folks plan on releasing dagger executable images at https://hub.docker.com/r/daggerio/dagger or are you doing it elsewhere ?
I don't think we have any plans for container images with Dagger inside@balmy orbit. Just the binary releases folks can get from GH, Homebrew, Chocolatey, dl.dagger.io, etc.
Are you thinking of your dagger-in-dagger use case?
among other things... the first thing is the fact that locally i wrap dagger funcitonailty with Makefile since that's what our team is familiar wiht (basically using make like you'd use github actions) ... and i was thinking of having Makefile run docker on a dagger image to invoke dagger so that dagger didn't have to be manually installed
I think you could put dagger binary in docker:dind, and run with docker.sock mounts.
Or like me use the the remote buildkit instead. no need docker required.
# .gitlab-ci.yaml
# gitlab runner in k8s cluster
stages:
- ship
ship:
stage: ship
# image use my custom build https://github.com/octohelm/dagger/pkgs/container/dagger
image: ${DAGGER_BUILDER}
script: k8s
# here a global env var BUILDKIT_HOST with tcp address,
# I manually deploy buildkit in k8s cluster
- dagger do x
@here Recently, we did a first alpha release of Dagger Cloud: https://docs.dagger.io/1241/dagger-cloud
The tool gives you the ability to centralize telemetry from your engines and visualize it, which will help you debug faster.
Thank you to everyone who has taken the time to try it out and provide feedback. If you have already tried Dagger Cloud, but haven’t been able to provide feedback, we’d appreciate if you could give us some here: https://blocklayer.typeform.com/to/wuQLS5Gz
If you want to learn more, we’d be happy to walk you through a demo. Just pick a time that works best for you: https://savvycal.com/dagger/cloud-feedback
Howdy, got a little use case that I'm wondering if Dagger would cover without having to adopt too much Dagger (team is hesitant due to the newness, but I think this is a good use case)
- They are still going to want to use Dockerfiles, ideally loaded from disk, but possibly defined as a CUE string
- The context is JS but applies equally well to Go
- They have a multistage dockerfile which builds an app for production, an early layer fetches the deps
- It does not test, the goal is to add this plus SonarCloud scanning, but we don't want to redo the dep fetch, because NPM / node_modules...
- We don't want to add the testing to prod builds, or figure out how to have conditional sections of a Dockerfile (unless that is easy?)
So I'm envisioning something like
dependencyLayer
- stages for building prod
- test with output to tty
- test w/ coverage to file, run Sonar
It's a DAG, and if I have to do it without the (ger) I'm looking at having to use 4 dockerfiles & images, whilst dealing with tags under concurrent builds and passing them in as ARG to the dockerfile
So I guess my question, "is it possible to define the DAG with Dockerfiles while still getting the layer caching?"
I'm not sure how I feel about patterns like this: https://www.dev-diaries.com/social-posts/conditional-logic-in-dockerfile/
One benefit to Dagger I see is that I can run the SonarCloud container against a layer, rather than having to install SonarCloud in every Dockerfile setup, or having to deal with setting up the mounts to the host FS
@stoic knot Happy to try this out with you! 👋 With some Dockerfiles in hand, I'd think we could do something that is a hybrid of https://docs.dagger.io/1205/container-images/#multi-stage-build and https://docs.dagger.io/1205/container-images/#executing-a-dockerfile
You can use Dagger to build container images, either by executing a Dockerfile, or specifying the build steps natively in CUE. Which method to choose depends on the requirements of your project. You can mix and match builds from both methods in the same plan.
Thanks @slender star , I'm going to be prototyping 3 alternatives starting today, including this option
i'm sure this has probably been mentioned before, but i just came across this, and it put my mind at quite a bit more ease as to why using Cue VS JSON or YAML is a good thing, also helps me to stop thinking of Cue as a programming language and just a data/config language - https://bitfieldconsulting.com/golang/cuelang-exciting
i may even start using Cue to validate existing YAML configurations we have developed in-house
so just thinking of Cue as JSON-on-steroids helps 🙂
also helps me to stop thinking of Cue as a programming language and just a data/config language
so just thinking of Cue as JSON-on-steroids helps
Yeah, I generally agree with this sentiment. I think another way of thinking about CUE is as a constraint language.
You can specify the shape of other data. Note that a concrete value is really just a constraint. 🙂
Once I grokked that, it really helped me understand how to use CUE.
hi all i have a question, i'm trying to use Dagger to build Dockerfile. How do I implement buildArgs to take in output from git last commit hash so that the information will be built with the new docker image.
hi all i have a question i m trying to
if i make a param optional (ie myfield?: string) what is the standard way to check if it's defined in Cue ?
if myfield { // blah } ?
foo?: bool //or whatever
...
if foo != _|_ { something: foo
}
yeah i was wondering about that ... but i couldn't google properly to figure out what _|_ was precisely lol
@balmy orbit CUE calls it "bottom", in case you haven't figured it out already. 🙂
with _ being top? i haven't wrapped my head around those two yet lol
Yes! This is a good read, related to all of that: https://cuelang.org/docs/concepts/logic
Bottom is analogous to an error in many other languages. Bottom is an instance of every value and type, in fact. More on errors later.
This is a good high level representation: https://cuelang.org/docs/concepts/logic/#cue-types
are there any support for kubernetes?
For run dagger in k8s:
You could use this to deploy buildkit.
https://github.com/moby/buildkit/blob/master/examples/kubernetes/deployment%2Bservice.privileged.yaml
the certs part could be removed.
Then BUILDKIT_HOST=tcp://buildkitd:1234 dagger do
For k8s apply:
Cue could import and gen definition from go sources.
So you could define your own struct like https://github.com/innoai-tech/runtime/blob/main/cuepkg/kube/app.cue
Then render multiple manifests into yaml or json, and write & mount to image contains kubectl to run kubectl apply.
Is the question about : can we deploy to kubernetes thanks to dagger? If yes, there is a package in universe which is about that: https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/alpha/kubernetes
(can't wait to have a correct reference documentation to point to it :))
Thank you! I will check it out
@balmy orbit I've written up a few ways to get started with CUE without changing your existing code or processes here: https://cuetorials.com/first-steps/
First steps with CUE
Hey, Cuetorials is just amazing and helped me a lot when I was getting started. Kudos to you!
Hey dagger friends. I see that dagger has a solid story when it comes to CI. Y'all have anything re: pipelines? e.g. shuffling between dev, prod and relevant quality gates.
Hello! Are you looking for specific config examples? If you share more details, we can point you to existing config or help you write yours.
I don't see a notion of dev vs prod for deploys etc. Can you point me to configs?
The first guide in the docs shows how to dev locally, then integrate into your CI for that purpose. But they are many patterns quite trivial to implement. For instance, run an app locally for dev, deploy remotely for staging, then change the config for prod. Can also map a git branch to a particular deploy config, that way you can auto deploy changes to staging or prod from your CI, following changes on a particular branch. We are in the process of writing more guides in the docs, if you have a use case in mind, it can inform the next guide. And we can also chat live to show the different patterns.
Just confirming: y'all don't have a notion of a "pipeline", but rather you have a series of steps that would, in combination, be the "how" of a pipeline. Is that right?
Yes: a plan is a serie of actions. Each action is a serie of steps that would indeed define the how of a pipeline
Is there a way to switch the runtime dagger-buildkit uses?
Specifically to nvidia-container-runtime as it would enable gpu access and stop the need to invoke docker/cli instead of docker package
I'm sorry, I'm not sure to fully understand your question, nor to have the knowledge to help you 😇
I've never heard about the nvidia-container-runtime. In general, how do we specify such runtime ?
Buildkit uses runc as the default runtime for executing the instructions provided to it. There is an option —oci-worker-binary that allows switching it to other options such as nvidia-container-runtime or kata-runtime.
nvidia-container-runtime allows running gpu accelerated code in containers, which is extremely useful for machine learning/AI applications
Is this helpful? https://docs.dagger.io/1223/custom-buildkit/
Using a custom buildkit daemon
You can run your own buildkit with those flags and specify it with BUILDKIT_HOST=$addr dagger do actions
Thanks I will try it
Hello all, I wanted to ask a bit about nesting dagger projects... From my understanding of Cue, I think my idea could work, but I want to check in here before I talk to our CTO about the idea. I'll kick off a thread to explain what I mean
Hi again, is there a way to install a Debian package noninteractively? Do I need to create my own cue module for this? Or do I need to set DEBIAN_FRONTEND=noninteractive as ENV in the dagger plan?
There's an universe.dagger.io/alpha/debian/apt you may try out. Particularly apt.#Install, it supports apt-get with DEBIAN_FRONTEND: "noninteractive".
If not exactly what you want you can at least copy into your own and change it.
so... new situation, i have a file that is used to describe vendor deps... that file is frequently re-saved (some third-party process beyond my control) but 95% of the time, the content of the file doesn't change ... so, i'd like my mount and copy operations that act on that file (the file is the lone item in a docker.#Image only when it's checksum has changed
Thank you, I actually found that but since I'm still learning CUE and how to use Dagger, I couldn't quite add that package in right. I ended up using it within bash content as a script but I thought I read on the Dagger that this is not recommended, or maybe I read wrong?
HI i'm a newbie with dagger i'm trying to clone a github repo using this code, but i get the error missing comma in struct literal, also if some one can guide me on cloning using ssh instead of https.
Also what is the/are best resources to learn dagger
package first
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
// "universe.dagger.io/git"
)
dagger.#Plan & {
actions: {
pull: core.#GitPull & {
remote: "https://<Repo_URL>"
ref: "Develop"
auth?: {
username: <username>
password: dagger.#Secret <password>
}
}
}
}
hrm, i need a core.#Source and perhaps other machinery that only indicates files have changed from the source if their checksums changed, not if their lastmod changed
IIRC buildkit only invalidated the cache based on the files checksums. I'm not sure if it's taking into account mod dates or not. @pseudo stream will probably know if / how you could achieve this Rocky
dagger project update github.com/someuser/somedagger is the standard way of third-party packages correct? what if the repo is private ?
Yes, if it's private you need the --private-key-file ~/.ssh/id_rsa argument for fetching over SSH. If you want private HTTPS it's more complicated since you don't want to have the password in the URL itself.
odd, I'm getting x509: decryption password incorrect
i need to provide the key password on the command line? i was hoping it'd use ssh-agent
Unfortunately that's still an open issue: https://github.com/dagger/dagger/issues/2034, but for now, if your private key has a password then you need --private-key-password <password> as well.
You can see these arguments with dagger project update --help.
What's not documented is that right now, using --private-key-file switches the protocol to SSH, otherwise it's HTTPS.
looks like i'm gonna have to setup a separate passwordless id_rsa because i'm not putting my ssh password in plain text in the console 😉
for now it may make more sense simply to manually copy the files to the appropriate cue.mod location
Yes, that makes sense. I was going to take that one on (user agent), but got deprioritized.
IIRC buildkit only invalidated the cache
@vagrant tiger great to see you in Dagger Discord! 👋 As @wraith niche stated, we're very flexible in how we can fold into an existing CI or CD system. The Dagger Plan does have pipeline-like qualities, but can run without conflict inside another pipeline tool. Guessing you saw some of the CI integration tips here? https://docs.dagger.io/1201/ci-environment
As far as CD goes, Dagger could be called from any number of CD tools or could report back to them as well. What do you think would be a good reference CD implementation to flesh out similar to our CI examples?
Once you have Dagger running locally, it's easy to use Dagger with any CI environment (no migration required) to run the same Dagger pipelines. Any CI environment with Docker pre-installed works with Dagger out of the box.
I can see how dagger can be built to align to each step of a pipeline, but it's not actually doing the scheduling/orchestration like a tekton would. I have an idea that I've had kicking around in my head and I thought dagger might be the solution, but it seems like it's only part of the solution. 😉
hello everyone, i was wondering, is it advisable to commit cue.mod directory. or how do you all do it
For now, vendoring is even the best way to do it, until we create some kind of module/package management/versioning system
please what do you mean by vendoring?
https://stackoverflow.com/a/39643873
Basically, you keep your dependencies inside of your project repository
Like, if you would commit your node_modules directory in your project repository.
So, yes, commiting your cue.mod dir in your project directory is vendoring it.
anyone have an example github actions workflow that runs dagger via arm64 arch ?
Hi folks! Good to be here ^^ I am just getting started with Dagger and hope to get valuable insights and answers to some of my questions here 🙂
anyone have an example github actions
👋 welcome onboard Daniel! looking forward in helping out to make your Dagger experience great! Friendly FYI is to keep in mind about sharing your dagger cloud URL (https://docs.dagger.io/1241/dagger-cloud/) so we can assist you better when testing your actions 🚀
Dagger Cloud is under development, but we have just released the first telemetry feature!
Question regarding running Dagger with a remote BuildKit...
- does the "docker build" happen on the remote or use the local docker daemon?
- does the "COPY" need to transfer files over the network (outside of layer transfers)
Wonder what the story to scale out build executors looks like. We have a bunch of hefty workers to support our builds, would those resources need to move to BuildKit?
Or is BuildKit acting more like a shared cache and registry
Question regarding running Dagger with a
Here is another post (and example) about Dagger: Go CLI app
https://dev.to/sagikazarmark/building-a-ci-pipeline-for-a-go-cli-application-with-dagger-1ik5
https://twitter.com/sagikazarmark/status/1544966457397846017
Example app: https://github.com/sagikazarmark/dagger-go-cli/
Let me know what you think!
Originally published at https://sagikazarmark.hu. In my previous post I explained the basic steps...
Blogged about building a CI pipeline for a @golang
CLI app with @dagger_io
The complete example is available here:
https://t.co/sREslJUZyF
Is it possible to run docker containers with Dagger for things like integration tests? For example, run a MySQL container next to the test container and kill it once it's not needed anymore (ie. the test finished).
Hello, Totally. The way to do it is to rely on the docker daemon (https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/docker/cli/client.cue).
Basically, you run the image inside the docker daemon using our cli package, then your action will be able to query it. You will also be able to stop it with the cli package again
Thanks!
Does that mean I have to manually start the containers before running my tests?
For example:
dagger do setup
dagger do test
dagger do teardown
Or can I somehow hook into the test action to start the containers at the beginning and stop them at the end?
That's what we did for particubes: https://github.com/dagger/dagger/blob/main/docs/tests/use-cases/go-docker-swarm/full/particubes.docs.cue#L93-L129
This doc would be a very good example. Basically, we chained everything inside the test action -> It spins up the test, tests it and tears it down, all in one action
Awesome, thanks!
We have a feature for that (core.#Start) but it's very bare bones right now and needs several follow-ups and enhancements (https://github.com/dagger/dagger/issues/2398).
My first successful CI build of RawkodeAcademy with Dagger 😄
https://github.com/RawkodeAcademy/RawkodeAcademy/actions/runs/2644140530
Hey guys. I absolutely love the work the dagger team is doing!! Great work.
I made a video on Dagger based on my understanding. Do let me know if I've missed something out. Would love to make more content with you guys.
Can Dagger change the way we write CI/CD Pipelines?
CI/CD Pipelines have become an essential part of our software development lifecycle. While they make releasing reliable software a lot easier, they add a a degree of complexity and introduce a bit of a learning curve for development teams.
Dagger aims to solve much of these challenges by stan...
That's great, thanks! 🙂
Small correction though, Dagger doesn't require Docker. The only dependency is BuildKit. It's simple to get started if you have Docker installed, but you can have BuildKit running in K8S or other environments, in which case Dagger should run just fine in any of those (https://github.com/moby/buildkit#containerizing-buildkit, https://docs.dagger.io/1223/custom-buildkit/).
I also don't agree that dagger is more appropriate for platform builders as of now. Many users use if it for their own apps, me included. 🙂
Oh. Okay. I'll put out some form of correction on that soon
Not quite sure if here or #help-old-do-not-post is a better place to ask, but – our current image building pipeline uses a git log of files that go into the build context to decide what the image tag will be. Would it be possible to do the same from inside Dagger?
You can basically do anything in Dagger, so if you currently have a shell script that implements your logic, you can use it within Dagger
But how would the script know what file went into the build? I see there's something called FS – would I for example had to build my Docker build context using FS and then use that both for building the image and knowing what files to look at with git log?
@sharp oracle Guessing you're doing something like in https://blog.scottlowe.org/2017/11/08/how-tag-docker-images-git-commit-information/
Yes, it's easy for Dagger to read in a filesystem tree (dagger.#FS) from your local filesystem (core.#Source) or pull from a git server (git.#Pull) and then build the image from Dagger commands or a Dockerfile (docker.#Dockerfile).
Then you can run a command against that same filesystem in bash (bash#Run): e.g. git log -1 --format=%h, then use that output to form up a tag string and then push the image your build to a registry (docker.#Push).
Thanks for the video! I had some great laughs at the intro 🙂 I'd love to highlight it in the community section of the July newsletter once those smaller corrections that @rain oriole mentioned are noted.
Will add them in the description and pinned comment.
Great, thanks!
jaen0732 Guessing you re doing something
Done. Hope that works
@here 👋 Dagger Community. We'd like to share with you some really cool features that we shipped last week that you can start using today starting with dagger version 0.2.23 on-wards:
- Dagger Cloud (https://docs.dagger.io/1241/dagger-cloud/) will now upload plans that are not fully dagger compliant. This will allow you to share with us your Dagger Cloud URL so we can assist you better to unblock you.
- Dagger Cloud now displays the time actions took to execute
dagger doccommand now supports markdown formatting with bothlightanddarkthemes.
Hope this new features help you navigate dagger better while allowing us to provider better assistance. If you have any suggestions or comments, please send them here or through issues in the dagger/dagger GitHub repo.
You can get the latest dagger binaries here: https://github.com/dagger/dagger/releases/tag/v0.2.23.
Dagger Cloud is under development, but we have just released the first telemetry feature!
@vestal creek just confirmed that you don't need the path in module. You may have seen in the spec that you need it on import, but that's different. 🙂
What do you mean by this?
Something from #911305510882513037. I said you don't need a path in module: "domain.tld/path".
Gotcha. You can have just the domain?
Yes
This always throws cannot compile code: cannot find package regardless of what package I reference. Should this find packages in the usual cue.mod folder?
dagger doc universe.dagger.io/docker. It needs to include the url of the package
cannot compile code: cannot find package "dagger.io/dagger"
cannot compile code: cannot find package "universe.dagger.io/docker"
dagger 0.2.23 (2927c7787) windows/amd64
I have worked on a helm.#Upgrade action. I feel like it's more complete than the helm action in alpha. Therefore, I would like to make a PR, is there a specific process to do so? I have read the guide https://docs.dagger.io/1227/contributing, but I am not quite sure.
Hi @swift barn, It's awesome 
Exactly. I haven't followed the last changes, but, from what I see from the previous commits, you should directly update it in the dagger/pkg/universe.dagger.io/alpha/
should I open an issue first?
Yes, it's always better. Nothing too complex: mainly why you needed to create this new version
ok, thanks. Will open an issue then in a bit.
I have opened this issue https://github.com/dagger/dagger/issues/2806
Perfect 😇 
what is the advantage of client.filesystem vs core.#Source?. The only thing I can think of is that client.filesytem can go outside of the package root.
client.filesystem follows your current working directory on the client host machine. Different behavior, depends on what you want
In practice core.#Source is usually better IMO
I also think core.#Source has some advantages. One of them is that you can have it outside of dagger.#Plan. I think its not quite clear from the documenatation, that source may be the preferred way in most cases.
I want to mount a directory but its content is secret. Seeing that dagger.#Secret only works on files, I am wondering what are the implication of using dagger.#FS. Is the content cached, or even sent via telemetry?
It is not sent via telemetry. A mounted #FS is accessible only during the scope of the action being executed. I believe it is cached though, and the implications would be the same as when you mount a directory in Docker.
Secrets are a special type for which the content of the file is never printed in the logs: you will have *******. By mounting as #FS, the cat of one of the given file will output its content, it will not be the case for a file mounted as a secret
that should be good enough. thanks 🙂
Only downsides are 1) contents will be in buildkit cache, 2) contents are mounted in container slightly less securely
- no log scrubbing as mentioned by @swift inlet
Hey! The differences are explained in https://docs.dagger.io/1240/core-source
Just starting to pick up and play with Dagger. Coming from a Jenkins / Pipeline as Code / shared library background.
I'm curious how "universal" or "broad" the Dagger Universe packages really are or do most individuals/teams build from the ground up? I'm following the todoapp example and can't get too far since we're using an internal NPM registry.
Not seeing how to extend the yarn universe package to do something like this (i.e. run create a new action that uses bash to run yarn config set registry xyz.com and have the yarn .#Script "depend" on that new action as it doesn't accept a env or input property as shown in the chaining actions docs)
Yarn package extension
@tacit birch Where in Oregon?
I5 south just before hitting the 217 merge
@slender star, perhaps? 🙂
Going to experiment with Dagger & Doppler 😀
Install the Doppler CLI in local development and production environments.
Turns out, this is totally awesome
Demo in morning. It’s nearly 1am 😊
I'm sorry, I'm just looking at the guy on the video and admiring his room setup, with the 2 guitars background.
What is he talking about? 😆
@harsh ore Dagger and waypoint? They're not mutually exclusive tools. As you probably know Waypoint has build stanzas (https://www.waypointproject.io/docs/lifecycle/build) where you can leverage on Dagger to take the most advantage where it shines which is the ecosystem and CI capabilities. Even though they overlap in some features, they tackle and excel on solving different problems