fix(jenkins): Use separate init containers for docker and kubectl installation
This commit is contained in:
@@ -16,22 +16,30 @@ spec:
|
|||||||
securityContext:
|
securityContext:
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: install-tools
|
- name: install-docker
|
||||||
|
image: docker:24-cli
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
echo "Installing Docker CLI..."
|
||||||
|
cp /usr/local/bin/docker /tmp/tools-bin/
|
||||||
|
chmod +x /tmp/tools-bin/docker
|
||||||
|
echo "✅ Docker CLI installed"
|
||||||
|
volumeMounts:
|
||||||
|
- name: tools-bin
|
||||||
|
mountPath: /tmp/tools-bin
|
||||||
|
- name: install-kubectl
|
||||||
image: alpine:3.19
|
image: alpine:3.19
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
# Install Docker CLI
|
echo "Installing kubectl..."
|
||||||
apk add --no-cache docker-cli
|
wget -q -O /tmp/tools-bin/kubectl "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl"
|
||||||
cp /usr/bin/docker /tmp/tools-bin/
|
|
||||||
|
|
||||||
# Install kubectl
|
|
||||||
wget -O /tmp/tools-bin/kubectl "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl"
|
|
||||||
chmod +x /tmp/tools-bin/kubectl
|
chmod +x /tmp/tools-bin/kubectl
|
||||||
|
echo "✅ kubectl installed"
|
||||||
echo "✅ Docker and kubectl installed"
|
ls -lh /tmp/tools-bin/
|
||||||
ls -la /tmp/tools-bin/
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: tools-bin
|
- name: tools-bin
|
||||||
mountPath: /tmp/tools-bin
|
mountPath: /tmp/tools-bin
|
||||||
@@ -51,6 +59,9 @@ spec:
|
|||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
export PATH="/tmp/tools-bin:$PATH"
|
export PATH="/tmp/tools-bin:$PATH"
|
||||||
|
echo "PATH: $PATH"
|
||||||
|
which docker || echo "Docker not in PATH"
|
||||||
|
which kubectl || echo "kubectl not in PATH"
|
||||||
exec /usr/local/bin/jenkins.sh
|
exec /usr/local/bin/jenkins.sh
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: jenkins-home
|
- name: jenkins-home
|
||||||
|
|||||||
Reference in New Issue
Block a user