etcd-operator
etcd-operator copied to clipboard
Build is not picking up my changes
I have made changes in the backup_controller.go
This is the process I am following to build and then create the Docker Image :
-
Imported the etcd-operator on github.
-
Referring this, https://github.com/coreos/etcd-operator/blob/master/doc/dev/developer_guide.md , deps are there:
./hack/update_vendor.sh -
Issued the build
./hack/build/operator/build
./hack/build/backup-operator/build
./hack/build/restore-operator/build
Point to note :
Given that I am making changes in backup_controller.go in my imported repo, I have updated the github repo path to mine in backup-operator/build so that it picks my hash.
But, even though I introduce a compile time error here (to test whether my changes are picked), build still doesn't say any error. Below, are the logs:
Updated build file:
➜ etcd-operator-swapan git:(master) ✗ cat hack/build/backup-operator/build
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
echo "Sourcing"
source hack/lib/build.sh
if ! which go > /dev/null; then
echo "golang needs to be installed"
exit 1
fi
GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"`
gitHash="github.com/swapanshridhar/etcd-operator/version.GitSHA=${GIT_SHA}"
go_ldflags="-X ${gitHash}"
bin_dir="$(pwd)/_output/bin"
mkdir -p ${bin_dir} || true
echo $gitHash
GO_BUILD_FLAGS="$@" go_build backup-operator
echo $1
Latest commit : https://github.com/swapanshridhar/etcd-operator/commits?author=swapanshridhar .. which has compile time issues induced.
Building :
➜ etcd-operator-swapan git:(master) ✗ ./hack/build/backup-operator/build
Sourcing
github.com/swapanshridhar/etcd-operator/version.GitSHA=fe3587a
building backup-operator...
No build errors above, but there should have been with the latest GIT_SHA used. So, this makes me believe that it still doesn't pick up the latest changes. Need inputs.
But 3 files are still created in _output/bin* path :
➜ bin git:(master) ✗ pwd
....... go_space/src/etcd-operator/_output/bin
➜ bin git:(master) ✗ ls -ltr
total 254352
-rwxr-xr-x 1 sshridhar staff 39116031 Feb 25 01:02 etcd-operator
-rwxr-xr-x 1 sshridhar staff 45934112 Feb 25 01:02 etcd-backup-operator
-rwxr-xr-x 1 sshridhar staff 45171591 Feb 25 14:17 etcd-restore-operator
So, looking for inputs on what I am doing wrong, and how to get my changes built ?.
I did complete the circle, with the _output/bin* files, built the Docker image, uploaded to Dockerhub, updated crds to pull the new image, but changes are not reflected (even when there was no compile time issues induced).
@swapanshridhar just ruling out the cases, did you change the deployment to point it to your docker image here?
@swapanshridhar looking at this file https://github.com/coreos/etcd-operator/blob/master/doc/dev/release.md, I conclude that making a change requires first merging your PR. That won't happen.
What you want is to git clone etcd-operator, change it, build it and then deploy it. To do that, you have to do ./hack/update_vendor.sh as you did. But then, make your changes in the source files in vendor/github.com/coreos/etcd-operator/pkg/...go wherever that file is for you.
Then when you run ./hack/build/build, it will pick up your changes.
You will then need to edit ./hack/build/docker_push, comment out the part about docker push and then run it. That will build your etcd-operator image; you will be able to see it in the output of docker images | grep etcd-operator. If you want to push that image to a private docker registry, you can do that too.
Then as mentioned above, you will need to modify examples/deployment.yaml to use your docker image.