-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Feature: add filebase64 function #11791
Feature: add filebase64 function #11791
Conversation
de45385
to
99b2155
Compare
99b2155
to
355ff6b
Compare
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.
LGTM!
Sorry about the long delay in reviewing this @conorevans. I've rebased this on main and added a changelog entry. It'll get merged once our docs preview renders and we'll get this out in Nomad 1.3.2. Thanks for your patience!
Bench test verifying this works as intended:
job "httpd" {
...
env {
DATA_BASE64 = filebase64("world.txt")
}
...
}
$ echo 'hello' > world.txt
$ nomad job run ./httpd.nomad
$ nomad job inspect httpd | jq '.Job.TaskGroups[0].Tasks[0].Env'
{
"DATA_BASE64": "aGVsbG8K"
}
Signed-off-by: Conor Evans <coevans@tcd.ie>
066bd14
to
749ee09
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Signed-off-by: Conor Evans coevans@tcd.ie
Closes #11522
As noted in that issue, Terraform implements this function. About a month ago, the
MakeFileFunc
in Terraform deviated from hashicorp/go-cty-funcs which Nomad is using and which this PR continues to use. If the code change in Terraform is relevant here, perhaps it should be copied over tohashicorp/go-cty-funcs
, but I'll leave that in your hands.I copied the Doc largely from Terraform, removing some of the content that was Terraform-focused. If it needs to be updated, let me know or make the changes yourself as you see fit. Docs are pretty tricky to get right and you maintainers will know much better than me how you'd like to phrase it.
I didn't add a test here, mostly because there is no existing
functions_test
file with a Test Table I could easily plug in to, and the Terraform test didn't transfer over. Unfortunately there's also no test inhashicorp/go-cty-funcs
. If you want to add one, please do so as you see fit.