Skip to content

Commit

Permalink
Merge branch 'master' into new-build-history-2
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Dec 7, 2023
2 parents a2bd9a0 + cabc8f6 commit d3e2920
Show file tree
Hide file tree
Showing 59 changed files with 489 additions and 331 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/changelog.yml
Expand Up @@ -44,12 +44,15 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'jenkinsci'
steps:
- uses: tibdex/github-app-token@v1
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.JENKINS_CHANGELOG_UPDATER_APP_ID }}
installation_retrieval_mode: repository
installation_retrieval_payload: jenkins-infra/jenkins.io
private_key: ${{ secrets.JENKINS_CHANGELOG_UPDATER_PRIVATE_KEY }}
repository: jenkins-infra/jenkins.io
repositories: >-
["jenkins.io"]
- name: Check out
uses: actions/checkout@v4
with:
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/publish-release-artifact.yml
Expand Up @@ -13,10 +13,11 @@ jobs:
outputs:
project-version: ${{ steps.set-version.outputs.project-version }}
is-lts: ${{ steps.set-version.outputs.is-lts }}
is-rc: ${{ steps.set-version.outputs.is-rc }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
Expand All @@ -34,16 +35,23 @@ jobs:
is_lts=false
fi
echo "Version is $version, is_lts: $is_lts"
is_rc=false
if [[ ${version} == *"-SNAPSHOT" ]]; then
is_rc=true
fi
echo "Version is $version, is_lts: $is_lts, is_rc: $is_rc"
echo "is-lts=${is_lts}" >> $GITHUB_OUTPUT
echo "project-version=$version" >> $GITHUB_OUTPUT
echo "is-rc=${is_rc}" >> $GITHUB_OUTPUT
war:
permissions:
contents: write # to upload release asset (softprops/action-gh-release)

runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch war
id: fetch-war
Expand Down Expand Up @@ -76,6 +84,7 @@ jobs:

runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch Deb
id: fetch-deb
Expand Down Expand Up @@ -110,6 +119,7 @@ jobs:

runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch RPM
id: fetch-rpm
Expand Down Expand Up @@ -145,6 +155,7 @@ jobs:

runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch MSI
id: fetch-msi
Expand Down Expand Up @@ -180,6 +191,7 @@ jobs:

runs-on: ubuntu-latest
needs: determine-version
if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
steps:
- name: Fetch suse rpm
id: fetch-suse-rpm
Expand Down
2 changes: 1 addition & 1 deletion .gitpod/Dockerfile
@@ -1,6 +1,6 @@
FROM gitpod/workspace-full

ARG MAVEN_VERSION=3.9.5
ARG MAVEN_VERSION=3.9.6

RUN brew install gh && \
bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk default maven ${MAVEN_VERSION}"
4 changes: 2 additions & 2 deletions bom/pom.xml
Expand Up @@ -128,7 +128,7 @@ THE SOFTWARE.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.0</version>
<version>2.15.1</version>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
Expand Down Expand Up @@ -366,7 +366,7 @@ THE SOFTWARE.
<!-- provided by jcl-over-slf4j -->
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions cli/src/test/java/hudson/cli/PrivateKeyProviderTest.java
Expand Up @@ -42,7 +42,7 @@ private void assertKeyPairNotNull(File file, String password) throws IOException
}

