@POST public ModuleBuild trigger(BuildDefinition buildDefinition) { BuildState buildState = buildService.enqueue(buildDefinition); return new ModuleBuild( buildState.getGitInfo(), buildState.getModule(), buildState.getPendingBuild().get()); }
@POST @Path("/{id}/cancel") public void cancel(@PathParam("id") long id) { Optional<ModuleBuild> build = get(id); if (!build.isPresent()) { throw new NotFoundException("No build found for ID " + id); } buildService.cancel(build.get().getBuild()); }
@GET @Path("/{id}") public Optional<ModuleBuild> get(@PathParam("id") long id) { return buildService.get(id); }
@PUT public ModuleBuild update(ModuleBuild moduleBuild) { buildService.update(moduleBuild.getBuild()); return moduleBuild; }