Skip to content
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

Merged

Conversation

asymmetric
Copy link
Contributor

@asymmetric asymmetric commented Mar 14, 2018

The hack/verify-codegen.sh script checks whether there are any pending codegen changes the committer has forgotten to commit.

Closes #206.

lilic
lilic previously requested changes Mar 19, 2018
Copy link
Contributor

@lilic lilic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm overall


if [[ $ret -eq 0 ]]
then
echo "Up to date."
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

then
echo "Up to date."
else
echo "Out of date. Please run hack/update-codegen.sh"
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@asymmetric asymmetric Mar 19, 2018

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.

Copy link
Contributor

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?

Copy link
Contributor

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run it locally :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? :D

Copy link
Contributor Author

@asymmetric asymmetric Mar 19, 2018

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 :)

Copy link
Contributor

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

@lilic
Copy link
Contributor

lilic commented Mar 23, 2018

Is this ready for a re-review?

@asymmetric asymmetric mentioned this pull request Mar 28, 2018
@asymmetric asymmetric force-pushed the asymmetric/travis-codegen branch 8 times, most recently from d023910 to 5f0001a Compare April 9, 2018 16:05
@asymmetric
Copy link
Contributor Author

asymmetric commented Apr 9, 2018

`Updated to:

  • Run on CircleCI
  • Pin the correct branch for the version of Kubernetes we're targeting, rather than master

@asymmetric asymmetric changed the title Run verify-codegen.sh on Travis Run verify-codegen.sh on CI Apr 9, 2018
@asymmetric
Copy link
Contributor Author

PTALA, test was flaky on CircleCI, hopefully #233 will fix this.

@asymmetric asymmetric dismissed lilic’s stale review April 10, 2018 10:25

No longer a maintainer.

@asymmetric asymmetric removed the request for review from zeenix April 10, 2018 10:25
Copy link
Contributor

@krnowak krnowak left a 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.

set -o pipefail

SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
SCRIPT_BASE=${SCRIPT_ROOT}/../..
Copy link
Contributor

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.

Lorenzo Manacorda and others added 7 commits April 11, 2018 11:12
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.
We can't rely on the latest minikube working for us (case in point, the
update to 0.26 was breaking the builds).
@asymmetric
Copy link
Contributor Author

asymmetric commented Apr 11, 2018

Fixed the buld by pinning minikube. The latest version has issues running on both Travis and CircleCI.

Copy link
Contributor

@krnowak krnowak left a 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.

@asymmetric asymmetric merged commit 1708b63 into habitat-sh:master Apr 11, 2018
@asymmetric asymmetric deleted the asymmetric/travis-codegen branch April 11, 2018 12:26
@asymmetric
Copy link
Contributor Author

Sure, feel free to open an issue. I didn't change it much compared to the original, for simplicity's sake.

@krnowak
Copy link
Contributor

krnowak commented Apr 11, 2018

Filed as #238.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants