Add the ability to run a new project created hook
Notify users when a new project has been created. This could solve an issue in the Jenkins gerrit-trigger-plugin where we need to continuously fetch the whole project list (using the command gerrit ls-projects) to get project name auto completion working in the Project Configuration pages. By letting the plug-in pickup new projects on the fly, our auto completion would be up-to-date much quicker and also drain less resources from Gerrit. The hook takes the following form: project-created --project <project name> --head <head name> Change-Id: Ibf53946b12df4efd2f929fa7fc6d23499ed7ed88
This commit is contained in:
committed by
David Pursehouse
parent
507b58dae2
commit
53286f2503
@@ -35,6 +35,7 @@ public class EventTypes {
|
||||
registerClass(new ReviewerAddedEvent());
|
||||
registerClass(new PatchSetCreatedEvent());
|
||||
registerClass(new TopicChangedEvent());
|
||||
registerClass(new ProjectCreatedEvent());
|
||||
}
|
||||
|
||||
/** Register an event.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
|
||||
public class ProjectCreatedEvent extends ProjectEvent {
|
||||
public String projectName;
|
||||
public String headName;
|
||||
|
||||
public ProjectCreatedEvent() {
|
||||
super("project-created");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project.NameKey getProjectNameKey() {
|
||||
return new Project.NameKey(projectName);
|
||||
}
|
||||
|
||||
public String getHeadName() {
|
||||
return headName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user