[feature] git clone repo upon initialization
Some checks failed
DevStar DevContainer Operator CI Pipeline - main branch / build-and-push-devstar-devcontainer-operator (push) Failing after 1m8s

This commit is contained in:
Mingchen Dai
2024-10-14 05:49:23 +00:00
parent 50e6da3137
commit b81c895162
5 changed files with 26 additions and 10 deletions

View File

@@ -97,11 +97,11 @@ func (r *DevcontainerAppReconciler) Reconcile(ctx context.Context, req ctrl.Requ
}
logger.Info("DevContainer is READY", "ReadyReplicas", statefulSetInNamespace.Status.ReadyReplicas)
} else {
app.Status.Ready = false
if err := r.Status().Update(ctx, app); err != nil {
logger.Error(err, "Failed to un-mark DevcontainerApp.Status.Ready", "DevcontainerApp.Status.Ready", app.Status.Ready)
return ctrl.Result{}, err
}
// app.Status.Ready = false
// if err := r.Status().Update(ctx, app); err != nil {
// logger.Error(err, "Failed to un-mark DevcontainerApp.Status.Ready", "DevcontainerApp.Status.Ready", app.Status.Ready)
// return ctrl.Result{}, err
// }
logger.Info("DevContainer is NOT ready", "ReadyReplicas", statefulSetInNamespace.Status.ReadyReplicas)
}

View File

@@ -26,7 +26,7 @@ spec:
emptyDir: {}
initContainers:
- name: init-root-ssh-dir
image: {{.Spec.StatefulSet.Image}}
image: devstar.cn/public/busybox:27a71e19c956
imagePullPolicy: IfNotPresent
command:
- /bin/sh
@@ -36,6 +36,16 @@ spec:
volumeMounts:
- name: root-ssh-dir
mountPath: /root/.ssh
- name: init-git-repo-dir
image: {{.Spec.StatefulSet.Image}}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- if [ ! -d '/data/workspace' ]; then git clone {{.Spec.StatefulSet.GitRepositoryURL}} /data/workspace && echo "Git Repository cloned."; else echo "Folder already exists."; fi
volumeMounts:
- name: pvc-devcontainer
mountPath: /data
containers:
- name: {{.ObjectMeta.Name}}
image: {{.Spec.StatefulSet.Image}}
@@ -61,7 +71,7 @@ spec:
- -c
- exec ls ~
failureThreshold: 6
initialDelaySeconds: 10
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
@@ -72,7 +82,7 @@ spec:
- -c
- exec cat /etc/ssh/ssh_host*.pub
failureThreshold: 6
initialDelaySeconds: 10
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5