Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xxkel sd/multiple spaces #378

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions docker/linux/scripts/configure-tentacle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,25 @@ function registerTentacle() {
tentacle "${ARGS[@]}"
}

echo "==============================================="
echo "Configuring Octopus Deploy Tentacle"

validateVariables

echo "==============================================="

configureTentacle
registerTentacle
if [[ -z "${ConfigDir}" ]]; then
echo "==============================================="
echo "Configuring Octopus Deploy Tentacle"
validateVariables
echo "==============================================="
configureTentacle
registerTentacle
else
echo "==============================================="
echo "Configuring Octopus Deploy Tentacle"
echo "==============================================="
configureTentacle
for filename in $(realpath ${CONFIG_DIR}/*.conf); do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should ${CONFIG_DIR} be ${ConfigDir} like line 215?

echo "processing $filename"
. $filename
validateVariables
registerTentacle
done
fi

touch $alreadyConfiguredSemaphore

Expand Down
9 changes: 9 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ docker run --publish 10931:10933 --tty --interactive --env "ListeningPort=10931"
- **ListeningPort**: The port that the Octopus Server will connect back to the Tentacle with. Defaults to 10933. Implies a listening Tentacle.
- **PublicHostNameConfiguration**: How the url that the Octopus server will use to communicate with the Tentacle is determined. Can be `PublicIp`, `FQDN`, `ComputerName` or `Custom`. Defaults to `PublicIp`.
- **CustomPublicHostName**: If `PublicHostNameConfiguration` is set to `Custom`, the host name that the Octopus Server should use to communicate with the Tentacle.
- **ConfigDir**: If specified all files matching *.conf in this directory will be used for configuring the tentacle. Each .conf file allows overriding the environment variables specified for the container. If there's no override the environment variable for the container will be used. This will allow for multiple configurations of the same tentacle and could be used for registering the same tentacle in multiple spaces.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **ConfigDir**: If specified all files matching *.conf in this directory will be used for configuring the tentacle. Each .conf file allows overriding the environment variables specified for the container. If there's no override the environment variable for the container will be used. This will allow for multiple configurations of the same tentacle and could be used for registering the same tentacle in multiple spaces.
- **ConfigDir**: Allows registering multiple configurations of the same Tentacle. If specified, all files matching `*.conf` in this directory will be used to configure and register a Tentacle. Each `.conf` file allows overriding the environment variables specified for the container. A new configuration will be created for each `.conf` file. Any environment variables with no override will default to the container-level environment variable value. This can be used for registering the same Tentacle in multiple spaces.


#### Example on a .conf file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Example on a .conf file:
#### Example .conf file:

```
Space=MySpace
TargetName=Testing
TargetWorkerPool=MyWorkerPool
```


### Ports

Expand Down
29 changes: 25 additions & 4 deletions docker/windows/Scripts/configure-tentacle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ function Register-Tentacle(){
Execute-Command $TentacleExe $arg $mask;
}

function ConfigureFromFile($content) {
Get-Content $_ | Foreach-Object{
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
Validate-Variables
Register-Tentacle
}

try
{
Write-Log "==============================================="
Expand All @@ -309,11 +318,23 @@ try
exit 0
}

Validate-Variables
Write-Log "==============================================="
if($ConfigDir -eq $null) {
Validate-Variables
Write-Log "==============================================="

Configure-Tentacle
Register-Tentacle
} else {
if (!(Test-Path -Path $ConfigDir)) {
throw "Config directory ($ConfigDir) doesn't exist!"
}
Configure-Tentacle
Get-ChildItem $ConfigDir -Filter *.conf |
Foreach-Object {
ConfigureFromFile $_
}
}

Configure-Tentacle
Register-Tentacle
"Configuration complete." | Set-Content "c:\octopus-configuration.initstate"

Write-Log "Configuration successful."
Expand Down