Replies: 2 comments 10 replies
-
|
@infogulch just picking up on my comment in #1325 (comment). Firstly a huge thank you for providing this usage report. Incredibly valuable. We are in the process of picking up the discussion in #1325. I am trawling through all linked issues, discussions etc for relevant inputs, and this is a comprehensive analysis. Thank you. Some questions based on what you presented.
Please can you expand on what you mean here?
Please can you expand on what capabilities you would want/expect from the workflow runner? The analogy I'm most obviously drawing here is with buildkit and its approach to caching. However that approach makes me nervous. The workflow runner/orchestrator (i.e. buildkit) can never precisely know if a step can be skipped or not. Only the task itself can, in certain situations, know that answer definitely. As a relatively straightforward example, take a Go build. When it comes to knowing whether a Go build/test/etc step needs to be re-run or not, the only safe answer can be provided by
Very pleased to see another happy user of @mvdan's great package! Please can you expand on where you see the shell aspect being relevant? I ask because the existing
No questions about this point, just to say that in the analysis I'm currently pulling together I am going to give this almost an entire section of its own because I think it's a crucial and fascinating aspect. |
Beta Was this translation helpful? Give feedback.
-
|
A few comments from my experience building task executors:
I wonder what is the expected scope of cue cmd. So far I have only used it to generate multi document YAML files from my kubernetes or argo workflows cue code. I have never personally considered it as a general purpose build system. My biggest issue with most general purpose build systems is that their CLI argument parsers suck and they have no autocompletion for options or a way to nicely complete commands and subcommands. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've spent over a decade implementing existing and custom build and deployment tools. Most tools have their niche, all have flaws. When I came across CUE a couple years ago it stood out as potentially sidestepping the biggest flaws in the systems I've used. I'm comfortable with most programming paradigms, but I have a soft spot for prolog and unification more broadly, so perhaps my eye for CUE is not surprising. Last year I chose to learn CUE by experimenting with
cue cmdas a substitute Makefile and CI for a little http/html rendering engine based on Go templates I was building. (I have been advised to avoid trying 3+ experiments in one project; alas, that advice has never stuck.) The result is make_tool.cue which acts as both a local makefile/task runner and CI to run builds -- 6 Go platform targets, as a module in a custom Caddy build, and docker image -- including scripted integration tests to validate most of these artifacts after the release builds are complete.This post is a synthesis of my thoughts on how to improve
cue cmdfor this and similar purposes, based on the experiment and my past experience.With some work
cue cmdhas the potential to be a world class task execution engine. #1325 contains a loose collection of possible improvements tocue cmd, which is good to have, but it doesn't try to present a coherent vision of where the tool should go.I think
cue cmdcan successfully targetMakefiles, task files, bash run scripts, proprietary CI scripts like GitHub Actions workflows, and maybe eventually Dockerfiles, bazel, and nix flakes.This list contains, in my opinion, the most important things to improve in
cue cmdto make it more a more useful tool for these use cases, numbered for easy reference in the discussion below. Sections are organized in a rough priority order.Let me know what you think!
Debuggability
cue cmdincorporates layers of complex interacting systems. Users need to be able to debug each of these layers.CUE Definition Layer. For practical purposes CUE is a full programming language (Turing completeness is not relevant here), so users need to be able to debug it like it's a programming language. In addition,
cue cmdmay be a user's first foray into CUE in general, which makes getting feedback in this layer important. That means at least the ability to export expanded cue after parsing but before flow execution begins to debug their initial definitions. Validating that tasks match their tool schema definition would also be good. Currently, CUE export refuses to even recognize tool files and cannot export them, and the workarounds are tedious.CUE Flow Layer. The mermaid diagram export is on the right path and it's nice to have a straightforward general solution, but it's difficult to use in practice and is hard to read because there is no well-defined way to lay out the tasks so they end up jumbled when rendered. The diagram would be easier to read if the mermaid output used a diagram type that could represent time; a sequence diagram perhaps. Copying 100's of lines out of a terminal to paste into a mermaid renderer every time a task updates just to see anything at all is tedious. It would be nice if the terminal displayed the the task execution graph in a way that indicated the live status without requiring external tools. Docker's interactive build UI manages to display concurrent command execution in a coherent way, perhaps this could be an inspiration.
Logging
While concurrent task execution is an excellent feature, its utility is ruined by interleaved stderr/stdout logs. One solution that I've mentioned before is prefixing log outputs with a unique task id. Cue itself logging task start and end times could be useful for debugging, as well as being able to tee output to a file. Besides prefixes, another option is to buffer task output and send it all out in a group. This is an option offered by go-task which makes for a very nice integration with GitHub Actions'
::group::command.Metadata
It's important for users to be able to discover available commands without diving into tool source files, especially when cue cmd is used in larger projects with many tasks.
cue cmd --listDocumentation
Browsing the CUE repository or the godoc site for .cue and .go files to discover available tasks and their behavior is inefficient and frustrating. Comprehensive, accessible documentation is essential for adoption and effective use.
Control Flow
The current control flow mechanisms (
$after) incue cmdare too simple. Mutexes/semaphores as suggested in #1325 could do "anything" but I suspect they will be too low-level for common use cases. A few higher-level abstractions would improve usability and readability.Flow expression propagation limitations
Task outputs are critical for dynamic workflows, but non-task expressions derived from task outputs are not handled correctly and fail evaluation too early in value flow propagation.
Task Deduplication
Avoiding redundant task execution improves performance, especially in large workflows. In addition deduplication completely eliminates any need for the insane overcomplicated gymnastics I performed to simulate shared global variables in make_tool.cue.
Cross platform shell
Shell command behavior varies across systems, even within the same OS, due to differences in shell selection, version, and configuration. A consistent shell experience is crucial for portability.
Hermetic / Reproducible Environments
Reproducible environments are essential for consistent task execution, especially in CI/CD pipelines or when targeting tools like Dockerfiles or nix flakes.
Beta Was this translation helpful? Give feedback.
All reactions