add two new flags that allow dry run executions of the draft info that return a dry run summary in json format including the auto-detected language, values of the variables in the draft config, and a list of files to be written
the --dry-run flag enables a dry run, printing the JSON summary at the end of the normal execution, and uses a custom dryrunwriter to satisfy the templateWriter interface.
the additional, optional --dry-run-file flag allows writing exclusively the JSON dry run summary to a file, since piping the output of the create command with dry run enabled includes the normal status messages which makes it un-parsable as pure JSON.
Use Case
This new feature further enhances consumption of draft in a binary-wrapping pattern by allowing a wrapper to leverage the linguist-powered language detection, and detect file modifications prior to running draft create.
Currently, the aks-devx-tools uses this consumption pattern, and will have better access to build upon draft using this dry run capability.
Example Output
{
"variables": {
"APPNAME": "testapp",
"BUILDERVERSION": "null",
"IMAGENAME": "testapp",
"LANGUAGE": "gomodule", // Note that this variable is in addition to the draft config variables
"NAMESPACE": "default",
"PORT": "1323",
"SERVICEPORT": "80",
"VERSION": "1.18"
},
"filesToWrite": [
"langtest/.dockerignore",
"langtest/Dockerfile",
"langtest/charts/.helmignore",
"langtest/charts/Chart.yaml",
"langtest/charts/production.yaml",
"langtest/charts/templates/_helpers.tpl",
"langtest/charts/templates/deployment.yaml",
"langtest/charts/templates/namespace.yaml",
"langtest/charts/templates/service.yaml",
"langtest/charts/values.yaml"
]
}
Fixes # (issue)
Feature # (details)
Type of change
Please delete options that are not relevant.
[x] New feature (non-breaking change which adds functionality)
[x] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Is it a breaking change which will impact consuming tool(s).
[x] Existing integration tests across all languages work
[x] A new dry run stage was added before each create integration test to prevent unnecessary test executions
[x] The new dry run integration tests validate the dry run JSON against a provided schema with ajv
Checklist:
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
[x] Any dependent changes have been merged and published in downstream modules
Description
add two new flags that allow dry run executions of the
draft info
that return a dry run summary in json format including the auto-detected language, values of the variables in the draft config, and a list of files to be writtenthe
--dry-run
flag enables a dry run, printing the JSON summary at the end of the normal execution, and uses a custom dryrunwriter to satisfy thetemplateWriter
interface.the additional, optional
--dry-run-file
flag allows writing exclusively the JSON dry run summary to a file, since piping the output of the create command with dry run enabled includes the normal status messages which makes it un-parsable as pure JSON.Use Case
This new feature further enhances consumption of draft in a binary-wrapping pattern by allowing a wrapper to leverage the linguist-powered language detection, and detect file modifications prior to running
draft create
.Currently, the aks-devx-tools uses this consumption pattern, and will have better access to build upon draft using this dry run capability.
Example Output
Fixes # (issue) Feature # (details)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Is it a breaking change which will impact consuming tool(s).
create
integration test to prevent unnecessary test executionsChecklist: