-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate CD Step at Run instead of Validate (#519)
Summary: Because TTPForge runs validations on TTP load, and we validate our target directory in the Validate action, the CD step will validate the existence of its target directory at TTP load. This means that if you create your target directory as part of your TTP, your CD step will fail because the directory does not exist yet. By moving the check to the run step, we will now hold off on validating the directory's existence until the CD step is run, allowing previous steps to create the target directory. Reviewed By: inesusvet Differential Revision: D65831540
- Loading branch information
1 parent
403f3d7
commit 20fe6b5
Showing
2 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
example-ttps/actions/change-directory/runtime-created-directory.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
api_version: 2.0 | ||
uuid: c15da914-de49-4297-a281-9c81b4fea413 | ||
name: change_directory_example_with_runtime_created_directory | ||
description: | | ||
This TTP shows you how to use the change_directory action type to change the | ||
working directory for all future actions, even if the directory doesn't exist until | ||
this TTP is ran. | ||
args: | ||
- name: cd_destination | ||
description: this argument is where we will try to cd to | ||
default: /tmp/this_doesnt_exist_yet | ||
steps: | ||
- name: "Initial directory" | ||
inline: | | ||
echo "Current working directory is: \"$(pwd)\"" | ||
- name: "Create directory" | ||
inline: | | ||
mkdir {{.Args.cd_destination}} | ||
cleanup: | ||
inline: | | ||
rm -rf {{.Args.cd_destination}} | ||
- name: "cd" | ||
cd: {{.Args.cd_destination}} | ||
cleanup: default | ||
- name: "New directory" | ||
inline: | | ||
echo "Current working directory is: \"$(pwd)\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters