Skip to content

Commit

Permalink
Fix edit_step backup working directory handling (facebookincubator#97)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookincubator/TTPForge#418

Pull Request resolved: facebookincubator#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
  • Loading branch information
d3sch41n authored and facebook-github-bot committed Nov 14, 2023
1 parent 1d0d93e commit 03882db
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions ttps/examples/steps/edit-step/edit-step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,14 +20,9 @@ steps:
- old: (?P<fn_call>(?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

0 comments on commit 03882db

Please sign in to comment.