File tree 2 files changed +62
-1
lines changed
2 files changed +62
-1
lines changed Original file line number Diff line number Diff line change
1
+ # DevOpsBot
2
+
3
+ ChatOps を行う bot です。
4
+
5
+ ## 設定
6
+
7
+ 設定はファイルを通して行います。
8
+
9
+ ` CONFIG_FILE ` 環境変数に設定されたパスから、設定ファイルを読み込みます。
10
+ 指定が無い場合は ` ./config.yaml ` をデフォルトで読み込みます。
11
+
12
+ ### 設定ファイルの書き方
13
+
14
+ すべてのコマンドは、1つの「テンプレート」を通して実行されます。
15
+
16
+ ` # コメント ` となっている行は yaml のコメント行です。
17
+ Bot が読み取るファイルの中身には関係ありません。
18
+
19
+ ``` yaml
20
+ # テンプレート一覧
21
+ templates :
22
+ - name : echo-template
23
+ command : |
24
+ #!/bin/sh
25
+
26
+ echo test-arg1 "$@"
27
+
28
+ # 実際に実行できるコマンド一覧
29
+ commands :
30
+ # (required) コマンドの名前 → この場合は /echo-test となる
31
+ - name : echo-test
32
+ # (required) templates で設定したテンプレートの名前
33
+ templateRef : echo-template
34
+ # (optional) /help で表示されるコマンドの説明
35
+ description : " コマンドの説明"
36
+ # (optional) テンプレート実行時に、先頭に追加する引数
37
+ argsPrefix :
38
+ - test-arg2
39
+ - test-arg3
40
+ # (optional) テンプレートがユーザーからの引数をさらに必要とする場合、明示的に true と書く
41
+ allowArgs : true
42
+ # (optional) テンプレートがユーザーからの引数をさらに必要とする場合、ここにドキュメントを行う
43
+ argsSyntax : " [example|extra|arg|description]"
44
+ # (optional) このコマンド(とサブコマンド)を実行可能なユーザーの ID 一覧
45
+ # 定義しなければ、全員がこのコマンド(とサブコマンド)実行可能になります
46
+ operators :
47
+ - toki
48
+ - cp20
49
+ # (optional) サブコマンドの定義 (フィールドは一緒)
50
+ subCommands :
51
+ - name : sub-command
52
+ ... (省略)
53
+ ` ` `
54
+
55
+ 以上の設定を反映し、` /echo-test test-arg4` と打つと、DevOpsBot のローカルで
56
+
57
+ - ` echo test-arg1 test-arg2 test-arg3 test-arg4`
58
+
59
+ が実行されます。
60
+
61
+ テンプレートの中で SSH を使ったり、npm version と git push でバージョン更新を自動化したり、様々なスクリプトを実行できます。
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
13
13
// rootCmd represents the base command when called without any subcommands
14
14
var rootCmd = & cobra.Command {
15
15
Use : "DevOpsBot" ,
16
- Short : "A traQ bot for DevOps command execution " ,
16
+ Short : "A ChatOps bot for executing arbitrary shell commands. " ,
17
17
SilenceUsage : true ,
18
18
PreRun : func (cmd * cobra.Command , args []string ) {
19
19
fmt .Printf ("DevOpsBot v%s initializing\n " , utils .Version ())
You can’t perform that action at this time.
0 commit comments