/**
key command: ssh-keygen -f dsa-password -t dsa -b 1024 -m PEM -p password
key command: ssh-keygen -f dsa-password -t dsa -b 1024 -m PEM -P password
*/
@Test
public void loadKeyDSAPassword() throws IOException, GeneralSecurityException {
Expand All @@ -61,7 +61,7 @@ public void loadKeyRSA() throws IOException, GeneralSecurityException {
}

/**
key command: ssh-keygen -f rsa-password -t rsa -b 1024 -m PEM -p password
key command: ssh-keygen -f rsa-password -t rsa -b 1024 -m PEM -P password
*/
@Test
public void loadKeyRSAPassword() throws IOException, GeneralSecurityException {
Expand All @@ -80,7 +80,7 @@ public void loadKeyOpenSSH() throws IOException, GeneralSecurityException {
}

/**
key command: ssh-keygen -f openssh-unsupported -t rsa -b 1024 -m PKCS8 -p password
key command: ssh-keygen -f openssh-unsupported -t rsa -b 1024 -m PKCS8 -P password
*/
@Test
public void loadKeyOpenSSHPKCS8() throws IOException, GeneralSecurityException {
Expand Down
25 changes: 25 additions & 0 deletions core/src/main/java/hudson/ExtensionList.java
Expand Up @@ -459,6 +459,31 @@ public static <T> ExtensionList<T> create(Jenkins jenkins, Class<T> type) {
return all.get(0);
}

/**
* Convenience method allowing lookup of the instance of a given type with the highest ordinal.
* Equivalent to {@code ExtensionList.lookup(type).get(0)} if there is at least one instance,
* and throws an {@link IllegalStateException} otherwise if no instance could be found.
*
* @param type The type to look up.
* @return the singleton instance of the given type in its list.
* @throws IllegalStateException if there are no instances
*
* @since TODO
*/
public static @NonNull <U> U lookupFirst(Class<U> type) {
var all = lookup(type);
if (!all.isEmpty()) {
return all.get(0);
} else {
if (Main.isUnitTest) {
throw new IllegalStateException("Found no instances of " + type.getName() +
" registered (possible annotation processor issue); try using `mvn clean test -Dtest=…` rather than an IDE test runner");
} else {
throw new IllegalStateException("Found no instances of " + type.getName() + " registered");
}
}
}

/**
* Places to store static-scope legacy instances.
*/
Expand Down
8 changes: 1 addition & 7 deletions core/src/main/java/hudson/PluginManager.java
Expand Up @@ -1803,13 +1803,7 @@ public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, Ser
jenkins.checkPermission(Jenkins.ADMINISTER);

ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, req.getSubmittedForm());
if (pc.name == null) {
jenkins.proxy = null;
ProxyConfiguration.getXmlFile().delete();
} else {
jenkins.proxy = pc;
jenkins.proxy.save();
}
ProxyConfigurationManager.saveProxyConfiguration(pc);
return new HttpRedirect("advanced");
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ProxyConfiguration.java
Expand Up @@ -576,8 +576,8 @@ public FormValidation doValidateProxy(
}
try {
HttpResponse<Void> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.discarding());
if (httpResponse.statusCode() == HttpURLConnection.HTTP_OK) {
return FormValidation.ok(Messages.ProxyConfiguration_Success());
if (httpResponse.statusCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
return FormValidation.ok(Messages.ProxyConfiguration_Success(httpResponse.statusCode()));
}
return FormValidation.error(Messages.ProxyConfiguration_FailedToConnect(testUrl, httpResponse.statusCode()));
} catch (IOException e) {
Expand Down
72 changes: 72 additions & 0 deletions core/src/main/java/hudson/ProxyConfigurationManager.java
@@ -0,0 +1,72 @@
/*
* The MIT License
*
* Copyright (c) 2023, CloudBees Inc, and other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package hudson;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.model.Descriptor;
import java.io.IOException;
import jenkins.model.GlobalConfiguration;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;

@Extension @Restricted(NoExternalUse.class)
public class ProxyConfigurationManager extends GlobalConfiguration {

@NonNull
@Override
public String getDisplayName() {
return Messages.ProxyConfigurationManager_DisplayName();
}

public Descriptor<ProxyConfiguration> getProxyDescriptor() {
return Jenkins.get().getDescriptor(ProxyConfiguration.class);
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, json);
try {
saveProxyConfiguration(pc);
} catch (IOException e) {
throw new FormException(e.getMessage(), e, null);
}
return true;
}

public static void saveProxyConfiguration(ProxyConfiguration pc) throws IOException {
Jenkins jenkins = Jenkins.get();
if (pc.name == null) {
jenkins.proxy = null;
ProxyConfiguration.getXmlFile().delete();
} else {
jenkins.proxy = pc;
jenkins.proxy.save();
}
}

}
Expand Up @@ -114,6 +114,7 @@
* @author Kohsuke Kawaguchi
*/
public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRealm implements ModelObject, AccessControlled {
private static final int FIPS_PASSWORD_LENGTH = 14;
private static /* not final */ String ID_REGEX = System.getProperty(HudsonPrivateSecurityRealm.class.getName() + ".ID_REGEX");

/**
Expand Down Expand Up @@ -452,6 +453,11 @@ private SignupInfo validateAccountCreationForm(StaplerRequest req, boolean valid
si.errors.put("password1", Messages.HudsonPrivateSecurityRealm_CreateAccount_PasswordRequired());
}

if (FIPS140.useCompliantAlgorithms()) {
if (si.password1.length() < FIPS_PASSWORD_LENGTH) {
si.errors.put("password1", Messages.HudsonPrivateSecurityRealm_CreateAccount_FIPS_PasswordLengthInvalid());
}
}
if (si.fullname == null || si.fullname.isEmpty()) {
si.fullname = si.username;
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/slaves/Cloud.java
Expand Up @@ -331,7 +331,8 @@ public HttpResponse doConfigSubmit(StaplerRequest req, StaplerResponse rsp) thro
j.clouds.replace(this, result);
j.save();
// take the user back to the cloud top page.
return FormApply.success(".");
return FormApply.success("../" + result.name + '/');

}

public Cloud reconfigure(@NonNull final StaplerRequest req, JSONObject form) throws Descriptor.FormException {
Expand Down
9 changes: 8 additions & 1 deletion core/src/main/java/hudson/widgets/HistoryWidget.java
Expand Up @@ -32,6 +32,7 @@
import hudson.model.ModelObject;
import hudson.model.Queue;
import hudson.model.Run;
import hudson.util.AlternativeUiTextProvider;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -61,6 +62,12 @@
* @author Kohsuke Kawaguchi
*/
public class HistoryWidget<O extends ModelObject, T> extends Widget {

/**
* Replaceable title for describing the kind of tasks this history shows. Defaults to "Build History".
*/
public static final AlternativeUiTextProvider.Message<HistoryWidget<?, ?>> DISPLAY_NAME = new AlternativeUiTextProvider.Message<>();

/**
* The given data model of records. Newer ones first.
*/
Expand Down Expand Up @@ -115,7 +122,7 @@ protected String getOwnerUrl() {
* Title of the widget.
*/
public String getDisplayName() {
return Messages.BuildHistoryWidget_DisplayName();
return AlternativeUiTextProvider.get(DISPLAY_NAME, this, Messages.BuildHistoryWidget_DisplayName());
}

@Override
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/jenkins/agents/CloudSet.java
Expand Up @@ -231,7 +231,6 @@ private void handleNewCloudPage(Descriptor<Cloud> descriptor, String name, Stapl
checkName(name);
JSONObject formData = req.getSubmittedForm();
formData.put("name", name);
formData.put("cloudName", name); // ec2 uses that field name
formData.remove("mode"); // Cloud descriptors won't have this field.
req.setAttribute("instance", formData);
req.setAttribute("descriptor", descriptor);
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/resources/hudson/Messages.properties
Expand Up @@ -109,7 +109,7 @@ ProxyConfiguration.TestUrlRequired=Test URL is required.
ProxyConfiguration.MalformedTestUrl=Malformed Test URL {0}.
ProxyConfiguration.FailedToConnectViaProxy=Failed to connect to {0}.
ProxyConfiguration.FailedToConnect=Failed to connect to {0} (code {1}).
ProxyConfiguration.Success=Success
ProxyConfiguration.Success=Success (code {0})

Functions.NoExceptionDetails=No Exception details

Expand All @@ -127,3 +127,5 @@ PluginWrapper.NoSuchPlugin=No such plugin found with the name ''{0}''
PluginWrapper.Error.Disabling=There was an error disabling the ''{0}'' plugin. Error: ''{1}''
TcpSlaveAgentListener.PingAgentProtocol.displayName=Ping protocol

ProxyConfigurationManager.DisplayName=Proxy Configuration
ProxyConfigurationManager.Description=Configure the http proxy used by Jenkins
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_bg.properties
Expand Up @@ -88,7 +88,7 @@ ProxyConfiguration.FailedToConnectViaProxy=\
ProxyConfiguration.FailedToConnect=\
Неуспешна връзка към „{0}“ (код: {1}).
ProxyConfiguration.Success=\
Успех
Успех (код: {0})

Functions.NoExceptionDetails=\
Няма допълнителна информация за изключението.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_de.properties
Expand Up @@ -68,7 +68,7 @@ PluginWrapper.PluginWrapperAdministrativeMonitor.DisplayName=Plugin-Ladefehler
ProxyConfiguration.FailedToConnectViaProxy=Konnte nicht mit {0} verbinden.
ProxyConfiguration.FailedToConnect=Konnte nicht mit {0} verbinden (code {1}).
ProxyConfiguration.MalformedTestUrl=Format der Test-URL ungültig
ProxyConfiguration.Success=Erfolg
ProxyConfiguration.Success=Erfolg (code {0})
ProxyConfiguration.TestUrlRequired=Test-URL muss angegeben werden.

AboutJenkins.DisplayName=Über Jenkins
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_es.properties
Expand Up @@ -99,7 +99,7 @@ ProxyConfiguration.TestUrlRequired=Se requiere un URL de prueba.
ProxyConfiguration.MalformedTestUrl=La URL de prueba está mal formada.
ProxyConfiguration.FailedToConnectViaProxy=No se puede conectar a {0}.
ProxyConfiguration.FailedToConnect=No se puede conectar a {0} (código {1}).
ProxyConfiguration.Success=Configurado
ProxyConfiguration.Success=Configurado (código {0})

Functions.NoExceptionDetails=No hay detalles de la excepción

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_fr.properties
Expand Up @@ -109,7 +109,7 @@ ProxyConfiguration.TestUrlRequired=Une URL de test est requise.
ProxyConfiguration.MalformedTestUrl=L''URL de test {0} n''est pas correctement formée.
ProxyConfiguration.FailedToConnectViaProxy=Impossible de se connecter à {0}.
ProxyConfiguration.FailedToConnect=Impossible de se connecter à {0} (code {1}).
ProxyConfiguration.Success=Succès
ProxyConfiguration.Success=Succès (code {0})

Functions.NoExceptionDetails=Aucun détail concernant l''exception

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_it.properties
Expand Up @@ -106,7 +106,7 @@ PluginWrapper.PluginWrapperAdministrativeMonitor.DisplayName=Errore \
ProxyConfiguration.FailedToConnect=Impossibile connettersi a {0} (codice {1}).
ProxyConfiguration.FailedToConnectViaProxy=Impossibile connettersi a {0}.
ProxyConfiguration.MalformedTestUrl=URL di prova {0} malformato.
ProxyConfiguration.Success=Connessione riuscita
ProxyConfiguration.Success=Connessione riuscita (codice {0})
ProxyConfiguration.TestUrlRequired=È richiesto un URL di prova.
TcpSlaveAgentListener.PingAgentProtocol.displayName=Protocollo ping
Util.day={0} g
Expand Down

0 comments on commit d3e2920

Please sign in to comment.