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
Add /deploy command for GitHub deployment #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vetoing. This breaks separation of concerns, making this piece of software useless (and unorthogonal) outside of Serokell. Should really be a separate service.
lib/hermetic/slash/deploy.ex
Outdated
if String.contains?(repo, "@") do | ||
String.split(repo, "@") | ||
else | ||
[repo, "production"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an OTP param.
lib/hermetic/slash/deploy.ex
Outdated
|
||
env = | ||
case command do | ||
[] -> "production" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
@@ -0,0 +1,41 @@ | |||
defmodule Hermetic.Github do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent casing (Github
here, but not in PR title or on this site).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I really hate typing GitHub
, I'd rather change it all to Github
.
# Finish string or raise if unclosed | ||
defp do_split(<<>>, "", acc, false), do: Enum.reverse(acc) | ||
defp do_split(<<>>, buf, acc, false), do: Enum.reverse([buf | acc]) | ||
defp do_split(<<>>, _, _, _), do: raise("quoted string not closed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is manual splitting here justified over OptionParser.split/1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this code was only moved. It is almost the same as the source of OptionParser.split/1
. I don't know if we need to support '
in the command right now, but I think it's better to keep parsing consistent with the other command.
re separation of concerns: I think it would be unwieldy to run separate bots for every small feature. The best solution is probably to create a single slack bot with plugins for each of these features. That would take me a significant amount of effort though, so I don't think it should be covered in this PR. Most of the code here can still be used verbatim for plugins, so no effort is lost. If you want to do this refactoring, feel free, otherwise I might take it up in the future when I have a better understanding of Elixir. |
@@ -3,6 +3,10 @@ use Mix.Config | |||
config :hermetic, Hermetic, | |||
cowboy_options: [port: 59468] | |||
|
|||
config :hermetic, Hermetic.Slash.Deploy, | |||
default_ref: "master", | |||
default_env: "production" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm aware that this is configurable, I'd prefer the default to be staging, so that a deployment to production needs to be explicitly specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose production
because this is what the github api defaults to, so I think it makes more sense because that is what people expect a bot to do that just wraps the github deployments api.
We've had this conversation multiple times over several months, even back to when it was Vito's job, and nothing has changed since then. This repo is for a generic, user-configurable YouTrack -> Slack bridge, not some Serokell bot.
This feature is out of scope for this program. |
No description provided.