Skip to content

ci: mage -> ./hack/make - #3756

Merged
aluzzardi merged 1 commit into
dagger:mainfrom
aluzzardi:makefile
Nov 10, 2022
Merged

aluzzardi merged 1 commit into
dagger:mainfrom
aluzzardi:makefile

Conversation

@aluzzardi

@aluzzardi aluzzardi commented Nov 9, 2022 •

Copy link
Copy Markdown
Contributor
  • Run ./hack/make X instead of mage X
  • Use vendored version of mage instead of binary

/cc @gerhard @sipsma @vito

Comment thread .github/workflows/publish-sdk-go.yml Resolved
@shykes

shykes commented Nov 9, 2022

Copy link
Copy Markdown
Contributor

Awww no more mage? What's the rationale? Out of curiosity, I'm happy to use either.

@aluzzardi

Copy link
Copy Markdown
Contributor Author

Awww no more mage? What's the rationale? Out of curiosity, I'm happy to use either.

mage is still there, but instead of using it as a CLI we use it as a library.

This is hidden behind a Makefile for convenience (make foo --> go run <...>/main.go foo --> equivalent of mage foo)

main.go itself is simply implemented as func main() { os.Exit(mage.Main()) }.

Rationale is:

  • Currently we have to use the mage GitHub action to install the mage CLI at a specific version
  • Currently core developers need to install mage from brew/wherever, ideally the same version
  • Both requirements are now gone
    • the Go toolchain is the only requirement, the rest is just regular Go code
    • mage is a library like any other, vendored in our go.mod at a specific version

@vito

vito commented Nov 9, 2022

Copy link
Copy Markdown
Contributor

Nice, will rebase #3755 on this too, since it's blowing up in CI because mage isn't in the $PATH for some reason. Seems like I could get all that working with this change more easily.

Comment thread Makefile Outdated

@vito vito Nov 10, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, I glossed over this but "$@" doesn't do what I hoped it would - what it does in Bash - it's just really close. It only takes the first argument, so I can't do this for #3739: make boot:dev sdk:go:test:

❯ make boot:dev sdk:go:test
not enough arguments for target "Boot:Dev", expected 1, got 0
exit status 2
make: *** [Makefile:6: boot:dev] Error 1

In general this limitation makes me wonder if the Makefile wrapper is even worth it since we wouldn't be able to use it for targets that take arguments.

Maybe we could just have a hack/mage wrapper script? (Or wherever, don't really care where it lives.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I feel the same way. make had a good run. I think it's time to let it rest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, I glossed over this but "$@" doesn't do what I hoped it would - what it does in Bash - it's just really close. It only takes the first argument, so I can't do this for #3739: make boot:dev sdk:go:test:
❯ make boot:dev sdk:go:test

Right -- this means make boot:dev AND sdk:go:test.

Had the same problem with sdk:*:publish <argument> Perhaps a shell script as you suggested would be better.

One weird thing I can't understand is how do we "make" multiple targets with mage? Maybe the answer is we don't.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to ./hack/make

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: didn't call it ./hack/mage because we're not using mage that much now.

Would be fairly trivial to have our own main at this point.

@aluzzardi
aluzzardi force-pushed the makefile branch 2 times, most recently from 0fb2ddd to 8a16dfa Compare November 10, 2022 01:24
- Run `make X` instead of `mage X`
- Use vendored version of mage instead of binary

Signed-off-by: Andrea Luzzardi <[email protected]>
@aluzzardi aluzzardi changed the title ci: Switch to Makefile ci: mage -> ./hack/make Nov 10, 2022

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, no more googling "how to install mage" and love the fact that we could easily go run anything else now easily too (or dagger do, etc.)

@aluzzardi
aluzzardi merged commit 7c092b6 into dagger:main Nov 10, 2022
@aluzzardi
aluzzardi deleted the makefile branch November 10, 2022 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants