-
Notifications
You must be signed in to change notification settings - Fork 43
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
Validate channel in application resource #447
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.
This LGTM, QA went well. Tried it with a bunch of different channel values (including ""), and the validation catches it during the plan as expected, nice work 👍
I think we should also have some unit tests for this, see internal application tests.
Makefile
Outdated
JUJU_CONTROLLER_ADDRESSES=${CONTROLLER_ADDRESSES} \ | ||
JUJU_USERNAME=${USERNAME} JUJU_PASSWORD=${PASSWORD} \ | ||
JUJU_CA_CERT=${CA_CERT} TF_ACC=1 TEST_CLOUD=lxd go test ./... -v $(TESTARGS) -timeout 120m | ||
JUJU_CONTROLLER_ADDRESSES=${CONTROLLER_ADDRESSES} JUJU_USERNAME=${USERNAME} JUJU_PASSWORD=${PASSWORD} JUJU_CA_CERT=${CA_CERT} TF_ACC=1 TEST_CLOUD=lxd go test ./... -v $(TESTARGS) -timeout 120m |
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.
Looks like your editor consolidated these into one line, I'd keep it on separate lines for readability.
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.
Changed back
I've added some unit tests for the validator |
73bac38
to
c1114e2
Compare
c1114e2
to
c216fec
Compare
Description
When specifying an application resource, the channel parameter specifies the channel on charmhub from which to fetch the charm. Right now, this is parsed by
charm.Parse
and anything it accepts is valid.However, users have been running into issues where problems are caused due to the fact that their plan only specifies the risk, and not the track (#445). The default track is resolved by juju and errors like this are caused by the fact that juju has resolved the track and it is not present in the plan.
Rather than fixing the particular issues caused by these inconstancy, it makes more sense to for the users to specify themselves the actual track that they need, rather than relying on juju to resolve it. By requiring this, we make the juju terraform plans more repeatable (the default track could change between applications of a plan, meaning you can get different states for the same plan). It also removes this class of bugs.
It is still possible to omit a channel entirely, this may be desirable for non production plans where a user wants to just quickly test something and not have to bother going to charmhub to look up the default track.
Fixes:
#445
Type of change
Environment
Juju controller version:
Terraform version:
QA steps
Manual QA steps should be done to test this PR.
On
terraform plan
this returns the error:When the channel is changed to "latest/stable" then
terraform plan & terraform apply
works to deploy the modelAdditional notes
JUJU-5858