nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests |Archive

commit 9113197da3b7a67ce2023eb19b17282e580a16d1
parent f13627f96bda028927f4b98057d5d78045f49d81
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Thu, 11 Sep 2025 21:56:47 +0200

feat(jenkins): add exec worker

Diffstat:
Mhcl/default/jenkins/jenkins.nomad | 1+
Mhcl/default/jenkins/templates/jenkins.yaml.tmpl | 64+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/hcl/default/jenkins/jenkins.nomad b/hcl/default/jenkins/jenkins.nomad @@ -89,6 +89,7 @@ job "jenkins" { env { JAVA_OPTS = "-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false -Dorg.apache.commons.jelly.tags.fmt.timeZone=Europe/Zurich -Dhudson.model.UsageStatistics.disabled=true -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true" + REMOTING_VERSION = "3327.v868139a_d00e0" } config { diff --git a/hcl/default/jenkins/templates/jenkins.yaml.tmpl b/hcl/default/jenkins/templates/jenkins.yaml.tmpl @@ -103,7 +103,7 @@ jenkins: "/home/jenkins/workspace:/home/jenkins/workspace" ], "force_pull": true, - "image": "127.0.0.1:5000/jenkins-inbound-agent:3327.v868139a_d00e0-v9" + "image": "127.0.0.1:5000/jenkins-inbound-agent:${REMOTING_VERSION}" }, "Env": { "REMOTING_OPTS": "-url http://{{ env "NOMAD_ADDR_jenkins" }} -name %WORKER_NAME% -secret %WORKER_SECRET% -tunnel {{ env "NOMAD_ADDR_jnlp" }}", @@ -127,6 +127,68 @@ jenkins: numExecutors: 1 prefix: "jenkins-podman" reusable: true + - idleTerminationInMinutes: 10 + jobTemplate: |- + { + "Job": { + "Region": "global", + "ID": "%WORKER_NAME%", + "Namespace": "default", + "Type": "service", + "Datacenters": [ + "dc1" + ], + "TaskGroups": [ + { + "Name": "jenkins-packer-worker-taskgroup", + "Count": 1, + "RestartPolicy": { + "Attempts": 0, + "Interval": 10000000000, + "Mode": "fail", + "Delay": 1000000000 + }, + "Tasks": [ + { + "Name": "jenkins-packer-worker", + "Driver": "exec", + "User": "jenkins", + "Config": { + "command": "/bin/sh", + "args": [ + "-c", + "java -jar ./${NOMAD_TASK_DIR}/remoting-${REMOTING_VERSION}.jar -url http://{{ env "NOMAD_ADDR_jenkins" }} -name %WORKER_NAME% -secret %WORKER_SECRET% -tunnel {{ env "NOMAD_ADDR_jnlp" }} $@" + ] + }, + "Artifacts": [ + { + "Chown": false, + "GetterHeaders": null, + "GetterInsecure": false, + "GetterMode": "any", + "GetterOptions": null, + "GetterSource": "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${REMOTING_VERSION}/remoting-${REMOTING_VERSION}.jar", + "RelativeDest": "${NOMAD_TASK_DIR}" + } + ], + "Resources": { + "CPU": 500, + "MemoryMB": 512, + "MemoryMaxMB": 1024 + } + } + ], + "EphemeralDisk": { + "SizeMB": 300 + } + } + ] + } + } + labels: "nomad packer" + numExecutors: 1 + prefix: "jenkins-packer" + reusable: true workerTimeout: 1 # Configuration example for the Docker cloud to spawn Jenkins agents directly # in Docker containers without intermediary Nomad jobs: