diff --git a/CHANGELOG.md b/CHANGELOG.md index c73a35e5..f579cc4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Development * Updated our tests/unit to support newer versions of `unittests` - for now bumping to `v0.4.4` as `v0.5.0` has a bug that impacts us (see helm-unittest/helm-unittest#329), but testing around the bug shows `v0.5.x` should also "just work" (#414) (by @jk464) +* Use `rsync` to copy pack contents when available, falling back to `cp`. (#414) (by @cognifloyd) +* Support non-root container environments when copying pack contents (#414) (by @Stealthii) ## v1.1.0 * Fix syntax with ensure-packs-volumes-are-writable job (#403, #411) (by @skiedude) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 9cadeeab..4b030ffa 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -349,9 +349,14 @@ Merge packs and virtualenvs from st2 with those from st2packs images command: - 'sh' - '-ec' - - | - /bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && - /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared + - > + if command rsync; then + rsync -rlptD /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && + rsync -rlptD /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared; + else + cp -RP --preserve=mode,timestamps,links,xattr /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && + cp -RP --preserve=mode,timestamps,links,xattr /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared; + fi {{- with .securityContext | default $.Values.st2actionrunner.securityContext | default $.Values.securityContext }} {{/* st2actionrunner is likely the most permissive so use that if defined. */}} securityContext: {{- toYaml . | nindent 8 }} @@ -371,9 +376,14 @@ Merge packs and virtualenvs from st2 with those from st2packs images command: - 'sh' - '-ec' - - | - /bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && - /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared + - > + if command rsync; then + rsync -rlptD /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && + rsync -rlptD /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared; + else + cp -RP --preserve=mode,timestamps,links,xattr /opt/stackstorm/packs/. /opt/stackstorm/packs-shared && + cp -RP --preserve=mode,timestamps,links,xattr /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared + fi {{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }} {{/* st2actionrunner is likely the most permissive so use that if defined. */}} securityContext: {{- toYaml . | nindent 8 }} @@ -392,8 +402,12 @@ Merge packs and virtualenvs from st2 with those from st2packs images command: - 'sh' - '-ec' - - | - /bin/cp -aR /opt/stackstorm/configs/. /opt/stackstorm/configs-shared + - > + if command rsync; then + rsync -rlptD /opt/stackstorm/configs/. /opt/stackstorm/configs-shared; + else + cp -RP --preserve=mode,timestamps,links,xattr /opt/stackstorm/configs/. /opt/stackstorm/configs-shared; + fi {{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }} {{/* st2actionrunner is likely the most permissive so use that if defined. */}} securityContext: {{- toYaml . | nindent 8 }}