Skip to content

Commit

Permalink
Add extra switches to simplify excluding GoCD from the images or prov…
Browse files Browse the repository at this point in the history
…ide a different GO_SERVER_URL.
  • Loading branch information
chrisb2244 committed Aug 31, 2022
1 parent 2eb6e26 commit 8524aa8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ The Docker images (built using the files `Dockerfile.2019_32bit` and `Dockerfile
This is done to allow use with the [GoCD Continuous Delivery] system.\
If you want to use these images with Jenkins or other CI/CD systems/build orchestrators, then you should modify the Dockerfile.GoCD_Base to remove the `OpenJDK` section (unless you need the Java Development Kit for your other platform) and the `go-agent.ps1` script (which handles agent registration and task allocation). Additionally, the `CMD` line should be removed or modified.

The `buildAllContainers.ps1` script can incorporate these changes by passing the `-Exclude_GoCD` switch:
```
> .\buildAllContainers.ps1 -LABVIEW_SERIAL_NUMBER "A123B456" -Exclude_GoCD
```

## SSH Keys

SSH keys can be mounted into the container from the host, via the C:\Users\ContainerAdministrator\.ssh directory.\
Expand Down
13 changes: 10 additions & 3 deletions buildAllContainers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ Param(
[Parameter(Mandatory)]
[ValidatePattern("^[0-9A-z]*$")]
[string]
$LABVIEW_SERIAL_NUMBER
$LABVIEW_SERIAL_NUMBER,

[string] $GO_SERVER_URL,
[switch] $Exclude_GoCD
)

# Include or exclude GoCD from the images
$INCLUDE_GOCD=$true # $false
$INCLUDE_GOCD=!$Exclude_GoCD
# Here 'vEthernet (nat)' is the name for the network on which the Windows Docker containers run by default.
# If your GoCD server is on a different host, set this IP address differently.
# The URL should end with the port, and then /go (http://<ip-address-or-hostname>:<port>/go)
$GO_SERVER_URL=(Get-NetIPAddress -InterfaceAlias "vEthernet (nat)" -AddressFamily "IPv4").IPAddress+':8153/go'
If (! $GO_SERVER_URL) {
Write-Verbose "Using Get-NetIPAddress to determine host IP address to use for GoCD Server"
$GO_SERVER_URL='http://' + (Get-NetIPAddress -InterfaceAlias "vEthernet (nat)" -AddressFamily "IPv4").IPAddress+':8153/go'
Write-Verbose "Setting GO_SERVER_URL = '$GO_SERVER_URL'"
}

# Set up variables for the tag names.
# A 'latest' tag is also added (this is convenient for 'auto-updating' on the build system without changes to configuration),
Expand Down

0 comments on commit 8524aa8

Please sign in to comment.