Skip to content

Commit

Permalink
Set working directory for the bootstrap script (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
APErebus authored Dec 4, 2023
1 parent 164fc0d commit 4c5f233
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion source/Octopus.Tentacle/Kubernetes/bootstrapRunner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ shift
exec > >(logStdOut)
exec 2> >(logStdErr >&2)

/bin/bash $BOOTSTRAP_SCRIPT "$@"
# Change cwd to the working directory
cd "$WORK_DIR" || return

/bin/bash "$BOOTSTRAP_SCRIPT" "$@"

# Write a message to say the job has completed
echo "##octopus[stdout-verbose]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,22 @@ async Task CreateJob(IScriptLogWriter writer, CancellationToken cancellationToke
Command = new List<string> { "bash" },
Args = new List<string>
{
$"/data/tentacle-home/Work/{scriptTicket.TaskId}/bootstrapRunner.sh",
$"/data/tentacle-home/Work/{scriptTicket.TaskId}",
$"/data/tentacle-home/Work/{scriptTicket.TaskId}/{scriptName}"
$"/octopus/Work/{scriptTicket.TaskId}/bootstrapRunner.sh",
$"/octopus/Work/{scriptTicket.TaskId}",
$"/octopus/Work/{scriptTicket.TaskId}/{scriptName}"
}.Concat((workspace.ScriptArguments ?? Array.Empty<string>())
.SelectMany(arg => new[]
{
$"'{arg}'"
})).ToList(),
VolumeMounts = new List<V1VolumeMount>
{
new("/data/tentacle-home", "tentacle-home"),
new("/octopus", "tentacle-home"),
},
Env = new List<V1EnvVar>
{
new(EnvironmentVariables.TentacleHome, $"/data/tentacle-home"),
new(EnvironmentVariables.TentacleJournal, $"/data/tentacle-home/DeploymentJournal.xml"),
new(EnvironmentVariables.TentacleHome, $"/octopus"),
new(EnvironmentVariables.TentacleJournal, $"/octopus/DeploymentJournal.xml"),
new(EnvironmentVariables.TentacleInstanceName, instanceName),
new(EnvironmentVariables.TentacleVersion, Environment.GetEnvironmentVariable(EnvironmentVariables.TentacleVersion)),
new(EnvironmentVariables.TentacleCertificateSignatureAlgorithm, Environment.GetEnvironmentVariable(EnvironmentVariables.TentacleCertificateSignatureAlgorithm)),
Expand Down

0 comments on commit 4c5f233

Please sign in to comment.