Skip to content

Commit 068b2c5

Browse files
committed
Extracted the downloads dir to 'JENKINS_AGENT_DOWNLOADS_DIR' variable and exposed it as env var for later use by pipelines.
1 parent cc0e5f8 commit 068b2c5

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

docker/jenkins/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ JENKINS_MEMORY_RESERVATION=1G
3535
JENKINS_AGENT_REMOTEFS=/home/jenkins/agent
3636
JENKINS_AGENT_WORKSPACE_DIR=${JENKINS_AGENT_REMOTEFS}/workspace
3737
JENKINS_AGENT_SHARED_METADATA_DIR=/home/jenkins/shared-metadata
38+
JENKINS_AGENT_DOWNLOADS_DIR=${JENKINS_AGENT_WORKSPACE_DIR}/downloads
3839

3940
######################### Externally Injected Variables Start ###############################
4041
# These vars are passed through the `docker compose up` command externally,

docker/jenkins/casc_configs/05-clouds-docker-agents.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jenkins:
5858
# to the dind container’s filesystem.
5959
# - "type=bind,src=${JENKINS_AGENT_WORKSPACE_DIR}/SymbioDeployHub,dst=${JENKINS_AGENT_WORKSPACE_DIR}/SymbioDeployHub"
6060
- "type=bind,src=${DOCKER_CERT_PATH},dst=${DOCKER_CERT_PATH},readonly"
61+
- "type=bind,src=${JENKINS_AGENT_DOWNLOADS_DIR},dst=${JENKINS_AGENT_DOWNLOADS_DIR}"
6162
- "type=bind,src=${JENKINS_AGENT_WORKSPACE_DIR},dst=${JENKINS_AGENT_WORKSPACE_DIR}"
6263
environment:
6364
# This tells Docker CLI commands running inside the agent container where to find the Docker daemon.

docker/jenkins/casc_configs/dsl/jobs/seed-ansible-playbook-jobs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
}
2828
2929
environmentVariables {
30+
env('JENKINS_AGENT_DOWNLOADS_DIR', "${JENKINS_AGENT_DOWNLOADS_DIR}")
3031
env('JENKINS_AGENT_SHARED_METADATA_DIR', "${JENKINS_AGENT_SHARED_METADATA_DIR}")
3132
}
3233

docker/jenkins/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
- JENKINS_SLAVE_AGENT_PORT=${JENKINS_SLAVE_AGENT_PORT}
3131
- JENKINS_JCASC_SECRETS_DIR=${JENKINS_JCASC_SECRETS_DIR}
3232
- JENKINS_AGENT_WORKSPACE_DIR=${JENKINS_AGENT_WORKSPACE_DIR}
33+
- JENKINS_AGENT_DOWNLOADS_DIR=${JENKINS_AGENT_DOWNLOADS_DIR}
3334
- JENKINS_DOCKER_AGENT_IMAGE_PATH=${JENKINS_DOCKER_AGENT_IMAGE_PATH}
3435
- JENKINS_AGENT_SHARED_METADATA_DIR=${JENKINS_AGENT_SHARED_METADATA_DIR}
3536
volumes:
@@ -95,10 +96,11 @@ services:
9596
# Mounting the tomcat_downloads folder containing the tomcat upgrade zip files
9697
# The zip file will be copied manually to the jenkins server
9798
# scp -r -i ~/.ssh/remote_servers_rsa_pri ~/Downloads/tomcat_downloads muhammad.faisal@172.31.0.73:/tmp
98-
- /tmp/tomcat_downloads:${JENKINS_AGENT_WORKSPACE_DIR}/tomcat_downloads
99+
# But remember, if you recreate the /tmp/tomcat_downloads dir, the container won't see the new folder until restarted.
100+
- /tmp/tomcat_downloads:${JENKINS_AGENT_DOWNLOADS_DIR}
99101
- ./certs/registry.crt:/usr/local/share/ca-certificates/registry.crt:ro
100102
# chown to ensure Jenkins agent can write to shared volume (owned by UID 1000, i.e. the Jenkins user)
101-
command: sh -c "update-ca-certificates && chown -R 1000:1000 ${JENKINS_AGENT_WORKSPACE_DIR} ${JENKINS_AGENT_SHARED_METADATA_DIR} && dockerd-entrypoint.sh"
103+
command: sh -c "update-ca-certificates && chown -R 1000:1000 ${JENKINS_AGENT_DOWNLOADS_DIR} ${JENKINS_AGENT_WORKSPACE_DIR} ${JENKINS_AGENT_SHARED_METADATA_DIR} && dockerd-entrypoint.sh"
102104
healthcheck:
103105
test: ["CMD", "sh", "-c", "docker version --format '{{.Server.Version}}' || exit 1"]
104106
interval: 5s

0 commit comments

Comments
 (0)