Start delivery agent directly with secret file for #24
Scrap-Web/pipeline/head This commit looks good
Scrap-Web/pipeline/head This commit looks good
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
# Secrets and host-specific values stay on the Droplet
|
# Secrets and host-specific values stay on the Droplet
|
||||||
|
jenkins-agent.secret
|
||||||
agent.secrets.env
|
agent.secrets.env
|
||||||
.env
|
.env
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# Copy to agent.secrets.env on the Droplet (chmod 600). Never commit the real file.
|
|
||||||
JENKINS_SECRET=PASTE_FROM_JENKINS_NODE_PAGE
|
|
||||||
+16
-6
@@ -8,17 +8,27 @@ services:
|
|||||||
image: ssw590/jenkins-delivery-agent:1
|
image: ssw590/jenkins-delivery-agent:1
|
||||||
container_name: jenkins-agent
|
container_name: jenkins-agent
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: [agent.secrets.env] # JENKINS_SECRET only; not in Git
|
# Start agent.jar directly. The secret is read from a file (-secret @file),
|
||||||
environment:
|
# so it never appears in the process list, docker inspect, or Git.
|
||||||
JENKINS_URL: "http://jenkins:8080/"
|
entrypoint:
|
||||||
JENKINS_AGENT_NAME: "delivery-agent"
|
- java
|
||||||
JENKINS_WEB_SOCKET: "true"
|
- -jar
|
||||||
JENKINS_AGENT_WORKDIR: "/home/jenkins/agent"
|
- /usr/share/jenkins/agent.jar
|
||||||
|
- -url
|
||||||
|
- http://jenkins:8080/
|
||||||
|
- -webSocket
|
||||||
|
- -name
|
||||||
|
- delivery-agent
|
||||||
|
- -workDir
|
||||||
|
- /home/jenkins/agent
|
||||||
|
- -secret
|
||||||
|
- "@/run/secrets/jenkins-agent-secret"
|
||||||
# Host Docker socket: needed to build/push images. This is effectively root
|
# Host Docker socket: needed to build/push images. This is effectively root
|
||||||
# on the Droplet, so only reviewed main-branch delivery jobs may use this agent.
|
# on the Droplet, so only reviewed main-branch delivery jobs may use this agent.
|
||||||
group_add: ["${DOCKER_GID:?set DOCKER_GID in .env}"]
|
group_add: ["${DOCKER_GID:?set DOCKER_GID in .env}"]
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./jenkins-agent.secret:/run/secrets/jenkins-agent-secret:ro
|
||||||
- agent_home:/home/jenkins # workspace, known_hosts, registry login
|
- agent_home:/home/jenkins # workspace, known_hosts, registry login
|
||||||
networks: [gitea-net]
|
networks: [gitea-net]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user