-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Adopt use of Taskfile as a replacement for Makefile in active projects #126
Comments
I'm torn here. |
Yeah, I thought about this, and it could even be somewhat permanent where make just invokes
Task is a go project, so in my head if we have a Makefile that invokes task, we could also have that Makefile install task, just like our Makefile today installs other build tools. Something like this, perhaps (forgive the syntax which I'm sure is wrong, but also this illustrates my point about Makefile complexity): .DEFAULT_GOAL = --list
%: task
@$(TASK) $@
TASK = hack/tools/bin/task
.PHONY: task
task:
GOBIN=$(pwd)/hack/tools/bin go install <taskModule> |
If we are thinking about a replacement, why not Magefile :) I've seen a ton of go projects use this already. And it's all written in Go, which I am a HUGE fan of (I can do stuff much faster in Go than in shell scripts 😄 ) |
Yeah, I actually considered Magefile as well (though it has been awhile). My main takeaways were that it:
In general, I feel like our CI system is necessarily a bunch of "call this thing on the command line" (go, git, controller-gen, kustomize, goreleaser, kind, golangci-lint, etc.), so I would imagine that we'd still end up putting shell sorts of invocations into a Magefile. Theoretically, some of these CLIs have libraries we could use in go directly, but we'd likely be going against the grain (most users are using the CLIs, not the libraries). I also don't think there's really any actual shell scripting complexity stuff (conditionals, loops, etc.) in the Taskfile PR I put together in operator-controller. It's essentially us defining a bunch of individual commands and using the Taskfile schema to get the In my opinion, Taskfile is the sweet spot of:
|
On many projects, one or two people manage the Makefile, and everyone else avoids working on it because of how much Makefile-specific knowledge you need. And it seems like inertia has been a primary reason that Makefiles stick around. So I'm a fan of trying something that's more usable and a more natural fit to the use case. |
I propose that we replace our Makefiles with Taskfiles to orchestrate builds and CI.
I propose this here because I think we should build a consensus across the organization so that we maintain consistency across projects. In my opinion, it is more important to have a consistent tool across projects so that contributors don't have to learn the nuances of each individual repository.
A few taskfile benefits I've noticed:
build:<buildTaskName>
,test:<testTaskName>
)defer
keyword that lets you execute commands/tasks before a task run ends.The most powerful aspect of Makefile is turning input files into output files efficiently, but we don't make use of that feature. Instead we mark all (or at least almost all) of our targets at
PHONY
and we use Go tooling (e.g. module and build artifact caching) to have efficient build times.Here's an example PR of this in action in the operator-controller repo: operator-framework/operator-controller#137
Please upvote with 👍 or downvote with 👎 to state your position. And feel free to leave comments/questions/suggestions in the issue comments!
The text was updated successfully, but these errors were encountered: