-
Notifications
You must be signed in to change notification settings - Fork 17
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
Run verify-codegen.sh on CI #211
Run verify-codegen.sh on CI #211
Conversation
35e4318
to
a833f6d
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 overall
hack/verify-codegen.sh
Outdated
|
||
if [[ $ret -eq 0 ]] | ||
then | ||
echo "Up to date." |
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.
Maybe something like this for more clarity:
Deepcopy generated files up to date.
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.
Just above it says "checking against freshly generated codegen", maybe that's enough?
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.
Nitpick alert! :)
Only reason I said was because currently shows up like this in the Travis logs:
checking against freshly generated codegen
Up to date.
And it doesn't seem connected, maybe just add a :
to understand that those two lines of logs belong together.
https://travis-ci.org/habitat-sh/habitat-operator/builds/353421977#L523
hack/verify-codegen.sh
Outdated
then | ||
echo "Up to date." | ||
else | ||
echo "Out of date. Please run hack/update-codegen.sh" |
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.
And this something like:
Deepcopy generated files out of date. Please run hack/update-codegen.sh
.travis.yml
Outdated
@@ -25,13 +25,15 @@ before_script: | |||
- sudo minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION} --extra-config=apiserver.Authorization.Mode=RBAC | |||
# Fix the kubectl context, as it's often stale. | |||
- minikube update-context | |||
# Clone the code generator repo | |||
- mkdir -p $GOPATH/src/k8s.io && git clone https://github.com/kubernetes/code-generator.git $GOPATH/src/k8s.io/code-generator |
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.
Think this would be better to be part of the verify script, so if it that needs to get removed you don't need to chase down the dependencies for it.
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.
Interesting point.. I'll give it a try.
- make test | ||
- make TESTIMAGE=habitat/habitat-operator:testing e2e | ||
- make TAG=testing image && make TESTIMAGE=habitat/habitat-operator:testing e2e |
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.
Maybe just add image
target to e2e
instead, so it's run before, as it's needed always anyways.
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 thought about this, but I think it's not a good idea: the image
target is not built in a way that it knows when it doesn't have to perform any work. Which means that running e2e
twice would build the Docker image twice.
Maybe we can refactor the image
target to be idempotent, but I didn't think it was in scope for this PR.
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 take that back, Docker actually uses the cache, so we can do what you said.
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.
OK, here's the problem: go build
is run every time make e2e
is run, which doesn't seem right.
In Travis that's not a problem, because we only run the target once, but when I'm testing locally, it is.
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.
Can you explain why doesn't it seem right?
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.
Well it's mainly aimed to run on travis and since we don't do cache there should be fine...
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 run it locally :)
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.
Why? :D
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.
Because we have different setups on Travis and locally (running minikube with/without a VM), so some things fail on Travis which work locally - something I found out by runinng e2e tests locally :)
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.
Fair enough! We could also have one target that is make travis
as well, if I remember what this discussion was about anyways. :D
Is this ready for a re-review? |
d023910
to
5f0001a
Compare
`Updated to:
|
5f0001a
to
4118f6a
Compare
PTALA, test was flaky on CircleCI, hopefully #233 will fix this. |
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.
One nit, otherwise LFAD.
hack/verify-codegen.sh
Outdated
set -o pipefail | ||
|
||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
SCRIPT_BASE=${SCRIPT_ROOT}/../.. |
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 line looks unnecessary - SCRIPT_BASE
is not used anywhere.
We perform other operations in the meantime, so the chance that we actually have to wait is lower. Signed-off-by: Lorenzo Manacorda <lorenzo@kinvolk.io>
Signed-off-by: Lorenzo Manacorda <lorenzo@kinvolk.io>
Can be run in a CI. Signed-off-by: Lorenzo Manacorda <lorenzo@kinvolk.io>
Signed-off-by: Lorenzo Manacorda <lorenzo@kinvolk.io>
This allows CI builds to provide feedback earlier, since unit tests don't need the Docker image. Signed-off-by: Lorenzo Manacorda <lorenzo@kinvolk.io>
`GOPATH` on CircleCI is an array, whereas the code-generator script expects it to be a string.
4118f6a
to
fe0f781
Compare
This disables a prompt on our CI setup.
fb2a3dc
to
82de1fa
Compare
We can't rely on the latest minikube working for us (case in point, the update to 0.26 was breaking the builds).
82de1fa
to
3f735d3
Compare
Fixed the buld by pinning minikube. The latest version has issues running on both Travis and CircleCI. |
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.
ShellCheck produces a bunch of warnings for both update-codegen.sh
and verify-codegen.sh
, but maybe let's fix it in some other PR.
Sure, feel free to open an issue. I didn't change it much compared to the original, for simplicity's sake. |
Filed as #238. |
The
hack/verify-codegen.sh
script checks whether there are any pending codegen changes the committer has forgotten to commit.Closes #206.