From 30ed80d7b963863277160836f3b00597c3913cad Mon Sep 17 00:00:00 2001
From: Stealthii <dpreid@gmail.com>
Date: Mon, 5 Feb 2024 15:28:03 +0000
Subject: [PATCH] Do not preserve file attributes during pack file copy

Allows copying of files in non-root containers
---
 templates/_helpers.tpl | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl
index 97d1851e..f15b75f1 100644
--- a/templates/_helpers.tpl
+++ b/templates/_helpers.tpl
@@ -350,10 +350,9 @@ Merge packs and virtualenvs from st2 with those from st2packs images
     - 'sh'
     - '-ec'
     - |
-      /bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
-      /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
-  {{- with .securityContext | default $.Values.st2actionrunner.securityContext | default $.Values.securityContext }}
-  {{/* st2actionrunner is likely the most permissive so use that if defined. */}}
+      /bin/cp -dR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
+      /bin/cp -dR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
+  {{- with $.Values.securityContext }}
   securityContext: {{- toYaml . | nindent 8 }}
   {{- end }}
     {{- end }}
@@ -372,10 +371,9 @@ Merge packs and virtualenvs from st2 with those from st2packs images
     - 'sh'
     - '-ec'
     - |
-      /bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
-      /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
-  {{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
-  {{/* st2actionrunner is likely the most permissive so use that if defined. */}}
+      /bin/cp -dR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
+      /bin/cp -dR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
+  {{- with .Values.securityContext }}
   securityContext: {{- toYaml . | nindent 8 }}
   {{- end }}
   {{- end }}
@@ -393,9 +391,8 @@ Merge packs and virtualenvs from st2 with those from st2packs images
     - 'sh'
     - '-ec'
     - |
-      /bin/cp -aR /opt/stackstorm/configs/. /opt/stackstorm/configs-shared
-  {{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
-  {{/* st2actionrunner is likely the most permissive so use that if defined. */}}
+      /bin/cp -dR /opt/stackstorm/configs/. /opt/stackstorm/configs-shared
+  {{- with .Values.securityContext }}
   securityContext: {{- toYaml . | nindent 8 }}
   {{- end }}
   {{- end }}