-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add optional revision flag #613
Conversation
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.
Overall the code seems fine, but I have a few opinions on the implementation
- I find it confusing that a flag called
revision
ends up generating an internal template variable namedcurrent_sha
: can we switchcurrent_sha
torevision
to maintain a 1:1 correspondence? - The use case of
revision
seems quite targeted: it appears we only use it to tag docker image versions. It seems like the reasons we use an env var to pass this information are largely historic (e.g. predatingbindings
). I'm ok if we have an explicitrevision
flag, since it, generally, controls an extremely important field (the actual image you're going to run). My preference would be to drop support for the implicit ENV var assignment so there's only one, canonical, place to declare it: if that results in no revision being supplied we'll simply fail template rendering and can provide a contextual error message for how to fix.
We should make sure the flag and arg in our Ruby API match, at the very least. Switching the ERB variable would be a huge PITA for us, if not also other companies. Maybe we could expose both and switch our documentation to refer to
That's what we use it for internally, but technically it doesn't have to be used at all in the ERB (and I'm ok with throwing the default rendering error if you try to use the variable without giving us a revision). IIRC the one thing krane itself uses this value for is to emit statsD tags. And naturally the prefix is just
You're likely correct that it predates bindings, but the specific historic reason is that we started as a Shipit integration, and Shipit gives you that env var by default.
I'm also leaning this way. I don't think it causes us much toil? Like, internally we just have to switch our (still rather few) individual krane invocations to include |
Both seems like a compromise in the wrong direction. I'd rather call the flag |
cd94ab6
to
96250f0
Compare
Updated the PR with the following changes:
|
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, but turns out I can't approve a pr I created.
96250f0
to
49eb22e
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.
Krane
allows current_sha
to be passed to the deploy task as nil
, but in DeprecatedDeployTask#statsd_tag we attempt to interpolate that value. This won't cause a crash, but we'll be sending 'empty' sha tags, which seems wrong.
We should either not use the sha tag when it's unavailable or provide a placeholder value (I'm leaning towards the former).
f273cb8
to
24ffdf9
Compare
24ffdf9
to
3ee3184
Compare
3ee3184
to
63aeb14
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 Thanks for cleaning up the
include EnvTestHelper
s too 🧹 ✨
What are you trying to accomplish with this PR?
As part of the krane 1.0 migration we decided to add a
--revision
--current-sha
flag.This PR adds the flag with higher precedence thanENV["REVISION"]
.I've added it to the old tasks so that transitioning to
krane
is easier.closes: #605
How is this accomplished?
Add a--revision
flag that is used overENV["REVISION"]
Add a
--current-sha
flag and remove usage ofENV["REVISION"]
in Krane (we still use that as a fallback inkubernetes-deploy
andkubernetes-render
)What could go wrong?
People get confused about the priority.