-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bosh Templating Language RFC #1004
Open
jpalermo
wants to merge
1
commit into
main
Choose a base branch
from
pr-bosh-templating-language-rfc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+47
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
toc/rfc/rfc-draft-add-new-bosh-release-templating-language.md
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,47 @@ | ||
# Meta | ||
[meta]: #meta | ||
- Name: Bosh Templating Language | ||
- Start Date: 2024-10-21 | ||
- Author(s): jpalermo | ||
- Status: Draft | ||
- RFC Pull Request: [community#1004](https://github.com/cloudfoundry/community/pull/1004) | ||
|
||
|
||
## Summary | ||
|
||
Introduce new custom templating language that can be used by bosh releases. Ideally gather feedback from release | ||
authors as part of the RFC process to define the MVP of the language. | ||
|
||
## Problem | ||
|
||
Currently all bosh release templates are rendered using ERB using the Bosh Director's Ruby process, or whatever | ||
Ruby process is available when a `bosh create-env` is being run. | ||
|
||
We've had multiple release breakages over the years as we upgrade the Bosh Director Ruby version and the Ruby | ||
language changes in a way that release templates were not expecting. | ||
|
||
A secondary problem is that template rendering can be slow when rendering templates for large CF deployments. | ||
|
||
## Proposal | ||
|
||
Write a library/cli that defines a strict grammar suitable for basic template rendering within Bosh releases. | ||
|
||
A proof of concept can be found [here](https://github.com/jpalermo/bosh-template-renderer). | ||
|
||
We would NOT be removing ERB rendering as an option anytime in the near future. We would update many of the Bosh | ||
Releases in the Foundational Infrastructure Working Group to use the new templates and then target releases | ||
that are on Diego Cells as large CF deployments render those same templates a large number of times. | ||
|
||
Having a grammar under our control means we can ensure it does not change or break through golang and dependency | ||
upgrades. | ||
|
||
The Bosh Director is written in Ruby, so it will be able to shell out to the CLI to render templates. While | ||
the Bosh CLI is written in golang so it will be able to import the library and use it directly. | ||
|
||
The grammar would be kept relatively small. We will not be providing a direct replacement for ERB. Many validations | ||
and data transformations are happening within ERB templates right now that should be happening at different layers | ||
of the deployment process. | ||
|
||
Data transformation should be happening within the release runtimes or pre-start scripts. Validation can also happen | ||
there, although it's possible we want to expand the Bosh Release `spec` files to provide some level of validation so | ||
errors can be caught early in the deploy process (that work is NOT part of this RFC). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARP does A LOT of validation in the template. I always thought this was best practice because then the user gets an error far earlier in the deploy process.
Here are some examples of the validations we have:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added more specific examples with links in this comment: #1004 (comment)