Skip to content

Commit

Permalink
ansible: use non-deprecated way to connect Jenkins agents
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored and richardlau committed Mar 18, 2024
1 parent 204bd32 commit 24e1beb
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ansible/aix61-standalone/resources/S20jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ start )
export SSL_CERT_FILE="$HOME/ca-bundle.crt"; \
java -Xmx128m -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=30 -jar "$HOME/agent.jar" \
-secret {{secret}} \
-jnlpUrl https://ci.nodejs.org/computer/{{id}}/jenkins-agent.jnlp >$jenkins_log_file 2>&1 &'
-url https://ci.nodejs.org -name {{id}} >$jenkins_log_file 2>&1 &'
;;
stop )
;;
Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/alpine315.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/alpine318.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/centos7.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/debian11_armv7l.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/rhel8.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ CMD cd /home/{{ server_user }} \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/rhel8_arm_cross.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ CMD cd /home/{{ server_user }} \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/ubi81.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/ubuntu1604.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ CMD cd /home/{{ server_user }} \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/ubuntu1804.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ CMD cd /home/{{ server_user }} \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
3 changes: 2 additions & 1 deletion ansible/roles/docker/templates/ubuntu2004.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,6 @@ CMD cd /home/iojs \
&& curl https://ci.nodejs.org/jnlpJars/agent.jar -O \
&& java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ item.name }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ item.name }} \
-secret {{ item.secret }}
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker-windows/templates/jenkins.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ C:
cd \
:start
curl -L {{ jenkins_agent_jar }} -o {{ agent_path }}
java -Dhudson.remoting.Launcher.pingIntervalSec=10 -jar {{ agent_path }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp -secret {{ secret }}
java -Dhudson.remoting.Launcher.pingIntervalSec=10 -jar {{ agent_path }} -url {{ jenkins_url }} -name {{ inventory_hostname }} -secret {{ secret }}
echo Restarting Jenkins...
goto start
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/templates/aix.rc2.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ start )
export JOBS={{ jobs_env }}; \
/usr/bin/java -Xmx128m -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=30 -jar "$HOME/agent.jar" \
-secret {{secret}} \
-jnlpUrl {{jenkins_url}}/computer/{{inventory_hostname}}/jenkins-agent.jnlp >$jenkins_log_file 2>&1 &'
-url {{jenkins_url}} -name {{inventory_hostname}} >$jenkins_log_file 2>&1 &'
;;
stop )
;;
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/templates/freebsd.initd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jenkins_env=" \
jenkins_jar="/home/{{ server_user }}/agent.jar"
jenkins_log_file="/home/{{ server_user }}/${name}_console.log"
jenkins_args="-Xmx{{ server_ram|default('128m') }} -jar ${jenkins_jar} \
-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} -name {{ inventory_hostname }} \
-secret {{ secret }}"
jenkins_user="{{ server_user }}"
jenkins_group="{{ server_user }}"
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/templates/ibmi_start.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ echo "done"

########################### Now start our agent

export START_CMD="{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} -Dos400.stdio.convert=N -Djava.net.preferIPv4Stack=true -jar {{ home }}/{{ server_user }}/agent.jar -secret {{ secret }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp >{{ home }}/{{ server_user }}/jenkins.log 2>&1 "
export START_CMD="{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} -Dos400.stdio.convert=N -Djava.net.preferIPv4Stack=true -jar {{ home }}/{{ server_user }}/agent.jar -secret {{ secret }} -url {{ jenkins_url }} -name {{ inventory_hostname }} >{{ home }}/{{ server_user }}/jenkins.log 2>&1 "
echo $START_CMD
exec /QOpenSys/usr/bin/system -v -kpiveO "SBMJOB CMD(QSH CMD('echo starting Jenkins agent && cd $HOME && env && touch $HOME/jenkins.log && setccsid 1208 $HOME/jenkins.log && exec $START_CMD')) CPYENVVAR(*YES) PRTDEV(*USRPRF) ALWMLTTHD(*YES) $SBMJOB_OPTS"
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<exec_method type='method'
name='start'
exec='{{ java_path[os] }} -Dsun.security.pkcs11.enable-solaris=false -Xmx{{ server_ram|default('128m') }} -jar /home/{{ server_user }}/agent.jar -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp -secret {{ secret }}'
exec='{{ java_path[os] }} -Dsun.security.pkcs11.enable-solaris=false -Xmx{{ server_ram|default('128m') }} -jar /home/{{ server_user }}/agent.jar -url {{ jenkins_url }} -name {{ inventory_hostname }} -secret {{ secret }}'
timeout_seconds='30' />

<exec_method type="method"
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/templates/start.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export PATH="/usr/local/opt/python3/Frameworks/Python.framework/Versions/Current
export PATH="$(brew --prefix)/opt/ccache/libexec:$PATH"
{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} \
-jar {{ home }}/{{ server_user }}/agent.jar -secret {{ secret }} \
-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp
-url {{ jenkins_url }} -name {{ inventory_hostname }}
3 changes: 2 additions & 1 deletion ansible/roles/jenkins-worker/templates/systemd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ Environment="ARCH={{ arch }}"

ExecStart=/usr/bin/java -Xmx{{ server_ram|default('128m') }} \
-jar /home/{{ server_user }}/agent.jar \
-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp \
-url {{ jenkins_url }} \
-name {{ inventory_hostname }} \
-secret {{ secret }}
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/templates/zos_start.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export LDFLAGS="-q64"
{{ java_path[os] }} -Dfile.encoding=ISO8859_1 -Xmx{{ server_ram|default('128m') }} \
-jar {{ home }}/{{ server_user }}/agent.jar -secret {{ secret }} \
-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/jenkins-agent.jnlp >{{ home }}/{{ server_user }}/jenkins.log 2>&1 &
-url {{ jenkins_url }} -name {{ inventory_hostname }} >{{ home }}/{{ server_user }}/jenkins.log 2>&1 &
EOF

0 comments on commit 24e1beb

Please sign in to comment.