-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into JENKINS-73677
- Loading branch information
Showing
5 changed files
with
62 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,14 +41,6 @@ | |
</roles> | ||
<url>http://rsandell.com</url> | ||
</developer> | ||
<developer> | ||
<id>mramonleon</id> | ||
<name>M Ramon Leon</name> | ||
<email>[email protected]</email> | ||
<roles> | ||
<role>developer</role> | ||
</roles> | ||
</developer> | ||
<developer> | ||
<id>olamy</id> | ||
<name>Olivier Lamy</name> | ||
|
@@ -89,7 +81,7 @@ | |
<dependency> | ||
<groupId>io.jenkins.tools.bom</groupId> | ||
<artifactId>bom-${jenkins.baseline}.x</artifactId> | ||
<version>3289.v3ff9637cd241</version> | ||
<version>3358.vea_fa_1f41504d</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
@@ -187,7 +179,6 @@ | |
<dependency> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>promoted-builds</artifactId> | ||
<version>892.vd6219fc0a_efb</version> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
|
@@ -250,7 +241,7 @@ | |
<dependency> | ||
<groupId>io.github.sparsick.testcontainers.gitserver</groupId> | ||
<artifactId>testcontainers-gitserver</artifactId> | ||
<version>0.8.0</version> | ||
<version>0.9.0</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package jenkins.plugins.git; | ||
|
||
import hudson.Functions; | ||
import hudson.remoting.VirtualChannel; | ||
import java.io.IOException; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.lib.StoredConfig; | ||
import org.jenkinsci.plugins.gitclient.RepositoryCallback; | ||
|
||
/** | ||
* Disables git hooks. This can get remotely executed on agents. | ||
*/ | ||
class DisableHooks implements RepositoryCallback<Object> { | ||
private static final long serialVersionUID = 1L; | ||
|
||
static final String DISABLED_WIN = "NUL:"; | ||
static final String DISABLED_NIX = "/dev/null"; | ||
|
||
@Override | ||
public Object invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException { | ||
final String VAL = Functions.isWindows() ? DISABLED_WIN : DISABLED_NIX; | ||
final StoredConfig repoConfig = repo.getConfig(); | ||
repoConfig.setString("core", null, "hooksPath", VAL); | ||
repoConfig.save(); | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package jenkins.plugins.git; | ||
|
||
import hudson.remoting.VirtualChannel; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.lib.StoredConfig; | ||
import org.jenkinsci.plugins.gitclient.RepositoryCallback; | ||
|
||
/** | ||
* Unsets git hooks. This can get remotely executed on agents. | ||
*/ | ||
class UnsetHooks implements RepositoryCallback<Object> { | ||
private static final Logger LOGGER = Logger.getLogger(UnsetHooks.class.getName()); | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public Object invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException { | ||
final StoredConfig repoConfig = repo.getConfig(); | ||
final String val = repoConfig.getString("core", null, "hooksPath"); | ||
if (val != null && !val.isEmpty() && !DisableHooks.DISABLED_NIX.equals(val) && !DisableHooks.DISABLED_WIN.equals(val)) { | ||
LOGGER.warning(() -> String.format("core.hooksPath explicitly set to %s and will be left intact on %s.", val, repo.getDirectory())); | ||
} else { | ||
repoConfig.unset("core", null, "hooksPath"); | ||
repoConfig.save(); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters