Skip to content

Commit fc55861

Browse files
committed
[jenkins-slave] init commit
1 parent 43e2baf commit fc55861

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM coderobin/windows-build-uwp-461:latest
2+
MAINTAINER xied75@gmail.com
3+
4+
VOLUME C:/jenkins
5+
COPY StartSlave.ps1 C:/
6+
7+
RUN powershell -Command \
8+
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession; \
9+
$cookie = New-Object System.Net.Cookie; \
10+
$cookie.Name = \"oraclelicense\"; \
11+
$cookie.Value = \"accept-securebackup-cookie\"; \
12+
$cookie.Domain = \"edelivery.oracle.com\"; \
13+
$session.Cookies.Add($cookie); \
14+
wget -Uri \"https://edelivery.oracle.com/otn-pub/java/jdk/8u112-b15/jre-8u112-windows-x64.exe\" -WebSession $session -TimeoutSec 90 -MaximumRedirection 10 -OutFile jre-8u112-windows-x64.exe; \
15+
Start-Process -FilePath jre-8u112-windows-x64.exe -ArgumentList /s -PassThru -Wait; \
16+
rm \jre-8u112-windows-x64.exe;
17+
18+
ENTRYPOINT ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "c:\\StartSlave.ps1"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Design
2+
3+
As a Jenkins build slave to be connected to the Jenkins master, the bare minimum we need:
4+
5+
1. Something that can run build, e.g. in our case we choose *coderobin/windows-build-uwp-461* as starting point, since it can build C# portable library. We might choose other for different purpose.
6+
7+
2. The Java Runtime, i.e. JRE
8+
9+
3. The Jenkins slave jar, and neccessary information for the connection to be established
10+
11+
### Versioning
12+
13+
Current version **coderobin/jenkins-slave:2.19** does not really tie to Jenkins v2.19, because the slave jar is downloaded from master at runtime. But we used this tag merely because we made both at the same time. In future we might need a better naming scheme.
14+
15+
16+
### Example Usage
17+
18+
```
19+
docker run -d --ip 172.30.225.14 --name build-1 --hostname build-1 --restart=always -e "JENKINS_IP=172.30.225.13" -e "SECRET=REPLACE_WITH_REAL_SECRET" -e "SLAVE_NAME=build-1" -v C:\Users\dong\Documents\Deployments\volumes\jenkins_slave\jenkins:c:\jenkins coderobin/jenkins-slave:2.19
20+
```
21+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$jenkins_ip = (Get-Item env:JENKINS_IP).Value
2+
$secret = (Get-Item env:SECRET).Value
3+
$slave_name = (Get-Item env:SLAVE_NAME).Value
4+
5+
if (-not (Test-Path .\slave.jar)) {
6+
wget "http://$($jenkins_ip):8080/jnlpJars/slave.jar" -OutFile slave.jar
7+
}
8+
9+
java -jar slave.jar -jnlpUrl "http://$($jenkins_ip):8080/computer/$($slave_name)/slave-agent.jnlp" -secret $secret

0 commit comments

Comments
 (0)