File tree 1 file changed +31
-1
lines changed
1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,37 @@ as appropriate. The plugins file list is updated for each event, there is no
52
52
need to restart GitLab to apply a new plugin.
53
53
54
54
If a plugin executes with non-zero exit code or GitLab fails to execute it, a
55
- message will be logged to ` plugin.log ` .
55
+ message will be logged to:
56
+
57
+ - ` gitlab-rails/plugin.log ` in an Omnibus installation.
58
+ - ` log/plugin.log ` in a source installation.
59
+
60
+ ## Creating plugins
61
+
62
+ Below is an example that will only response on the event ` project_create ` and
63
+ will inform the admins from the GitLab instance that a new project has been created.
64
+
65
+ ``` ruby
66
+ # By using the embedded ruby version we eliminate the possibility that our chosen language
67
+ # would be unavailable from
68
+ # !/opt/gitlab/embedded/bin/ruby
69
+ require ' json'
70
+ require ' mail'
71
+
72
+ # The incoming variables are in JSON format so we need to parse it first.
73
+ ARGS = JSON .parse(STDIN .read)
74
+
75
+ # We only want to trigger this plugin on the event project_create
76
+ return unless ARGS [' event_name' ] == ' project_create'
77
+
78
+ # We will inform our admins of our gitlab instance that a new project is created
79
+ Mail .deliver do
80
+ from ' info@gitlab_instance.com'
81
+ to ' admin@gitlab_instance.com'
82
+ subject " new project " + ARGS [' name' ]
83
+ body ARGS [' owner_name' ] + ' created project ' + ARGS [' name' ]
84
+ end
85
+ ```
56
86
57
87
## Validation
58
88
You can’t perform that action at this time.
0 commit comments