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

Specify bot names in the UI #29

Open
joelekstrom opened this issue May 7, 2015 · 16 comments
Open

Specify bot names in the UI #29

joelekstrom opened this issue May 7, 2015 · 16 comments

Comments

@joelekstrom
Copy link
Contributor

Right now, the bots are automatically named BuildaBot [organisation/repo] PR #pr-no. In our office, we have all integrations showing up on a big screen, and in this case these bot names make no sense.

It would be nice to be able to specify bot names with a small DSL in a field. Especially, more interesting than the PR number is to have the actual PR title.

Suggested solution

Add a text field in the UI where we can input names. Also, supply a few variables that can be used in the string that will be replaced if they exist. For example, the following input:

BurgerBot :: "{pr_name}" (#{pr_no})

where {pr_name} and {pr_no} are variables, would generate this bot name:

BurgerBot :: "Flip burgers twice instead of once" (#3)

Additional variables could for example be organisation, repo etc.

@czechboy0
Copy link
Member

Oh this would be awesome. Take a look here, these are a couple of tiny methods where Builda figures out the name of a bot. Feel free to try to implement this yourself, I'd love to have that in Builda.

The only issue with having the PR name in the Bot name is that the PR name can change and Builda uses the name to pair existing bots with PRs. So I guess we'd need to also change bot matching to PRs to do a prefix match, instead of a perfect match. So that it could still be something like "BuildaBot [repo] #PR_NUMBER: PR_NAME", and we'd prefix match for only ""BuildaBot [repo] #PR_NUMBER:", so that even if you change your PR's name, it still matches.

@joelekstrom
Copy link
Contributor Author

Thanks. I will take a look at it if I get some time for that!

Yeah, matching bots/PR's by name feels a bit weird. Is there no way to get a bot ID or something like that via the API? The natural solution would be to match PR-number -> Bot ID or something like that.

@czechboy0
Copy link
Member

Well Builda is stateless, so it has to be able to assume the Bot's name from the repo+PR number without saving anything. But that still would work fine, as I said, we'd just need to prefix match instead of exact match.

@joelekstrom
Copy link
Contributor Author

Yeah, that could work. On another note: Is there a specific reason for why it is stateless? I imagine this is a very good case for state, to be able to arbitrarily name bots if possible.

@czechboy0
Copy link
Member

@accatyyc Well, basically on every sync (the thing that happens every ~15 seconds or however long your sync interval is), Builda pulls all PRs from GitHub and Bots from Xcode Server and resolves them into actions. There is nothing saved in memory or on disk. This allows for much simpler logic, where even if you stop Builda, make changes to your PRs and Bots and start it again, it will always do the right thing and recover.

In #66 I was hoping to confirm that we could identify bots by custom keys, but that will not be possible unfortunately (see #66 for explanation). This means we still need to rely on the Bot's name to uniquely identify it during resolution time.

If you have an idea on how to still make sure we never mix bots incorrectly (even with multi-project support) AND allow for bot name customization, I'm all yours. In the meantime, I will unfortunately have to de-prioritize this, because I don't see a straightforward way of allowing this yet (I'll keep thinking about it though, because I recognize it'd be a pretty nice feature to have).

@joelekstrom
Copy link
Contributor Author

OK, I could check this myself ofc but since you know the Xcode Server API's - when returning bots, do they not return anything like a key that could identify the bot (if Builda started saving state, ofc)?

@czechboy0
Copy link
Member

Yeah there is an id associated with every bot, but that would mean we'd have to start keeping state in Builda, which would introduce a whole new level of complexity. I'm not completely against it, but it doesn't justify the work in my opinion just yet.

@czechboy0
Copy link
Member

If we end up doing it, let's use Stencil.

@joelekstrom
Copy link
Contributor Author

👍

@rhysforyou
Copy link

I'd definitely appreciate this feature. It's not a particularly elegant solution, but could you potentially start all bot names with the Pull Request number and allow anything after that to be user-defined?

@joelekstrom
Copy link
Contributor Author

@rpowelll It sounds like an OK solution to me. To make it even more failsafe, you could add a "magic number". So the bot names could be for example:

Ⓑ#23 Custom defined text where is the magic number for Buildasaur, and then the pr-number to distinguish the actual pull request.

@czechboy0
Copy link
Member

Problem is multiple repositories might be tested with Buildasaur at the same time. So you might clash with pull request numbers. That's why the name of the repo needs to be in the name as well.

@joelekstrom
Copy link
Contributor Author

Hmm. So the problem is matching the server repo against a repo on Github, right? Couldn't you somehow access a Server repo and run git remote to find out the Github URL maybe?

@czechboy0
Copy link
Member

Hmm that's a pretty good idea. I'll think about it.

Unfortunately I won't be able to also find the PR so that the name can be totally custom, because there isn't 1:1 mapping between branches and PRs.

But finding out the repo might be possible.

@joelekstrom
Copy link
Contributor Author

Cool. If that's possible, then doing Ⓑ #23 as prefix to find the PR and the rest custom would be a sufficient solution IMO!

@czechboy0
Copy link
Member

Technically, it might be, yeah! Okay, I'll take a look at this at some point and I'll add it to the 1.0 milestone.

@czechboy0 czechboy0 added this to the Gladiolus: Buildasaur 1.0 milestone Jul 23, 2015
@czechboy0 czechboy0 removed the UI label Sep 25, 2015
@czechboy0 czechboy0 modified the milestone: Gladiolus: Buildasaur 1.0 Oct 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants