fix(jenkins): Use separate init containers for docker and kubectl installation
This commit is contained in:
@@ -16,22 +16,30 @@ spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
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
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
# Install Docker CLI
|
||||
apk add --no-cache docker-cli
|
||||
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"
|
||||
echo "Installing kubectl..."
|
||||
wget -q -O /tmp/tools-bin/kubectl "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl"
|
||||
chmod +x /tmp/tools-bin/kubectl
|
||||
|
||||
echo "✅ Docker and kubectl installed"
|
||||
ls -la /tmp/tools-bin/
|
||||
echo "✅ kubectl installed"
|
||||
ls -lh /tmp/tools-bin/
|
||||
volumeMounts:
|
||||
- name: tools-bin
|
||||
mountPath: /tmp/tools-bin
|
||||
@@ -51,6 +59,9 @@ spec:
|
||||
- -c
|
||||
- |
|
||||
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
|
||||
volumeMounts:
|
||||
- name: jenkins-home
|
||||
|
||||
Reference in New Issue
Block a user