Support git strategy with kubernetes executor
What does this MR do?
This MR allows the configuration of persistent volumes for the /builds dir.
Why was this MR needed?
This MR was needed to allow the support of the GIT_STRATEGY: fetch
What's the best way to test this MR?
Configurations
volume.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-1
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
storageClassName: local-storage
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/pv-data/pv-1
pvc1.yml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-1
namespace: default
spec:
storageClassName: local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
.gitlab-ci.yml
variables:
GIT_STRATEGY: fetch
DURATION: 10
FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "false"
job:
script:
- 'for i in $(seq 1 $DURATION); do echo $(date); sleep 1; done'
- echo "done"
config.toml
[[runners]]
name = "kubernetes"
url = "https://gitlab.com/"
token = "TOKEN_HERE"
executor = "kubernetes"
builds_dir = "/root_builds"
[runners.kubernetes]
image = "alpine:3.11"
privileged = true
namespace = "default"
[[runners.kubernetes.volumes.pvc]]
name = "pvc-1"
mount_path = "/root_builds"
Steps
- Create PV with the following command
kubectl create -f PATH/TO/volume.yml
Following message validate the PV creation
persistentvolume/pv-1 created
- Create PVC with the following command
kubectl create -f PATH/TO/pvc1.yml
Following message validate the PVC creation
persistentvolumeclaim/pvc-1 created
- Run the pipeline and wait until it is done. The log file will look as follow log
- Connect to minikube node and check if the repo are still presents
minikube ssh
ls -alF /mnt/pv-data/pv-1/
What are the relevant issue numbers?
closes: #3847 (closed)
Edited by Steve Xuereb