CLI Command Summaries
Last updated
Last updated
© 2024 JFrog Ltd All Rights Reserved
The Command Summaries feature enables the recording of JFrog CLI command outputs into the local file system. This functionality can be used to generate a summary in the context of an entire workflow (a sequence of JFrog CLI commands) and not only in the scope of a specific command.
An instance of how Command Summaries are utilized can be observed in the setup-cli GitHub action. This action employs the compiled markdown to generate a comprehensive summary of the entire workflow.
jf rt build-publish
jf rt upload
jf scan
jf build-scan
Each command execution that incorporates this feature can save data files into the file system. These files are then used to create an aggregated summary in Markdown format.
Saving data to the filesystem is essential because CLI command executes in separate contexts. Consequently, each command that records new data should also incorporate any existing data into the aggregated markdown. This is required because the CLI cannot determine when a command will be the last one executed in a sequence of commands.
The CLI does not automatically remove the files as they are designed to remain beyond a single execution. As a result, it is your responsibility to you to manage your pipelines and delete files as necessary. You can clear the entire directory of JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR
that you have configured to activate this feature.
To use the Command Summaries, you'll need to set the JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR
environment variable. This variable designates the directory where the data files and markdown files will be stored.
If you wish to contribute a new CLI command summary to the existing ones, you can submit a pull request once you've followed these implementation guidelines:
Implement the CommandSummaryInterface
Record data during runtime
The GenerateMarkdownFromFiles
function needs to process multiple data files, which are the results of previous command executions, and generate a single markdown string content. As each CLI command has its own context, we need to regenerate the entire markdown with the newly added results each time.
Each command that implements the CommandSummaryInterface
will have its own subdirectory inside the JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR/JFROG_COMMAND_SUMMARY
directory.
Every subdirectory will house data files, each one corresponding to a command recording, along with a markdown file that has been created from all the data files. The function implemented by the user is responsible for processing all the data files within its respective subdirectory and generating a markdown string.