Skip to content
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

bot fmt #93

Closed
kianenigma opened this issue Jul 26, 2022 · 12 comments
Closed

bot fmt #93

kianenigma opened this issue Jul 26, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@kianenigma
Copy link
Contributor

should trigger a cargo +nightly fmt on the codebase and push back.

@joao-paulo-parity joao-paulo-parity added the enhancement New feature or request label Jul 27, 2022
@joao-paulo-parity
Copy link
Contributor

It could be implemented in processbot since we already have bot rebase afterall, but going forward I think it makes a lot of sense to create a script for this in https://github.com/paritytech/pipeline-scripts with a matching configuration for that script in command-bot (https://github.com/paritytech/command-bot#pull-request-commands), maybe with a syntax which is not as noisy e.g. /cmd fmt or something along those lines.

Using command-bot has another benefit: we'll use whatever's the latest CI image to format the project, which is guaranteed to be aligned with the CI checks, as opposed to formatting through processbot's toolchain which might become outdated in case the bot isn't restarted after the CI image is updated.

We plan for command-bot to become "the general bot command" while processbot remains focused on the merging automation. This request inspired me to create paritytech/parity-processbot#396 which reinforces this idea.

For the time being I'll move this ticket to command-bot since it fits better there.

@joao-paulo-parity joao-paulo-parity transferred this issue from paritytech/parity-processbot Jul 27, 2022
@kianenigma
Copy link
Contributor Author

Totally, I actually opened the issue in a wrong place. This belongs to command-bot.

@kianenigma
Copy link
Contributor Author

Just to make sure I understood your comment, we can't do it already in command-bot, right?

@joao-paulo-parity
Copy link
Contributor

Just to make sure I understood your comment, we can't do it already in command-bot, right?

You "can't do" in the sense that the command is not available at the moment, but it's possible to implement it. The fmt configuration does not exist yet since we only have bench-bot and try-runtime configurations as advertised in https://github.com/paritytech/command-bot#pull-request-command-queue.

To create that command we'd do the following

  1. Create an fmt.sh script in https://github.com/paritytech/pipeline-scripts which formats the code an pushes it to the branch
  1. Add fmt to commandsConfiguration
    export const commandsConfiguration: {
    which calls the fmt.sh script, the same way that
    commandStart: ['"$PIPELINE_SCRIPTS_DIR/try-runtime-bot.sh"'],
    works
  1. Use the command as /cmd queue -c fmt (or create a /cmd fmt alias for it?)

This was referenced Jul 30, 2022
@mordamax
Copy link
Contributor

mordamax commented Aug 2, 2022

Test:
paritytech/substrate#11964
✅ Fixed formatting paritytech/substrate@cc0ef5d

however the command-bot probably doesn't expect us to not pass arguments
so it fails with /cmd queue -c fmt or /cmd queue -c fmt $
while /cmd queue -c fmt $ 1 works, the usage is weird

Filed: #96 to fix this weird thing

@bkchr
Copy link
Member

bkchr commented Aug 2, 2022

All of this syntax is very weird. Honestly, I don't care what 1000 bots we got, the syntax should be simple.

A simple bot fmt should it be and not any /cmd queue -c fmt.

Can we not just merge bots or make on general thing that reacts to "bot" and then call the appropriate functionality?

@mordamax
Copy link
Contributor

mordamax commented Aug 2, 2022

@bkchr thanks for feedback, I feel your pain. As JP mentioned (or create a /cmd fmt alias for it?) of course we can and we need to simplify and this. I filed #97 which will also list all available ~1000 commands along with simple aliases

@bkchr
Copy link
Member

bkchr commented Aug 2, 2022

Still find it weird that there is some difference between bot and /cmd. Why not have one command for all?

@mordamax
Copy link
Contributor

mordamax commented Aug 2, 2022

@bkchr sorry what bot do you mean? are you talking about bot merge ?

@bkchr
Copy link
Member

bkchr commented Aug 2, 2022

Sorry, I meant some common prefix. Aka instead of having a wide variety of different ways to call different bots, some common prefix would be nice. Something like:

bot merge
bot rebase
bot fmt
bot try-runtime
bot bench --pallet pallet

Currently the last two for example are completely different command syntaxes.

@mordamax
Copy link
Contributor

mordamax commented Aug 2, 2022

yep, that's what command-bot will be essentially.
Remember the try-runtime and benchbot was running differently with separate commands, now they all go through /cmd queue -c [command-name] $ ...arguments
now instead of going to add bot fmt which would be part of old processbot, it is part of command-bot, which will be one entry point for all types of commands

/cmd queue -c bench $ ...
/cmd queue -c try-runtime $ ...
/cmd queue -c fmt $ ...
etc..
and who knows, may be bot merge and bot rebase will be migrated here too

the problem is clear though - the syntax :) and there is a remedy for it #97 💊

@mordamax
Copy link
Contributor

mordamax commented Aug 3, 2022

Closing this meanwhile, as technically it's possible to run, improvements to syntax will be followed up in upcoming issues

@mordamax mordamax closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants