Skip to content
Permalink
Browse files

Merge remote-tracking branch 'primary/2.0' into JENKINS-33770-securit…

…y-token-not-always-required
  • Loading branch information
kzantow committed Mar 31, 2016
2 parents b6f3585 + a9f1209 commit f06ee0fef4632c7f0994f8d5ebee086240348e80
Showing with 370 additions and 85 deletions.
  1. +1 −0 .mvn/jvm.config
  2. +27 −1 changelog.html
  3. +1 −1 core/pom.xml
  4. +2 −5 core/src/main/java/hudson/ExtensionFinder.java
  5. +1 −1 core/src/main/java/hudson/init/impl/InstallUncaughtExceptionHandler.java
  6. +13 −1 core/src/main/java/hudson/model/Fingerprint.java
  7. +2 −7 core/src/main/java/hudson/model/ItemGroupMixIn.java
  8. +33 −0 core/src/main/java/hudson/model/View.java
  9. +21 −5 core/src/main/java/hudson/model/ViewDescriptor.java
  10. +10 −0 core/src/main/java/jenkins/install/InstallUtil.java
  11. +1 −1 core/src/main/java/jenkins/install/SetupWizard.java
  12. +0 −33 core/src/main/java/jenkins/model/Jenkins.java
  13. +1 −1 core/src/main/resources/hudson/model/AllView/noJob.jelly
  14. +1 −1 core/src/main/resources/hudson/tools/label.jelly
  15. +0 −1 core/src/main/resources/jenkins/install/SetupWizard/authenticate-security-token.jelly
  16. +38 −13 core/src/main/resources/jenkins/install/UpgradeWizard/footer.jelly
  17. +2 −2 core/src/main/resources/jenkins/install/UpgradeWizard/footer.properties
  18. +1 −0 core/src/main/resources/jenkins/install/pluginSetupWizard.properties
  19. +1 −1 core/src/main/resources/lib/form/repeatableDeleteButton.jelly
  20. +1 −1 core/src/main/resources/lib/hudson/ballColorTd.jelly
  21. +2 −3 core/src/main/resources/lib/layout/html.jelly
  22. +15 −1 test/src/test/java/hudson/jobs/CreateItemTest.java
  23. +78 −0 test/src/test/java/hudson/model/ViewDescriptorTest.java
  24. +78 −0 test/src/test/java/hudson/model/ViewTest.java
  25. +1 −1 war/src/main/js/api/pluginManager.js
  26. +10 −3 war/src/main/js/pluginSetupWizardGui.js
  27. +6 −1 war/src/main/js/templates/errorPanel.hbs
  28. +2 −1 war/src/main/less/pluginSetupWizard.less
  29. +21 −0 war/src/main/webapp/css/style.css
@@ -0,0 +1 @@
-Xmx800m
@@ -24,7 +24,7 @@
<!--[if IE]>
<style type="text/css">div.rate-offset { bottom: 0.2em !important; left: 5em !important; }</style>
<![endif]-->
<script type="text/javascript" src="/rate/rate.js"></script>
<script type="text/javascript" src="https://jenkins-ci.org/rate/rate.js"></script>
</head>
<body>
<div align="right">Legend:
@@ -33,6 +33,7 @@
<img src="/images/bug2.gif" alt="major bug">major bug fix <img src="/images/bug.gif" alt="bug">bug fix
</span><span style="visibility:hidden">xxxxx</span>
</div>
<div id="head"></div>

<div id="ratings" style="display:none; font-size:120%;
border:1px solid black; background-color:#eee; padding:0.5em; margin-bottom:1em">
@@ -58,6 +59,31 @@
<li class=>
</ul>
</div><!--=TRUNK-END=-->
<h3><a name=v1.655>What's new in 1.655</a> (2016/03/27)</h3>
<ul class=image>
<li class="major bug">
Downgrade Stapler to 1.239 to fix remote API issues.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-33546">issue 33546</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-33605">issue 33605</a>)
<li class="major bug">
Plugin filters were failing to be removed and blocking restart.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-33681">issue 33681</a>)
<li class="bug">
Do not hardcode <tt>.bat</tt> extension for Maven on Windows.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-33693">issue 33693</a>)
<li class="rfe">
Reduce log level of <tt>UncaughtExceptionHandler</tt> message on startup.
(<a href="https://github.com/jenkinsci/jenkins/pull/2171">pull 2171</a>)
<li class="rfe">
Make list of build causes immutable.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-33467">issue 33467</a>)
<li class="rfe">
Developer API: Add <tt>Fingerprint.getXStream()</tt>.
(<a href="https://github.com/jenkinsci/jenkins/pull/2163">pull 2163</a>)
<li class="rfe">
Core Development: Add the <tt>.mvn</tt> directory and set default <tt>-Xmx</tt> value.
(<a href="https://github.com/jenkinsci/jenkins/pull/2162">pull 2162</a>)
</ul>
<h3><a name=v1.654>What's new in 1.654</a> (2016/03/21)</h3>
<ul class=image>
<li class="bug">
@@ -39,7 +39,7 @@ THE SOFTWARE.

