-
Notifications
You must be signed in to change notification settings - Fork 32
Support per-branch environment variables #20
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,11 @@ terraform to your Deployment. | |
}, | ||
Required: true, | ||
}, | ||
"git_branch": { | ||
Description: "The git branch of the environment variable.", | ||
Type: types.StringType, | ||
Optional: true, | ||
}, | ||
Comment on lines
+76
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're also missing a test that includes the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at the moment the git tests only actually work for you. I get
Which I think is because I can only use my own repositories. However I have added some reasonable tests that will hopefully work. (You will need to crate a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh yeah, makes sense. We should probably read an environment variable for the non-team git repository or something. I don't think we can keep it pointing at my git repos forever 🤣. One for later though! |
||
"key": { | ||
Description: "The name of the environment variable.", | ||
Type: types.StringType, | ||
|
@@ -247,6 +252,7 @@ func containsEnvVar(env []EnvironmentItem, v EnvironmentItem) bool { | |
for _, e := range env { | ||
if e.Key == v.Key && | ||
e.Value == v.Value && | ||
e.GitBranch == v.GitBranch && | ||
len(e.Target) == len(v.Target) { | ||
for i, t := range e.Target { | ||
if t != v.Target[i] { | ||
|
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.
I'm not 100% familiar with this API, but can you only specify
git_branch
forpreview
target
s, or does it work across all different target possibilities?e.g. what happens if I specified
I'm wondering if it's worth adding some additional validation around that.
Granted the provider is currently pretty light on up-front validation.
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.
The API is very strict; the branch has to actually exist, can't be your production branch etc. Lots of things we cannot validate here. You get good error messages if you try to do something impossible.