From 03882db1898b722bd6155706a7de0203227adf00 Mon Sep 17 00:00:00 2001 From: Samuel Manzer Date: Tue, 14 Nov 2023 08:52:22 -0800 Subject: [PATCH] Fix edit_step backup working directory handling (#97) Summary: X-link: https://github.com/facebookincubator/TTPForge/pull/418 Pull Request resolved: https://github.com/facebookincubator/ForgeArmory/pull/97 Fix `edit_step` to make `backup_file` also use `FetchAbs` just like the target file. Update example in `ForgeArmory` to reflect new behavior I think this was actually ok once we switched back to doing a top-level directory change in RunSteps, but either way it is better to have this redundancy. Reviewed By: cedowens Differential Revision: D51307671 fbshipit-source-id: 2873deaa792922e63899ec79d7cb1af19c9d2ede --- ttps/examples/steps/edit-step/edit-step.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ttps/examples/steps/edit-step/edit-step.yaml b/ttps/examples/steps/edit-step/edit-step.yaml index 8f83961..14497f5 100644 --- a/ttps/examples/steps/edit-step/edit-step.yaml +++ b/ttps/examples/steps/edit-step/edit-step.yaml @@ -10,7 +10,7 @@ steps: cat file-to-edit.txt - name: edit-target-file edit_file: "file-to-edit.txt" - backup_file: "/tmp/my-backup.txt" + backup_file: "my-backup.txt" edits: - old: REPLACE_ME new: REPLACED_BY_EDIT @@ -20,14 +20,9 @@ steps: - old: (?P(?ms:^another_multline_function_call\(.*?\)$)) new: "/*${fn_call}*/" regexp: true + cleanup: + inline: mv my-backup.txt file-to-edit.txt - name: target-file-post-edit inline: | - set -e - - echo -e "Target file post-edit:" - cat $HOME/.ttpforge/repos/forgearmory/ttps/examples/steps/edit-step/file-to-edit.txt - cleanup: - inline: | - set -e - - mv /tmp/my-backup.txt $HOME/.ttpforge/repos/forgearmory/ttps/examples/steps/edit-step/file-to-edit.txt + echo "File contents after edit:" + cat file-to-edit.txt