Skip to content

Commit

Permalink
Check if file does not exist (#1582)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
  • Loading branch information
pchico83 committed May 31, 2021
1 parent 84d0eb4 commit 95a7cd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/k8s/deployments/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func TranslateOktetoInitFromImageContainer(spec *apiv1.PodSpec, rule *model.Tran
ImagePullPolicy: apiv1.PullIfNotPresent,
VolumeMounts: []apiv1.VolumeMount{},
}
command := "[ -f initialized ]"
command := "[ ! -f initialized ]"
iVolume := 1
for _, v := range rule.Volumes {
if !strings.HasPrefix(v.SubPath, model.SourceCodeSubPath) && !strings.HasPrefix(v.SubPath, model.DataSubPath) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8s/deployments/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ services:
Name: OktetoInitVolumeContainerName,
Image: "web:latest",
ImagePullPolicy: apiv1.PullIfNotPresent,
Command: []string{"sh", "-c", "([ -f initialized ] && (cp -Rv /go/pkg/. /init-volume/1 || true) && (cp -Rv /root/.cache/go-build/. /init-volume/2 || true) && (cp -Rv /app/. /init-volume/3 || true) && (cp -Rv /path/. /init-volume/4 || true) && touch initialized) || true"},
Command: []string{"sh", "-c", "([ ! -f initialized ] && (cp -Rv /go/pkg/. /init-volume/1 || true) && (cp -Rv /root/.cache/go-build/. /init-volume/2 || true) && (cp -Rv /app/. /init-volume/3 || true) && (cp -Rv /path/. /init-volume/4 || true) && touch initialized) || true"},
SecurityContext: &apiv1.SecurityContext{
RunAsUser: &runAsUser,
RunAsGroup: &runAsGroup,
Expand Down Expand Up @@ -712,7 +712,7 @@ docker:
Name: OktetoInitVolumeContainerName,
Image: "web:latest",
ImagePullPolicy: apiv1.PullIfNotPresent,
Command: []string{"sh", "-c", "([ -f initialized ] && (cp -Rv /app/. /init-volume/1 || true) && touch initialized) || true"},
Command: []string{"sh", "-c", "([ ! -f initialized ] && (cp -Rv /app/. /init-volume/1 || true) && touch initialized) || true"},
SecurityContext: &apiv1.SecurityContext{
RunAsUser: &rootUser,
RunAsGroup: &rootUser,
Expand Down

0 comments on commit 95a7cd4

Please sign in to comment.