Service Catalog: ProductStackHistory knows all previous versions out of the box
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Hi,
Thx for the ProductStackHistory feature. It's amazing. We are using this productive and therefore we have this improvement suggestion.
The PSH is saving the product template files in the provided directory. Currently we have multiple versions and we are extracting them with our custom implementation and converting to ```CloudFormationProductVersion``` array.
Later on we use this arraz in the ```CloudFormationProduct``` instantiation.
It would be great to have this version extraction as a CDK solution.
### Use Case
There should be no need for extractng the versions with custom methods when there is a option for saving the templates provided by the CDK. The extraction should be a follow up for providing all the saved versions to the customer account.
### Proposed Solution
Currently we have something like this:
```typescript
function extractVersionsFromFs(someArgs): string[] {
const productVersions: string[] = []
const fs = require('fs')
try {
const files = fs.readdirSync('someDirectory')
for (const file of files) {
//Some handling with the fileNames --> output is the semantic versioning version
const version = file.replace('.product.template.json', '').split('.').slice(-3).join('.')
productVersions.push(version)
}
} catch (e) {
console.log('No saved versions found')
}
return productVersions
}
```
The instantiation of the CfnProduct would be something like this:
```typescript
const product = new CloudFormationProduct(this, 'CfnProduct', {
productName: 'someName',
owner: 'someOwner',
productVersions: productStackHistory.cloudFormationProductVersions,
})
```
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.31.1
### Environment details (OS name and version, etc.)
Windows 10
Contributor guide
Assessment
This issue has not been assessed yet.