UX-39# Removed war module and some more cleanup
This commit is contained in:
parent
c6cfbc375f
commit
9c89b95b32
29
README.md
29
README.md
|
@ -9,16 +9,14 @@ Blue Ocean is the new UI project for Jenkins.
|
|||
|
||||
# Module Breakdown
|
||||
|
||||
## core
|
||||
All core functionality code lives here.
|
||||
## blueocean-web
|
||||
BlueOcean Web module, everything web related lives here including root url handling.
|
||||
|
||||
* js
|
||||
* blueocean.js
|
||||
* It is the entry point for blueocean UI. It defines extension point and for demonstration it defines dependency on another extension **name**
|
||||
|
||||
* java
|
||||
* embryo
|
||||
* Replaces classic jenkins, will eventually be replaced by embryo code
|
||||
* blueocean
|
||||
* BlueOceanUI.java is entry point for blue ocean backend
|
||||
|
||||
|
@ -28,35 +26,32 @@ All core functionality code lives here.
|
|||
* pom.xml
|
||||
* *metrics* and *variant* plugins are there for example to show this is where we can add dependency on external plugins
|
||||
|
||||
## alpha and bravo
|
||||
|
||||
These are just example of extensions. In due course we will be adding such extensions to this repo.
|
||||
|
||||
## all
|
||||
|
||||
This is where you run the app to include all plugins along with core. During development it can be used to include all extensions.
|
||||
|
||||
## war
|
||||
## blueocean-plugin
|
||||
|
||||
Generates BlueOcean standalone war file, to be run as *java -jar blueocean.war*.
|
||||
|
||||
This does not include embedded-driver as it's a plugin to be installed on standalone jenkins war.
|
||||
BlueOcean Jenkins plugin.
|
||||
|
||||
# Build and Run
|
||||
|
||||
## Build and run core module
|
||||
mvn clean install
|
||||
mvn clean install -DskipTests # to skip running tests
|
||||
|
||||
## Build and run BlueOcean Jenkins plugin
|
||||
```
|
||||
$ cd core
|
||||
$ cd blueocean-plugin
|
||||
$ mvn hpi:run
|
||||
```
|
||||
|
||||
- Open http://localhost:8080/jenkins in your browser. Also open JS console on the browser to see message printed from blueocean.js.
|
||||
- Open http://localhost:8080/jenkins/bo in your browser. Also open JS console on the browser to see message printed from blueocean.js.
|
||||
- Open http://localhost:8080/jenkins/hello in your browser. "Hello World" is printed by BlueOceanUI.doHello() method.
|
||||
|
||||
## To do javascript development
|
||||
|
||||
If you wish to make changes to blueocean.js, then you will need to install gulp (http://gulpjs.com/), and then either run:
|
||||
|
||||
>TODO: maven profile that defines dependency on blueocean-plugin to do UI development
|
||||
|
||||
```
|
||||
$ ./dev_core.sh
|
||||
```
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
<name>BlueOcean :: Jenkins Plugin</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>blueocean-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>blueocean-commons</artifactId>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package io.jenkins.blueocean;
|
||||
package io.jenkins.blueocean.service.embedded;
|
||||
|
||||
import hudson.Extension;
|
||||
import hudson.model.RootAction;
|
||||
import io.jenkins.blueocean.BlueOceanUI;
|
||||
import org.kohsuke.stapler.StaplerProxy;
|
||||
|
||||
import javax.inject.Inject;
|
|
@ -1,282 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jenkins-ci.main</groupId>
|
||||
<artifactId>pom</artifactId>
|
||||
<version>1.625.3</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>io.jenkins.blueocean</groupId>
|
||||
<artifactId>blueocean-standalone-</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>BlueOcean :: Standalone Driver</name>
|
||||
|
||||
<properties>
|
||||
<JENKINS_HOME>${basedir}/work</JENKINS_HOME>
|
||||
<contextPath>/jenkins</contextPath><!-- context path during test -->
|
||||
<port>8080</port><!-- HTTP listener port -->
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jenkins-ci.main</groupId>
|
||||
<artifactId>jenkins-war</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
|
||||
<dependency><!-- this is for auto-completion in init.groovy editing -->
|
||||
<groupId>org.jenkins-ci.main</groupId>
|
||||
<artifactId>jenkins-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- bundled plugins, sort by groupId then artifactId -->
|
||||
<dependency>
|
||||
<groupId>io.jenkins.blueocean</groupId>
|
||||
<artifactId>blueocean-commons</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>hpi</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jenkins.blueocean</groupId>
|
||||
<artifactId>blueocean-security-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>hpi</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jenkins.blueocean</groupId>
|
||||
<artifactId>blueocean-pipeline-service-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>hpi</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jenkins.blueocean</groupId>
|
||||
<artifactId>blueocean-profile-service-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>hpi</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>blueocean</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>overlays</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>3.0.3</version>
|
||||
</requireMavenVersion>
|
||||
<enforceBytecodeVersion>
|
||||
<maxJdkVersion>1.${java.level}</maxJdkVersion>
|
||||
<ignoreClasses>
|
||||
<ignoreClass>org.eclipse.jetty.spdy.*</ignoreClass>
|
||||
</ignoreClasses>
|
||||
</enforceBytecodeVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<configuration>
|
||||
<mavenExecutorId>forked-path</mavenExecutorId>
|
||||
<useReleaseProfile>false</useReleaseProfile>
|
||||
<arguments>-Prelease,sign</arguments>
|
||||
<goals>-DskipTests javadoc:javadoc animal-sniffer:check deploy javadoc:aggregate</goals>
|
||||
<pushChanges>true</pushChanges>
|
||||
<localCheckout>true</localCheckout>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</resource>
|
||||
</webResources>
|
||||
<!-- for putting Main-Class into war -->
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>Main</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
<!--outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>${project.build.directory}/${project.build.finalName}.war</file>
|
||||
<type>jar</type>
|
||||
<!-- deploy the war as a jar, so that the tests can pull this into the classpath -->
|
||||
<classifier>war-for-test</classifier>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jenkins-ci.tools</groupId>
|
||||
<artifactId>maven-hpi-plugin</artifactId>
|
||||
<version>1.115</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>bundle-plugins</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/generated-resources/WEB-INF/plugins/</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- sign war -->
|
||||
<id>sign</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jarsigner-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<!-- sign the war -->
|
||||
<execution>
|
||||
<id>signWar</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!--
|
||||
during the development, debug profile defined in ../pom.xml will cause
|
||||
the jars to be signed by a self-certified dummy public key.
|
||||
|
||||
For release, you should define the real values in ~/.m2/settings.xml
|
||||
-->
|
||||
<alias>${hudson.sign.alias}</alias>
|
||||
<keystore>${hudson.sign.keystore}</keystore>
|
||||
<storepass>${hudson.sign.storepass}</storepass>
|
||||
<keypass>${hudson.sign.keypass}</keypass>
|
||||
<removeExistingSignatures>true</removeExistingSignatures>
|
||||
<processAttachedArtifacts>false</processAttachedArtifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>interactive</id>
|
||||
<properties>
|
||||
<vm.args />
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>display-dependency-updates</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<allowSnapshots>false</allowSnapshots>
|
||||
<processDependencyManagement>false</processDependencyManagement>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>run</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>java</executable>
|
||||
<commandlineArgs>
|
||||
${vm.args} -jar ${project.build.directory}/${project.build.finalName}.war --prefix=${contextPath}
|
||||
</commandlineArgs>
|
||||
<environmentVariables>
|
||||
<JENKINS_HOME>${JENKINS_HOME}</JENKINS_HOME>
|
||||
</environmentVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
|
@ -9,7 +9,7 @@
|
|||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blueocean-core</artifactId>
|
||||
<artifactId>blueocean-web</artifactId>
|
||||
<packaging>hpi</packaging>
|
||||
|
||||
<name>BlueOcean :: Web module</name>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package io.jenkins.embryo;
|
||||
|
||||
import hudson.ExtensionPoint;
|
||||
|
||||
/**
|
||||
* Thre must be a sole implementation of this, which is the root of the application.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class App implements ExtensionPoint {
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package io.jenkins.embryo;
|
||||
|
||||
import hudson.Extension;
|
||||
import io.jenkins.blueocean.BlueOceanUI;
|
||||
import org.kohsuke.stapler.StaplerProxy;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Glue to map {@link BlueOceanUI} at the root of the URL space.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@Extension
|
||||
public class BlueOceanApp extends App implements StaplerProxy {
|
||||
@Inject
|
||||
BlueOceanUI app;
|
||||
|
||||
@Override
|
||||
public Object getTarget() {
|
||||
return app;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package io.jenkins.embryo;
|
||||
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionComponent;
|
||||
import hudson.scm.SCM;
|
||||
import hudson.tools.ToolInstallation;
|
||||
import hudson.widgets.Widget;
|
||||
import jenkins.ExtensionFilter;
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
/**
|
||||
* Removes unwanted functionalities from Jenkins
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@Extension
|
||||
public class DescriptorFilterImpl extends ExtensionFilter {
|
||||
@Override
|
||||
public <T> boolean allows(Class<T> type, ExtensionComponent<T> component) {
|
||||
if (type==Widget.class && isFromCore(component)) return false;
|
||||
if (component.isDescriptorOf(SCM.class)) return false;
|
||||
if (component.isDescriptorOf(ToolInstallation.class)) return false;
|
||||
// TODO: lot more can be removed here
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private <T> boolean isFromCore(ExtensionComponent<T> component) {
|
||||
return component.getInstance().getClass().getClassLoader()==Jenkins.class.getClassLoader();
|
||||
}
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
package io.jenkins.embryo;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import hudson.Extension;
|
||||
import hudson.init.InitMilestone;
|
||||
import hudson.init.Initializer;
|
||||
import hudson.model.Descriptor.FormException;
|
||||
import hudson.model.Item;
|
||||
import hudson.model.TopLevelItem;
|
||||
import hudson.model.View;
|
||||
import hudson.model.ViewGroup;
|
||||
import hudson.model.listeners.ItemListener;
|
||||
import hudson.util.PluginServletFilter;
|
||||
import io.jenkins.blueocean.security.AuthenticationFilter;
|
||||
import jenkins.model.Jenkins;
|
||||
import org.kohsuke.stapler.StaplerProxy;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Take over the root UI object from Jenkins
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class DisJenkins extends View implements StaplerProxy {
|
||||
@Inject
|
||||
private transient App app;
|
||||
|
||||
public DisJenkins(String name, ViewGroup owner) {
|
||||
super(name, owner);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getTarget() {
|
||||
Jenkins jenkins = Jenkins.getInstance();
|
||||
if (jenkins == null) {
|
||||
throw new IllegalStateException("Jenkins instance is not ready");
|
||||
}
|
||||
|
||||
return jenkins.getExtensionList(App.class).get(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stub out the View methods.
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(TopLevelItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<TopLevelItem> getItems() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void submit(StaplerRequest req) throws IOException, ServletException, FormException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item doCreateItem(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* The way we take over the UI is by taking over the root view.
|
||||
*
|
||||
* @param j The Jenkins instance
|
||||
* @throws IOException in case something goes wrong when creating views or when saving Jenkins configuration
|
||||
*/
|
||||
@Initializer(after= InitMilestone.JOB_LOADED, before= InitMilestone.COMPLETED)
|
||||
public static void install(Jenkins j, AuthenticationFilter authFilter) throws IOException {
|
||||
LOGGER.log(Level.INFO, "Configuring Embryo Root View");
|
||||
DisJenkins v = new DisJenkins("Root", j);
|
||||
j.addView(v);
|
||||
j.setPrimaryView(v);
|
||||
boolean seenDisJenkins = false;
|
||||
for (View oldView : j.getViews()) {
|
||||
if (seenDisJenkins) {
|
||||
j.deleteView(oldView);
|
||||
} else {
|
||||
seenDisJenkins |= oldView instanceof DisJenkins;
|
||||
if (!(oldView instanceof DisJenkins)) {
|
||||
j.deleteView(oldView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
PluginServletFilter.addFilter(authFilter);
|
||||
} catch (ServletException e) {
|
||||
throw new IOException("AuthenticationFilter failed to initialize.", e);
|
||||
}
|
||||
j.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* I see some cases where Embryo comes up without DisJenkins installed,
|
||||
* so doubly make sure we have it installed.
|
||||
*/
|
||||
@Extension
|
||||
public static class ItemListenerImpl extends ItemListener {
|
||||
@Inject
|
||||
private Jenkins jenkins;
|
||||
|
||||
@Inject
|
||||
private AuthenticationFilter authFilter;
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
try {
|
||||
install(jenkins, authFilter);
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(Level.INFO, "Failed to install Embryo");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(DisJenkins.class.getName());
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Emulates Embryo for now.
|
||||
*/
|
||||
package io.jenkins.embryo;
|
Loading…
Reference in New Issue