Repository navigation
Description
This has been resolved with Dagger Functions. Thank you all for your help!
Problem
TLDR: Dagger does not define a standard interface for project entrypoints, which limits what it can do for users.
Dagger works by writing an entrypoint for your project: custom software that defines the pipelines for that project, and how to run them.
graph LR;
subgraph program["Project entrypoint"]
lib["Dagger SDK"]
end
engine["Dagger Engine"]
subgraph A["Project build pipeline"]
A1[" "] -.-> A2[" "] -.-> A3[" "]
end
subgraph B["Project test pipeline"]
B1[" "] -.-> B2[" "] -.-> B3[" "] -.-> B4[" "]
end
subgraph C["Project deploy pipeline"]
C1[" "] -.-> C2[" "] -.-> C3[" "] -.-> C4[" "]
end
lib -..-> engine -..-> A1 & B1 & C1
The problem is that Dagger does not define a standard interface that a project entrypoint must implement. This causes several problems:
- Friction. Each project author must do the work of defining an interface, with minimal guidance. For first-time users especially, this can lead to confusion and uncertainty.
- Fragmentation. In the absence of a standardized interface, each project has its own unique snwowflake of an interface. As a result, the benefits of a unified Dagger ecosystem (reusable code, tooling and skills) does not extend to tooling. Notably, it becomes impossible to create CI or developer productivity tooling that can works out of the box with any Dagger projects. Instead, custom tooling must be developed for each project: an artificial limitation since the underlying pipelines are fully reusable!
graph LR;
operator
subgraph toolingEcosystem["Fragmented tooling ecosystem 😢"]
tool1["Project-specific tool"]
tool2["Project-specific tool"]
tool3["Project-specific tool"]
end
interface1["Project-specific entrypoint interface"]
interface2["Project-specific entrypoint interface"]
interface3["Project-specific entrypoint interface"]
entrypoint1["Project entrypoint"]
entrypoint2["Project entrypoint"]
entrypoint3["Project entrypoint"]
subgraph pipelineEcosystem["Unified pipeline ecosystem 🥳"]
A1[" "]
A2[" "]
A3[" "]
A4[" "]
B1[" "]
B2[" "]
B3[" "]
B4[" "]
C1[" "]
C2[" "]
C3[" "]
C4[" "]
D1[" "]
D2[" "]
D3[" "]
D4[" "]
E1[" "]
E2[" "]
E3[" "]
E4[" "]
A1 -.-> A2 -.-> D3
B1 -.-> B2 -.-> B3 -.-> B4
C1 -.-> C2 -.-> D3 -.-> C4
D1 -.-> D2 -.-> D3 -.-> D4 & E4
E1 -.-> E2 -.-> D4
end
operator -.-> tool1 & tool2 & tool3
tool1 -.-> interface1 -.-> entrypoint1 -.-> A1 & B1
tool2 -.-> interface2 -.-> entrypoint2 -.-> C1 & D1
tool3 -.-> interface3 -.-> entrypoint3 -.-> E1
Examples of features that would be unlocked by a standardized entrypoint interface:
- Manage multiple Dagger projects in the same monorepo, without interference
- Custom CI tooling that can run any dagger pipeline from any project, with custom triggers and events
- A simple CLI interface to run any pipeline in any project. We could use this to bring back
dagger do - Optimizations to skip pipelines that don't need to be run - see Create example pipeline with conditionals on git changes #4449
These are basic features of existing CI/CD systems. Until the Dagger ecosystem can offer equivalent features and make them work on all Dagger projects, we will be stuck using legacy CI systems as a crutch.
This makes it more difficult to appreciate the more advanced features which set it apart from other CI/CD platforms. In fact, user feedback so far indicates that even the most motivated power users cannot fully replace their legacy CI platform with Dagger, even if they are committed to doing so.
Solution
Define a standard interface for project entrypoints; implement it in official tooling to demonstrate its value; encourage implementation by third-party tooling; and make sure to make it optional, so that early adopters who have already defined their own interface out of necessity, are not left behind.
graph LR;
operator
subgraph toolingEcosystem["Unified tooling ecosystem 🥳"]
tool1["Universal tool"]
tool2["Universal tool"]
tool3["Universal tool"]
end
interface["Standard entrypoint interface"]
entrypoint1["Project entrypoint"]
entrypoint2["Project entrypoint"]
entrypoint3["Project entrypoint"]
subgraph pipelineEcosystem["Unified pipeline ecosystem 🥳"]
A1[" "]
A2[" "]
A3[" "]
A4[" "]
B1[" "]
B2[" "]
B3[" "]
B4[" "]
C1[" "]
C2[" "]
C3[" "]
C4[" "]
D1[" "]
D2[" "]
D3[" "]
D4[" "]
E1[" "]
E2[" "]
E3[" "]
E4[" "]
A1 -.-> A2 -.-> D3
B1 -.-> B2 -.-> B3 -.-> B4
C1 -.-> C2 -.-> D3 -.-> C4
D1 -.-> D2 -.-> D3 -.-> D4 & E4
E1 -.-> E2 -.-> D4
end
operator -.-> tool1 & tool2 & tool3 -.-> interface -.-> entrypoint1 & entrypoint2 & entrypoint3
entrypoint1 -.-> A1 & B1
entrypoint2 -.-> C1 & D1
entrypoint3 -.-> E1
Traditional CI/CD platforms implement these features in roughly the same way:
- A concept of "project", "workspace" or equivalent
- A platform-specific declarative configuration, encoded in a language such as JSON or YAML, saved at a project-specific path
This should be our starting point with Dagger
Design
Design for this is TBD. Please submit your ideas snd proposals below,. At this stage, crazy ideas and bikeshedding is encouraged :)
Other tools
Below are examples of how other tools define entrypoints.
| Tool | Entrypoint file | Outer object | Inner objects |
|---|---|---|---|
docker |
Dockerfile |
Build context | targets |
docker-compose |
docker-compose.yaml |
project | services, networks, volumes |
make |
Makefile |
? | Rules |
bazel |
WORKSPACE and/or BUILD |
workspace and/or package | targets, which are either files or rules |
| GIthub Actions | .github/workflows |
repository | workflows, events, jobs |
| Circle CI | .circle/config |
||
| Gitlab CI | .gitlab-ci.yml |
||
| Ninja Build | build.ninja |
- | targets |
| Tup | Tupfile |
||
| Redo | *.do |
- | rules |
Activity
sagikazarmark commentedon Jan 19, 2023
What makes this problem really hard to solve IMO is that the entrypoint to running those pipelines is not actually Dagger.
Dagger provides the mid-level SDKs (on top of the low-level GraphQL layer) and people end up building their own entrypoints and pipelines based on those.
(Yes, pipelines as well (ie. Dagger is oblivious to running multiple containers in a sequence, it doesn't recognize the pipeline as a higher level construct).)
That's both powerful and limits Dagger's capability to understand how pipelines are built.
One crazy idea I had before is asking people to implement a "dummy mode" in their pipelines that allows injecting a noop Client into all call paths discovering the potential different pipelines and the sequence of container executions within.
controlpl4n3 commentedon Jan 19, 2023
@sagikazarmark
OK, now about another crazy idea? ...
Would it be useful to have folks describe their pipelines in a structured format like
yamland then use something like pypyr.io to pre-process the piipeline and pass data (like an abstract syntax tree) to dagger ?FWIW, the guy behind pypyr is really smart and interested in use cases like this.
Edit: or, as @cpdeethree suggests, a dag oriented approach: https://dagster.io/blog/introducing-dagster ?
c-p-b commentedon Jan 19, 2023
Personally, if going the declarative route, I really like the idea of literally using a dag to do this: Here's a guy who did a POC of similar: https://github.com/samsquire/mazzle-starter https://github.com/samsquire/mazzle
Feels like it would be quite on brand for this project
c-p-b commentedon Jan 19, 2023
Some further feedback/ideas based on how I've implemented dagger so far in my production level use cases. Mostly inspired by Github Actions
robertu94 commentedon Jan 20, 2023
A few comments. tl;dr I'm not sure that I fully "see the thread" here. That may be because I don't understand certain key words in context.
For example, take the 4 identified missing features:
I don't know what you mean here configured to use that platform. What are we trying to detect exactly?
This one I think I see the story for. Discovering the list pipelines is important (for example to show pass/fail status) in a ui.
Depending on the granularity of this, this could be extremely complex. At one extreme this would need to implement something like bazel's knowledge of the relationship between built artifacts, source files, and unit tests so only a minimum number of tests needs to get run. While awesome, this is probably out of scope for dagger's core. A user could implement this if they could export such a list from their build system -- ninja and bazel provide tools for that, but I don't see it as Dagger's responsibility to do that but for me.
What I am looking for from Dagger is to give me at a minimum an API which returns a python dict/json object of "CI" specific change events that triggers this run of dagger (ie a GitHub PR event may have different fields than a gitlab one), and eventually ideally a thin abstraction that handles the common cases (PR, new commit, human action, timer event, there could be others) consistently (with a subobject/dict containing the CI runner specifics) of events so I as the programmer can implement some basic things without knowing the full details of each.
At the other extreme (and more reasonable) is some finer grain controls (I.e. we can reuse layers that run 'dnf install' within a calendar day unless there a specific manual override, because the user told use we could) around buildkit cache invalidation. This also is useful, but doesn't require deep knowledge of the build systems of say C++ which could be a nightmare.
I see the use case here if you want (and I expect you do want to eventually have) a hosted service offering. What is more important to me is if there is a an easy way to export this status to whatever channels (slack, GitHub UI, GitLab UI) I already look at for failures, and once I see a failure, I want to see the failure logs and artifacts. A web ui is less important to me (I could be convinced otherwise if it was truly awesome)
--
Lastly I wanted to respond to these two remarks
I think should be as absolutely minimal as possible. A huge reason I love dagger is that it's not YAML or JSON. One approach to have consistent paths and allow the different SDKs could be to leverage something like "shebangs" (the
#!/usr/bin/env pythonlines at the top of files), and just require the file be named something like Daggerfile.This is me. But for me the key bottlenecks:
Keep up the great work.
shykes commentedon Jan 20, 2023
@cpdeethree thanks for the details. Could you share an example of your
ci.py? Do you use this pattern in more than one repository, and if so do you have duplication of code between your differentci.pyfiles?shykes commentedon Jan 21, 2023
That's probably my fault for wording it in a vague and confusing way 😄
I simply meant that, for example, Github Actions can look for
.github/workflows; CircleCI can look for.circleci; but Dagger doesn't have an equivalent entrypoint for its configuration.Obviously this is not very useful on its own - perhaps this point is too granular and can simply be rolled into the next one .
Dagger actually handles this transparently :) As you construct your pipelines with the Dagger API, you are implicitly constructing a DAG which Dagger uses to infer which operations need to be executed, and which can be retrieved from cache. Typically the granularity is coarser than Bazel, because a typical Dagger pipeline operates on directories (possibly refined by exclude/include patterns), whereas Bazel operates on individual files. Dagger does support file-level granularity, though, so in theory you could reimplement a Bazel-like tool on top of the Dagger engine. Possibly even more powerful, since unlike Bazel, Dagger supports adding nodes to the DAG dynamically, so tooling like "gazelle" would become redundant.
What I'm picturing as a "change hook" would be extremely simple: something like the
allrule in a Makefile: basically a default entrypoint that is known, by convention, to be OK to run every time you make a change. And even multiple times in between changes, without ill side effects ie; idempotent.This sounds like a hook system, correct? A way for the project's author to specify which pipelines to run when?
I'm sure I understand this part. Could you give examples of what you mean?
We do indeed plan on shipping an awesome web UI :) But separately from that, there is currently no standardized way to discover and run a project's Dagger pipelines from the command-line. I can checkout a random open-source project, and run
docker build,docker-compose up,vagrant up, etc. If the project has been configured to use that tool, something will happen. We used to have that feature in Dagger 0.2 (dagger do), but lost it in 0.3. I am observing that many users are confused by that regression, and would love for us to solve it. I think we can do it in a way that doesn't break our programming model (which is extremely powerful and has no equivalent today). I think we can make Dagger both programmable and familiar and approachable from the command-line.I completely agree. This file should be complementary to the Dagger API. The goal is not to replace your pipeline code with inferior JSON and YAML, but to make it easier to find and run from the command-line and third-party tools.
I would be interested in learning more about this idea :)
May I ask what are the most important events for you to handle?
I would love to have Windows and MacOS support... I think we will get there, but not in the short term, for the reasons you describe. Unless of course you find an acceptable way to run windows or macos in a Linux container :) Possibly using some of the recent bridges between containers and VMs; or perhaps projects such as Docker-OSX could help?
Could you share more details on this one? We may be able to solve these quickly. I would need more details to be sure.
We are working on both of these :)
For secrets: may I ask which tools or services you use to store them, that Dagger would need to integrate with?
For cache persistence: what do you currently use, and what are your requirements for any new solution?
More on the way :)
Thank you very much, this is all extremely useful.
robertu94 commentedon Jan 21, 2023
Thanks for the detailed response. I think I understand your goal more.
I'm going to respond out of order to a few things to group some related things:
Got it!
Let me explain my
shebangidea then. As you likely know, on Linux/Unix platforms, if a file begins with a sequence like this#!/usr/bin/env pythonthe system know that the script is a python script, and will launch the file using the python interpreter. You can do a similar thing withnode. For Go and Rust, this is of course optional, a compiled binary can be used instead, but there are also things likego runandcargo-scriptthat do similar things.The idea was that the entry point of the project would be any file with the name that matches the regex
^Daggerfile(\..+)?$in the root of the repoHere is an issue that happens with Docker some times. Suppose that you have a docker file like this:
Now layers 1, 2, and 3 are built and the image gets created. Some time later, the code in
./myprojectis changed. However what happened behind our backs is that boost-devel went from version X to version Y, and suppose that myproject no longer builds with version Y. However, only layer 3 is invalidated, and we build with the cached layer 2 which still has version X so we don't know that our build is now broken. Being able to say that layer 2 needs to expire say every week allows us to catch these failures without invalidating the entire docker cache with--no-cachewhich is a really blunt instrument, and invalidates more than we need.It would be cool if dagger gave us a middle ground.
For me, I imagine the same things as most folks: PR is updated, new commit was added, user manually requested something be re-run, a "release" was tagged (via a new or changed
git tag), and nightly builds.Compiling C++ is complicated -- dependency relationships can be implicit and cannot fully be determined without a C++ parser, and involve multiple stages that need to be executed in parallel and distributed to multiple workers with effective caching painfully slow for large projects. Doing it without something like
CMake,Meson, orBazelwould be a nightmare. I really don't want to re-invent that in Dagger.I do take your point that is is possible though
worth thinking about. I'll give this more thought.
In both cases, I use what the platform (GitHub (personal), Jenkins, and GitLab (work)) provides for these. Each of these have a native API for both caching and secrets. I need the variety of platforms because I have to go with what each HPC platform supports. I should probably find a more portable solution, but I haven't yet. For secrets, I've used
ansible-vaultbefore and liked it, but I think all of these need something from the platform to bootstrap them, and I don't have that many secrets to keep. For caching, I have copied certain artifacts to remote storage using NFS or SCP, but this takes more effort and isn't worth it unless the thing to store is really large.robertu94 commentedon Jan 21, 2023
Ah, I forgot one:
#4301
This is what I meant by cache types were added.
[-]Project entrypoints[/-][+]Project entrypoint[/+]shykes commentedon Jan 21, 2023
Ah, I understand! I believe this can be solved in powerful ways on top of the primitives already available in the Dagger API.
To invalidate cache at a given interval, you can use the "rounded cachebuster trick". Get the current time; round it down to the desired interval (in your case, say 00:00:00 on the monday of the current week); inject the resulting value as an environment variable or file mount of the desired container. And voila!
But why stop there? Since your cache invalidation is just regular code, you could simply have your pipeline check for the latest released version of the boost-devel package, and use that value as a cache buster. Or, if you trust the boost-devel developers to respect semver, round it down to the major version so that cache is only invalidated on major releases. You get the idea. You are now fully in control of your own caching strategy.
This all works in Dagger today. I'm sure we could (and eventually will) add some polish, for example we could add a
cacheKeysargument, to abstract away the injection of environment variables or files (we would probably do that anyway under the hood, but you wouldn't have to know 😛 ).Note: I find this topic very interesting, and hope I'm being helpful. But I don't understand how this relates to project entrypoints 😄
How would you feel if Dagger limited itself to defining available pipelines (similar to how, say a Makefile limits itself to defining rules), and it would be the CI service's job to map events to pipelines?
It's been fashionable lately for CI-specific configuration to leak into the contents of the git repository, but that doesn't necessarily mean it's a good design. It always felt like a weird abstraction leak to me.
I am fully aware of the domain-specific complexity of a good C++ builder, and I want to reassure you that we have no intention of re-inventing that wheel in Dagger 😄 That said, I believe Dagger provides a set of primitives that will in the future make it 10x easier to create a Bazel or Meson competitor. This could help fuel much-needed competition on developer experience and ergonomics. Right now the core execution engine is just too much engineering work to be worth it for most toolmakers.
Very useful, thanks.
robertu94 commentedon Jan 21, 2023
Your solutions to the caching problem are inspiring! I brought cache invalidation up in response to this:
My point with the
dnfexample was that not all changes are observable from inside the repo and trackable via git 😞 , and may require invalidating part of the cache to detect. However, your solutions address this very cleanly.That is certainly an approach, and one that I would respect. It is really important to limit scope creep, and do what you do best and leave the rest to others.
However, I don't really like writing trigging code in YAML on each platform either 😏 : so part of me thinks something thin that encodes events for at least the common cases so I can handle them in a proper programming language is useful.
But for example in GitHub CI, don't I then need to cache the Dagger cache and reload it? I'm in total agreement that Dagger's cache is better, but I think it would be valuable to encode that saving and loading for the "platform" (i.e. gitlab, github, etc...) cache into a reuseable block to integrate with each platforms's native features.
c-p-b commentedon Jan 22, 2023
Sure.
Here's a simple workflow that calls "terraform" action multiple times to bootstrap a management project in GCP. This pattern passes terraform outputs between images for modules that depend on each other. For example, bootstrap module outputs a project id which is stored as JSON. That project ID is used as input for kms and artifactrepository
Here's a complex workflow in a different repository that builds a nextjs app frontend, spins up a clean, fresh supabase instance with docker-compose, runs e2e tests against that instance, then optionally deploys it to cloud run
No duplication of code between ci.py files.It's intended to be analogous to a github workflow yml. In both cases "actions" can be part of some shared repository (or in a single repository and shared between workflows, I have other terraform workflows that use the same "terraform.py" action and "images" has application/infra specific stuff. Actions can also call other actions that just serve as utility functions. For example I have "credentials.py" that is called only by actions and serves to load GCP/AWS credentials if other actions need those to authenticate:
By specific design, we instantiate the dagger client in the ci.py, so we purposefully don't allow ci.py files to call each other (multiple dagger clients). All "actions" and "images" functions have to take the dagger client as an argument.
This is in contrast to the github actions workflow design, where workflows can call other workflows. I've found in my org that makes heavy, heavy use of github actions right now that allowing workflows to call each other confuses people on whether they should be making "actions" or "workflows" when they want to do something reusable. In this approach, you HAVE to use actions if you want to make something reusable so that it's clear what the role of /actions, /images and workflow defintions are.
So the three distinct roles that I have in this setup is
Currently my github actions ci.yml that is the entrypoint works exactly like you guys do in github.com/dagger/dagger. I just load environment variables, install python, install poetry dependencies, and then
poetry run python .pipelines/ci.pyshykes commentedon Jan 25, 2023
I like this idea :) Now that we have
Pipeline(), there is actually a way for Dagger to "understand how pipelines are built".cc @vito @sipsma @aluzzardi
controlpl4n3 commentedon Jan 25, 2023
So much good stuff here, it seems a waste to keep it buried in a GitHub thread
8 remaining items
marcosnils commentedon Feb 6, 2023
Is it there a best practice in general? I mean.. I could argue that the same thing happens from
Makefiles. Even though they have been used for ages, I'm not sure if you'll find a consensus on what's a "best practice" to use them.The way I think about it, generally "best practices" arise from either:
Even though we do have some "best practices" in regards to some aspects of Dagger pipelines like
excludes,caching,parallelization... etc, regarding entrypoints, I'm not aware about a specific pattern or recommendation emerging. Probably that's mostly the reason why the quickstart entrypoint didn't raise a particular warning to me.Having said that, it'd be great to have a "good practice" around this. How can we help @shykes to move this forward?
c-p-b commentedon Feb 7, 2023
To @marcosnils point, I think a somewhat opinionated approach is going to be necessary here, since there really isn't one single best way. My personal design thoughts were informed by the major pain points I see managing the GHA pipelines for a 75-ish member engineering org, namely:
I see two kind of major themes that have surfaced from the thread - one can take either a more rigid declarative approach like existing CI systems use that uses YAML or JSON to define workflows or one could lean fully into the pipelines-as-code approach and delegate that work to code but with some existing patterns, API's and best practices to hold the developer's hand and give them the building blocks and tools necessary to do things the "right" way.
This gives a lot of freedom at the expense of less structure than the yaml/json/whatever approach. It would still be less freedom than what end users have currently, and also pave the way for an abstraction over common tasks existing runners like Gitlab or Jenkins or Github Actions - you could have the API abstract away, for instance, spawning a runner with a Pipeline.spawn_runner() function that would call the appropriate method depending whether you are running it in GHA or Gitlab or Jenkins. End users get an opinionated way to do things using Dagger API, but also an escape hatch to do whatever they want if they need to. The "carrot" approach is that end users prefer using the Dagger API to do stuff like that because it's simply easier and works and is portable across pipelines and there's some sweet visualization that shows exactly what is happening.
Of course, if the visualization tools are powerful enough, it doesn't really matter whether the entrypoint is single file or allowed to be spread out over multiple files - but you need the tooling to be there to do that. Which is one of my main gripes with GHA: the tooling to visualize all this behavior is just not great. Plus, if you went single entrypoint file vs multiple, there's always the escape hatch that you could later go to using multiple entrypoints if you really needed to. No such escape hatch to go the other direction.
All in all, my preference is really to lean towards "Give developers the right API to construct this DAG behavior dynamically and the right tools to visualize what exactly they are doing" rather than the more-limiting "Let's have some static files that dictate some of this behavior and hope that we don't fall into some of the same pitfalls other ci systems before us have done".
marcosnils commentedon Feb 7, 2023
💯 you've synthesized my thoughts in a detailed and well structured response. My feelings navigate towards this approach as well.
robertu94 commentedon Feb 15, 2023
Several of the posts here have mentioned
Makefiles which I think are an apt comparison here. I think it may be useful to think about exactly whatMakefiles and themakefrontend provide to the user both humans and machines.What does Make provide?
$PWD/Makefileis the main entry point. Depending on your implementation of Make (e.g. BSD or GNU), there may be other variants like$PWD/GNUMakefilethat are tried first but the order these is considered is documented. You can also override this with-fautotoolsand cemented byCMake(meta build system tools that produce makefiles to enable easier to abstract away differences between compilers and operating systems) this target builds everything required to build all targets 1.check(autotools) ortest(cmake and meson) are used to run tests cases.cleancleans the caches and artifacts built by the pipelines.installinstalls the targets. Autotools defines a few other targets related to packaging (e.g. RPMs and DEBs), but these aren't standardized by the successor tools.PHONYrules that always run to check the status of the cache, and touch files to force it to be cleared. People often also augment this cache with tools specific to languages by settingCCorCXXtoccachefor even better caching based on semantic contents.-BThey also provide a mechanism to assume that a cache has not expired with-oeven if it has.-kninjawhich in many ways is a successor to Make provides this functionality built-in.--trace. The version of this forninjashows this as JSON which makes it much easier for 3rd party tools to integrate with. I'm guessing it would have usedprotobufif it was bulit today.-n-j(max limit of concurrent tasks) and--load-average(max CPU usage since some tasks may take multiple CPU cores).So what IMHO can dagger learn from Make?
daggeror 2) provide an error if multiple of these files exist requiring the user to specify which one they prefer either with an environmental variable or a CLI flag.makecommand with no arguments does a reasonable thing of building all targets giving machines a reasonable default. There are a few other standard targets people have come to expect and are generated by default by 3rd party tools such as CMake and Autotools and consumed by various IDEs. There is also a standard way for building named targets to make it easy for a machine to call them without requiring text box/file with a bunch of flags. Dagger should have something analogous to "build everything" andcleantargets. It may make sense for the default for dagger to betest(which pulls in "build everything" by dependency).-k) , to override caching (-Band-o), parallelism (-land-j) and to print/visualize the task graph (-nand--trace). Dagger should provide similar flags because these are orthogonal to the main goal of the developer of defining their pipeline, but super useful in practice and can be done programmatically from the pipeline definition.makeprovide task information in both human and machine readable formats to allow these to be populated into menus in tools/autocomplete on the CLI.Footnotes
you can exclude things from everything in Autotools and CMake, but this has to be done explicitly. The default is all tasks related to building the program or library get built. Meson also follows this pattern but with
ninjafiles. ↩marcosnils commentedon Feb 15, 2023
Nice analysis @robertu94! I guess the questions that come to my mind are:
robertu94 commentedon Feb 16, 2023
@marcosnils to answer your questions:
For many complex things yes. There have been decades of tools that fulfill parts of
make's functionality as I explain in the next section. However, for truly simple things (i.e. compiling a single file C project with few if any dependencies) its really hard to beatmakefor C or C++. I primarily useCMakefor C++, but still have a folder full of code samples with Makefiles instead of Cmake because they are stupidly simple and Cmake would be overkill. A lot of them look like thisAnd with this I can build with
gccorclang, change my optimization levels or compiler flags and run tests even fromvieven without the niceties ofvimorneovim. The ubiquity and simplicity of make in the simple cases Dagger as much as I love it won't beat a purpose built tool used for its intended purpose.I think this question is best understood thought what came after Makefiles and the gaps that they leave.
autotoolswas the first. The primary issue that it solved was portability and conditionality. Make uses it's own bespoke language to describe the relationships between sources and targets which made it difficult to hand differences like where the a particular system header or library was installed. It solved this by allowing users to write logic to generate Makefiles in languages likem4,bourneshell, or perl.cmakewas next. The primary challenges that it solved overautotoolswere workflow simplicity and configure time speeds. Autotools isn't just one command but several (I think more than 7 or 8). Understanding the whole ecosystem is somewhat complicated which made fixing issues with it complex.cmakeaddressed this by simplifying the model down to 2 commandscmakeand your build system (makeon Unix-like systems). Secondly, Autotools configure steps can really take forever because they aggressively utilize the filesystem.cmakeaddressed that by making smarter use of the filesystem in common cases.mageandrakewhich try to be more minimal and in the spirit ofmake, but with improved syntax and language semantics withgoandrubyrespectively which is nice if you know those languages, but you are unlikely to use if you don't.ninjacame after that. The problem that it solves is better parallelism. Because of features like recursive make files and embedded programming features added as non-standard extensions on top of POSIX make, it can be hard to parallelize the parsing and execution of make files. Ninja solves this problem by using a much simpler programming model which is easier to schedule, but leaves the complexity of writing the files themselves to a higher level tool likecmakeor `meson. However, even with these tools digging though multiple processes logs or tons of small log files makes debugging parallel builds a pain.mesonfollowedninjaandcmakeand tries to provide both dependency management and a more proper programming language than cmake's string-ly typed programming language. I would argue that they didn't solve dependency management for C++, but they did spurcmakeand other tools to make massive strides in fixing the problem. It also uses a non-turing complete python-esque language with proper types and type semantics and a more interpretable set of scope rules. It provides also easy mechanisms for common tasks used in modern C++ tooling.bazelbut I also could have saidbuckorpants. The problem that they really try to solve are build isolation and distributed builds. Some might say multi-language, butautotoolsandcmakehad that decades ago. Build isolation technically existed before withDockerfiles, and tools like Gentoo'ssandbox, butbazelwas the first that "made it easy" and could still handle complex builds with maximal parallelism. Distributed builds also technically existed with things likedistccoricecream, but since these weren't also hermetic, it was and is a pain to use. Wherebazelfalls short in my mind is that they don't have a good solution to the dependency problem (it is getting better with bzlmod) since Google didn't need to solve this problem internally because they use a mono-repo (for good reasons, just not ones that everyone lives with). However, other projects likecmake(after prodding frommeson),spackcan solve this problem better.Three other classes of tools which don't fit neatly into the history above.
There is a enormous list of language specific tools like
setuptools/pep517,maven,gradle,cargo,fpm,cabal,npm, andgowhich are really language specific workflow tools and sometimes decent dependency managers. Their primary goal it simplify the common workflows for their specific language. If they support using another language, it is because you used some escape hatch to call a series of shell commands. IMHO, you are unlikely to be a better python workflow tool thanpoetry. Your aren't going to supplantcargoin rust. They in my mind solve a different problem.There are also dozens of bespoke "workflow" tools tailored for specific applications (e.g. Genomics) or computing environments (e.g. AWS SWF) or distributed programming paradigms like
parsecandlegionwhich have specific applications in mind that they are optimizing aggressively for. You probably won't replace these either for the same reason.Lastly, There are also cross-language dependency managers which moonlight as build systems such as Gentoo's
portageuser level-only versions likenixandspack. These are interesting in the since that they make it somewhat easy to create a reproducible environment from source and then in some cases compile it in parallel on a super computer or cluster of servers. Tools likepoudrierefor FreeBSD andkojifor Fedora also moonlight in this space and manage the building of packages for these distributions. These tools generally produce a fixed set of artifacts but may not handle more complex workflows.Given this landscape, here is where I think dagger can make a difference to go beyond the tools that exist overcome limitations:
npmand other places they don't belong.systemd-run, but not as easily at a per task level.corefile for compiled languages, but for your CI which may consist of multiple processes.sipsma commentedon May 1, 2023
For those following this issue, there is an early POC of support for entrypoints here: #5060
All the feedback in this issue is extremely helpful. That first draft of the POC is more focused on just getting something to work, but I'll be referencing all the suggestions here as I keep iterating. Please feel free to continue discussing high-level topics here or leave any feedback specific to the POC on that PR.
sipsma commentedon May 17, 2023
To update, #5060 has been merged, but it's just a first step. I've created public github issues for a few of the follow ups that I think are most likely to get commented on by the community:
dagger do#5145The rest of the follow-up TODOs in that PR are in our internal issue tracker, but I am more than happy to get any input from the community on them and discuss in a public issue in Github. Just let me know here, or feel free to leave any other feedback/ideas on this issue as we keep iterating.
shykes commentedon Mar 26, 2024
Hello everyone. As many of you know, this has finally been implemented in Dagger 0.10, with Dagger Functions.
Thank you all for your patience and feedback. There is still much left to do!