-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6 - Support Unix OS - update TC ref to 10.0.3
- Loading branch information
nik
authored and
nik
committed
Nov 18, 2016
1 parent
77b0706
commit bdc2e4a
Showing
11 changed files
with
129 additions
and
61 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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
#!/bin/bash | ||
|
||
user="testuser" | ||
password="Catcat01" | ||
echo param1=$1 | ||
echo param2=$2 | ||
echo param3=$3 | ||
|
||
if [ $# = "0" ]; then | ||
echo -e "$password\n" | sudo --preserve-env --set-home --user $user --stdin ./command.sh | ||
fi | ||
args=$(cat "$1") | ||
command=$2 | ||
password=$3 | ||
|
||
echo args=$args | ||
echo command=$command | ||
echo password=$password | ||
|
||
echo -e "$password\n" | sudo --preserve-env --set-home --stdin $args $command | ||
#sudo --preserve-env -set-home --stdin $args #scommand |
30 changes: 30 additions & 0 deletions
30
runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/ExecutableFilePublisher.java
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 jetbrains.buildServer.runAs.agent; | ||
|
||
import java.io.File; | ||
import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineExecutionContext; | ||
import jetbrains.buildServer.dotNet.buildRunner.agent.ResourcePublisher; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ExecutableFilePublisher implements ResourcePublisher { | ||
|
||
private final FileAccessService myFileAccessService; | ||
private final ResourcePublisher myBeforeBuildPublisher; | ||
|
||
public ExecutableFilePublisher( | ||
@NotNull final FileAccessService fileAccessService, | ||
@NotNull final ResourcePublisher beforeBuildPublisher) { | ||
myFileAccessService = fileAccessService; | ||
myBeforeBuildPublisher = beforeBuildPublisher; | ||
} | ||
|
||
@Override | ||
public void publishBeforeBuildFile(@NotNull final CommandLineExecutionContext executionContext, @NotNull final File file, @NotNull String content) { | ||
myBeforeBuildPublisher.publishBeforeBuildFile(executionContext, file, content); | ||
myFileAccessService.makeExecutableForAll(file); | ||
} | ||
|
||
@Override | ||
public void publishAfterBuildArtifactFile(@NotNull final CommandLineExecutionContext executionContext, @NotNull final File file) { | ||
myBeforeBuildPublisher.publishAfterBuildArtifactFile(executionContext, file); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/FileAccessService.java
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,10 @@ | ||
package jetbrains.buildServer.runAs.agent; | ||
|
||
import java.io.File; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface FileAccessService { | ||
public void makeExecutableForAll(@NotNull final File executableFile); | ||
|
||
public void makeExecutableForMe(@NotNull final File executableFile); | ||
} |
29 changes: 29 additions & 0 deletions
29
runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/FileAccessServiceImpl.java
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,29 @@ | ||
package jetbrains.buildServer.runAs.agent; | ||
|
||
import com.intellij.openapi.diagnostic.Logger; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import jetbrains.buildServer.util.TCStreamUtil; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class FileAccessServiceImpl implements FileAccessService { | ||
private static final Logger LOG = Logger.getInstance(FileAccessServiceImpl.class.getName()); | ||
|
||
@Override | ||
public void makeExecutableForAll(@NotNull final File executableFile) { | ||
try { | ||
TCStreamUtil.setFileMode(executableFile, "a+x"); | ||
} catch (IOException e) { | ||
LOG.error(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void makeExecutableForMe(@NotNull final File executableFile) { | ||
try { | ||
TCStreamUtil.setFileMode(executableFile, "+x"); | ||
} catch (IOException e) { | ||
LOG.error(e); | ||
} | ||
} | ||
} |
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
32 changes: 0 additions & 32 deletions
32
runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/SettingsPublisher.java
This file was deleted.
Oops, something went wrong.
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
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
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