Skip to content

Commit

Permalink
Set safe.directory in `WithMavenStepTest.tesWithDifferentJavasForBu…
Browse files Browse the repository at this point in the history
…ild` (#796)
  • Loading branch information
jglick authored May 28, 2024
1 parent faea755 commit 54f125b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.jvnet.hudson.test.Issue;
import org.testcontainers.containers.ExecConfig;
import org.testcontainers.containers.ExecInContainerPattern;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.MountableFile;

Expand Down Expand Up @@ -142,6 +144,15 @@ public void tesWithDifferentJavasForBuild(String jdkName, String jdkPath) throws
String gitRepoPath = this.gitRepoRule.toString();
javasContainerRule.copyFileToContainer(MountableFile.forHostPath(gitRepoPath), "/tmp/gitrepo");
javasContainerRule.execInContainer("chmod", "-R", "777", "/tmp/gitrepo");
System.out.println(ExecInContainerPattern.execInContainer(
javasContainerRule.getDockerClient(),
javasContainerRule.getContainerInfo(),
ExecConfig.builder()
.user("test")
.command(new String[] {
"git", "config", "--global", "--add", "safe.directory", "/tmp/gitrepo/.git"
})
.build()));
registerAgentForContainer(javasContainerRule);
ToolLocationNodeProperty.ToolLocation toolLocation =
new ToolLocationNodeProperty.ToolLocation(new JDK.DescriptorImpl(), jdkName, jdkPath);
Expand Down

0 comments on commit 54f125b

Please sign in to comment.