Skip to content
Permalink
Browse files

[JENKINS-22637] [JENKINS-26810] Handle file modes.

  • Loading branch information...
jglick committed Feb 21, 2018
1 parent b3e6d53 commit e617d816465d0a85e67e784b0a92c2b36bc9acff
14 pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.37</version>
<version>3.4</version>
<relativePath />
</parent>

@@ -24,9 +24,9 @@
</licenses>

<properties>
<!-- To support (and test) @Symbol annotations (requires workflow-cps >= 2.10) -->
<jenkins.version>1.642.3</jenkins.version>
<java.level>7</java.level>
<jenkins-core.version>2.109-20180221.170307-1</jenkins-core.version> <!-- TODO https://github.com/jenkinsci/jenkins/pull/3302 -->
<jenkins-war.version>2.109-20180221.170329-1</jenkins-war.version>
<java.level>8</java.level>
</properties>

<dependencies>
@@ -35,7 +35,7 @@
<artifactId>maven-plugin</artifactId>
<version>2.7.1</version>
<optional>true</optional>
<exclusions>
<exclusions> <!-- TODO use 3.0 -->
<!-- See https://issues.jenkins-ci.org/browse/JENKINS-25625 -->
<exclusion>
<groupId>org.jenkins-ci</groupId>
@@ -57,6 +57,10 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -601,7 +601,7 @@ private static String normalizePattern(String p) {

private static void copyOne(Run<?,?> src, Run<?,?> dst, Map<String, String> fingerprints, VirtualFile s, FilePath d, MessageDigest md5) throws IOException, InterruptedException {
assert (fingerprints == null) == (md5 == null);
// TODO JENKINS-26810 handle symlinks and file attributes if supported
// TODO JENKINS-26810 handle symlinks
try {
try (InputStream is = s.open(); OutputStream os = d.write()) {
OutputStream os2;
@@ -619,6 +619,10 @@ private static void copyOne(Run<?,?> src, Run<?,?> dst, Map<String, String> fing
} catch (IOException x) {
LOGGER.warning(x.getMessage());
}
int mode = s.mode();
if (mode != -1) {
d.chmod(mode);
}
if (fingerprints != null) {
String digest = Util.toHexString(md5.digest());
FingerprintMap map = Jenkins.getActiveInstance().getFingerprintMap();
@@ -102,7 +102,7 @@ public boolean isSelectable(Run<?,?> run, EnvVars env) {
}
}
for (StringParameterValue spv : filters) {
if (!spv.value.equals(otherEnv.get(spv.getName()))) {
if (!spv.getValue().equals(otherEnv.get(spv.getName()))) {
return false;
}
}
@@ -65,7 +65,6 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

import jenkins.model.Jenkins;
import jenkins.security.QueueItemAuthenticatorConfiguration;
@@ -94,11 +93,13 @@
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.google.common.collect.Sets;
import jenkins.model.ArtifactManagerConfiguration;
import static org.hamcrest.Matchers.*;
import org.jenkinsci.plugins.compress_artifacts.CompressingArtifactManagerFactory;

import org.jvnet.hudson.test.TestBuilder;

import static org.junit.Assert.*;
import static org.junit.Assume.*;
import org.junit.Ignore;

/**
@@ -1671,20 +1672,9 @@ public void testWebConfiguration() throws Exception {
}
}

private boolean isFilePermissionSupported() throws Exception {
return rule.jenkins.getRootPath().mode() != -1;
}

@Ignore("TODO not yet (re-)implemented")
@Test
public void testFilePermission() throws Exception {
if (!isFilePermissionSupported()) {
Logger.getLogger(CopyArtifactTest.class.getName()).warning(String.format(
"Skipped %s as file permission is not supported on this platform",
name.getMethodName()
));
return;
}
assumeThat(rule.jenkins.getRootPath().mode(), not(-1));

FreeStyleProject copiee = rule.createFreeStyleProject();
FreeStyleBuild copieeBuild = copiee.scheduleBuild2(0).get();

0 comments on commit e617d81

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