Skip to content

Commit

Permalink
Update to documentation and applying spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
rhit-gawronja committed Apr 17, 2024
1 parent ae92de6 commit 5dfe120
Show file tree
Hide file tree
Showing 268 changed files with 8,588 additions and 7,280 deletions.
16 changes: 16 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,21 @@ Inverse::
This is useful, for example, when you have jobs building your master and various release branches and you want a second job which builds all new feature branches.
For example, branches which do not match these patterns without redundantly building master and the release branches again each time they change.

[#firstBuildBehavior]
==== First Build Changelog behavior

image:/images/git-extension-for-first-build.png[First Build Changelog behavior]

The Jenkins git plugin provides an option to trigger pipeline build process on the first commit on a branch. By default, no changelog is generated causing any pipeline process to not be triggered but with this option selected changes are found between the new branch and its parent commit.

[source,groovy]
----
checkout scmGit(branches: [[name: 'master']],
extensions: [firstBuildChangelog()],
userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])
----
[#merge-extensions]
=== Merge Extensions

Expand Down Expand Up @@ -1424,6 +1439,7 @@ For example, they might choose to place the cache directories in `/var/cache/jen

The default git cache directory location can be overridden by setting the property `jenkins.plugins.git.AbstractGitSCMSource.cacheRootDir=/var/cache/jenkins`.


[#git-publisher]
== Git Publisher

Expand Down
130 changes: 65 additions & 65 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
<id>rsandell</id>
<name>Robert Sandell</name>
<email>[email protected]</email>
<url>http://rsandell.com</url>
<roles>
<role>developer</role>
</roles>
<url>http://rsandell.com</url>
</developer>
<developer>
<id>mramonleon</id>
Expand All @@ -54,10 +54,10 @@
<name>Olivier Lamy</name>
<email>[email protected]</email>
<url>https://about.me/olamy</url>
<timezone>Australia/Brisbane</timezone>
<roles>
<role>developer</role>
</roles>
<timezone>Australia/Brisbane</timezone>
</developer>
</developers>

Expand Down Expand Up @@ -95,67 +95,88 @@
</dependencies>
</dependencyManagement>
<dependencies>
<!-- JCasC compatibility -->
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<artifactId>credentials</artifactId>
</dependency>
<!--Credential Binding Plugin-->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-client</artifactId>
<artifactId>credentials-binding</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<artifactId>git-client</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-credentials</artifactId>
<artifactId>mailer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<artifactId>matrix-project</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<!-- we contribute AbstractBuildParameters for Git if it's available -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<artifactId>parameterized-trigger</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>promoted-builds</artifactId>
<version>3.11</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<optional>true</optional>
<artifactId>ssh-credentials</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<artifactId>structs</artifactId>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<artifactId>token-macro</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>io.jenkins.plugins</groupId>
<artifactId>pipeline-groovy-lib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -164,32 +185,21 @@
<version>3.16.1</version>
<scope>test</scope>
</dependency>
<!--Credential Binding Plugin-->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials-binding</artifactId>
</dependency>
<dependency>
<!-- we contribute AbstractBuildParameters for Git if it's available -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>parameterized-trigger</artifactId>
<optional>true</optional>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<optional>true</optional>
<artifactId>git-tag-message</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>promoted-builds</artifactId>
<version>3.11</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<classifier>tests</classifier>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -200,12 +210,13 @@
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<artifactId>workflow-basic-steps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<artifactId>workflow-cps</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -215,34 +226,23 @@
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>pipeline-groovy-lib</artifactId>
<artifactId>workflow-job</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-tag-message</artifactId>
<version>1.7.1</version>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<scope>test</scope>
</dependency>
<!-- JCasC compatibility -->
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/hudson/plugins/git/ApiTokenPropertyConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@
import hudson.Util;
import hudson.model.PersistentDescriptor;
import hudson.util.HttpResponses;
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import jenkins.model.Jenkins;
import net.jcip.annotations.GuardedBy;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;

import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
Expand All @@ -29,7 +17,17 @@
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;

import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import jenkins.model.Jenkins;
import net.jcip.annotations.GuardedBy;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;

@Extension
@Restricted(NoExternalUse.class)
Expand Down Expand Up @@ -75,7 +73,8 @@ public JSONObject generateApiToken(@NonNull String name) {
String plainTextApiToken = Util.toHexString(random);
assert plainTextApiToken.length() == 32;

String apiTokenValueHashed = Util.toHexString(hashedBytes(plainTextApiToken.getBytes(StandardCharsets.US_ASCII)));
String apiTokenValueHashed =
Util.toHexString(hashedBytes(plainTextApiToken.getBytes(StandardCharsets.US_ASCII)));
HashedApiToken apiToken = new HashedApiToken(name, apiTokenValueHashed);

synchronized (this) {
Expand Down Expand Up @@ -172,7 +171,8 @@ private boolean match(byte[] hashedBytes) {
try {
hashFromHex = Util.fromHexString(hash);
} catch (NumberFormatException e) {
LOGGER.log(Level.INFO, "The API token with name=[{0}] is not in hex-format and so cannot be used", name);
LOGGER.log(
Level.INFO, "The API token with name=[{0}] is not in hex-format and so cannot be used", name);
return false;
}

Expand Down
Loading

0 comments on commit 5dfe120

Please sign in to comment.