<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.240</stapler.version>
<stapler.version>1.239</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>2.4.6</groovy.version>
</properties>
@@ -496,10 +496,7 @@ private void resolve(Class c) {
@SuppressWarnings({"unchecked", "ChainOfInstanceofChecks"})
@Override
protected void configure() {
int id=0;

for (final IndexItem<?,Object> item : index) {
id++;
boolean optional = isOptional(item.annotation());
try {
AnnotatedElement e = item.element();
@@ -524,8 +521,8 @@ protected void configure() {

resolve(extType);

// use arbitrary id to make unique key, because Guice wants that.
Key key = Key.get(extType, Names.named(String.valueOf(id)));
// make unique key, because Guice wants that.
Key key = Key.get(extType, Names.named(item.className() + "." + item.memberName()));
annotations.put(key,a);
bind(key).toProvider(new Provider() {
public Object get() {
@@ -42,7 +42,7 @@ public void reportException(Throwable e, ServletContext context, HttpServletRequ
});
try {
Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler());
DefaultUncaughtExceptionHandler.LOGGER.log(Level.INFO, "Succesfully installed a global UncaughtExceptionHandler.");
DefaultUncaughtExceptionHandler.LOGGER.log(Level.FINE, "Successfully installed a global UncaughtExceptionHandler.");
}
catch (SecurityException ex) {
DefaultUncaughtExceptionHandler.LOGGER.log(Level.SEVERE,
@@ -1469,7 +1469,19 @@ public void run() {
return res[0];
}

private static final XStream XSTREAM = new XStream2();
private static final XStream2 XSTREAM = new XStream2();

/**
* Provides the XStream instance this class is using for serialization.
*
* @return the XStream instance
* @since FIXME
*/
@Nonnull
public static XStream2 getXStream() {
return XSTREAM;
}

static {
XSTREAM.alias("fingerprint",Fingerprint.class);
XSTREAM.alias("range",Range.class);
@@ -137,7 +137,7 @@ public String call(Item item) {
};

/**
* Creates a {@link TopLevelItem} from the submission of the '/lib/hudson/newFromList/formList'
* Creates a {@link TopLevelItem} for example from the submission of the {@code /lib/hudson/newFromList/form} tag
* or throws an exception if it fails.
*/
public synchronized TopLevelItem createTopLevelItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
@@ -170,12 +170,7 @@ public synchronized TopLevelItem createTopLevelItem( StaplerRequest req, Stapler
String from = req.getParameter("from");

// resolve a name to Item
Item src = null;
if (!from.startsWith("/"))
src = parent.getItem(from);
if (src==null)
src = Jenkins.getInstance().getItemByFullName(from);

Item src = Jenkins.getInstance().getItem(from, parent);
if(src==null) {
if(Util.fixEmpty(from)==null)
throw new Failure("Specify which job to copy");
@@ -35,6 +35,7 @@
import hudson.Util;
import hudson.model.Descriptor.FormException;
import hudson.model.labels.LabelAtomPropertyDescriptor;
import hudson.model.listeners.ItemListener;
import hudson.scm.ChangeLogSet;
import hudson.scm.ChangeLogSet.Entry;
import hudson.search.CollectionSearchIndex;
@@ -50,6 +51,7 @@
import hudson.util.DescribableList;
import hudson.util.DescriptorList;
import hudson.util.FormApply;
import hudson.util.FormValidation;
import hudson.util.RunList;
import hudson.util.XStream2;
import hudson.views.ListViewColumn;
@@ -110,6 +112,7 @@
import static jenkins.model.Jenkins.*;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.QueryParameter;
import org.xml.sax.SAXException;

/**
@@ -1005,6 +1008,36 @@ public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp) thr
*/
public abstract Item doCreateItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException;

/**
* Makes sure that the given name is good as a job name.
* For use from {@code newJob}.
*/
@Restricted(DoNotUse.class) // called from newJob view
public FormValidation doCheckJobName(@QueryParameter String value) {
// this method can be used to check if a file exists anywhere in the file system,
// so it should be protected.
getOwner().checkPermission(Item.CREATE);

if (Util.fixEmpty(value) == null) {
return FormValidation.ok();
}

try {
Jenkins.checkGoodName(value);
value = value.trim(); // why trim *after* checkGoodName? not sure, but ItemGroupMixIn.createTopLevelItem does the same
Jenkins.getInstance().getProjectNamingStrategy().checkName(value);
} catch (Failure e) {
return FormValidation.error(e.getMessage());
}

if (getOwnerItemGroup().getItem(value) != null) {
return FormValidation.error(Messages.Hudson_JobAlreadyExists(value));
}

// looks good
return FormValidation.ok();
}

/**
* An API REST method to get the allowed {$link TopLevelItem}s and its categories.
*
@@ -26,12 +26,14 @@
import hudson.views.ListViewColumn;
import hudson.views.ListViewColumnDescriptor;
import hudson.views.ViewJobFilter;
import java.util.Iterator;
import java.util.List;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import jenkins.model.Jenkins;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.AncestorInPath;

import java.util.List;
import org.kohsuke.stapler.QueryParameter;

/**
* {@link Descriptor} for {@link View}.
@@ -76,8 +78,22 @@ protected ViewDescriptor() {
* Auto-completion for the "copy from" field in the new job page.
*/
@Restricted(DoNotUse.class)
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value, @AncestorInPath ItemGroup container) {
return AutoCompletionCandidates.ofJobNames(TopLevelItem.class, value, container);
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value, @AncestorInPath ItemGroup<?> container) {
AutoCompletionCandidates candidates = AutoCompletionCandidates.ofJobNames(TopLevelItem.class, value, container);
if (container instanceof DirectlyModifiableTopLevelItemGroup) {
DirectlyModifiableTopLevelItemGroup modifiableContainer = (DirectlyModifiableTopLevelItemGroup) container;
Iterator<String> it = candidates.getValues().iterator();
while (it.hasNext()) {
TopLevelItem item = Jenkins.getInstance().getItem(it.next(), container, TopLevelItem.class);
if (item == null) {
continue; // ?
}
if (!modifiableContainer.canAdd(item)) {
it.remove();
}
}
}
return candidates;
}

/**
@@ -69,6 +69,16 @@
* @return The type of "startup" currently under way in Jenkins.
*/
public static InstallState getInstallState() {
// Support a simple state override. Useful for testing.
String stateOverride = System.getenv("jenkins.install.state");
if (stateOverride != null) {
try {
return InstallState.valueOf(stateOverride.toUpperCase());
} catch (RuntimeException e) {
throw new IllegalStateException("Unknown install state override specified on the commandline: '" + stateOverride + "'.");
}
}

// install wizard will always run if environment specified
if (!Boolean.getBoolean("jenkins.install.runSetupWizard")) {
if (Functions.getIsUnitTest()) {
@@ -102,7 +102,7 @@ public SetupWizard(Jenkins j) throws IOException, InterruptedException {
+ "*************************************************************" + ls
+ "*************************************************************" + ls
+ ls
+ "Jenkins initial setup is required. An admin user has been created and"
+ "Jenkins initial setup is required. An admin user has been created and "
+ "a password generated." + ls
+ "Please use the following password to proceed to installation:" + ls
+ ls
@@ -3581,20 +3581,6 @@ public static void checkGoodName(String name) throws Failure {
// looks good
}

/**
* Makes sure that the given name is good as a job name.
* @return trimmed name if valid; throws Failure if not
*/
private String checkJobName(String name) throws Failure {
checkGoodName(name);
name = name.trim();
projectNamingStrategy.checkName(name);
if(getItem(name)!=null)
throw new Failure(Messages.Hudson_JobAlreadyExists(name));
// looks good
return name;
}

private static String toPrintableName(String name) {
StringBuilder printableName = new StringBuilder();
for( int i=0; i<name.length(); i++ ) {
@@ -4122,25 +4108,6 @@ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter
return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath()));
}

/**
* Makes sure that the given name is good as a job name.
*/
public FormValidation doCheckJobName(@QueryParameter String value) {
// this method can be used to check if a file exists anywhere in the file system,
// so it should be protected.
checkPermission(Item.CREATE);

if(fixEmpty(value)==null)
return FormValidation.ok();

try {
checkJobName(value);
return FormValidation.ok();
} catch (Failure e) {
return FormValidation.error(e.getMessage());
}
}

/**
* Checks if a top-level view with the given name exists and
* make sure that the name is good as a view name.
@@ -32,7 +32,7 @@ THE SOFTWARE.
<j:choose xmlns:j="jelly:core">
<!-- Only show the create new jobs link to those users that have permission to use it. -->
<j:getStatic var="permission" className="hudson.model.Item" field="CREATE"/>
<j:when test="${h.hasPermission(permission)}">
<j:when test="${h.hasPermission(it.owner, permission)}">
<div class="call-to-action">${%newJob}</div>
</j:when>
<j:otherwise>
@@ -25,7 +25,7 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<st:documentation>
Puts the input field for allowing an user to limit this installer to a certain label.
Meant to be used from config.jelly of ToolInstaller subypes.
Meant to be used from config.jelly of ToolInstaller subtypes.
</st:documentation>
<f:entry title="${%Label}" field="label" help="/help/tools/help-label.html">
<!-- TODO could use Hudson.getLabels and make a combo box -->
@@ -29,7 +29,6 @@
<label class="control-label" for="security-token">${%Administrator password}</label>
<input name="j_username" value="${j.setupWizard.initialSetupAdminUserName}" type="hidden"/>
<input id="security-token" class="form-control" type="password" name="j_password"/>
<link rel="stylesheet" href="${j.installWizardPath}.css" type="text/css" />
</div>

</div>

0 comments on commit f06ee0f

Please sign in to comment.
You can’t perform that action at this time.