Build portability improvements
After some offline discussions with @jen20 where he's trying to get ContainerPilot running on SmartOS, I want an issue to collect thoughts on things in our build/test infrastructure that aren't portable across OS's.
So far I've got:
- our Makefile is a GNU Make file, which isn't portable to BSD or Illumos/SmartOS. I know there are difference but I'm not really sure what they are.
- our integration tests run in Docker, which means they aren't portable to any platform that doesn't have Docker.
- we don't have a way of running automated tests in any environment except what TravisCI gives us, which I don't believe includes BSD or SmartOS (although I'd be happy to be wrong here).
The last two points I would add to this for discussion when we get round to looking at this are:
- our dependencies are not checked into this repository, meaning we have a build time dependency on glide (currently). This significantly increases cycle time, risks 'left-pad' style issues of missing dependencies due either to mistake/malice or GitHub being down, and prevents repeatable builds from easily being made without internet access from a simple clone of the project.
- our builds and unit tests run in Docker by default and need special casing to run on SmartOS (via the
make localtarget.
our dependencies are not checked into this repository
I'm going to table this sub-topic as unrelated to this particular issue. Our plan has been to use whatever dep says we need to do once it's been deemed production-ready, so that we're not doing something out-of-the-ordinary from the rest of the golang community.
I started looking into the process changes to support building ContainerPilot under SmartOS given the existing build system and tooling. I took some notes...
-
pkgin update && pkgin install go-1.8.3 git unzip gmake - I had to comment out the glide install and build manually via
go get github.com/Masterminds/glide && cd $GOPATH && make install - The makefile needs to support
go envvalues forGOPATH,GOOS, andGOARCH(I'll open a PR for this). -
glidestill requiresGOPATHin the environment. - For whatever reason,
make local builddoesn't remove Docker commands from the rest of the process so I had to comment a few lines out for the build to work. - All unit tests pass 💚
As a note, I'd be happy to continue down this path and upstream some of my changes if we had a SmartOS/ContainerPilot customer or community member that required it. Please leave a comment on this issue if you are such a user.
I had to comment out the glide install and build manually via go get github.com/Masterminds/glide && cd $GOPATH && make install glide still requires GOPATH in the environment.
We can probably do go install github.com/Masterminds/glide, given that we need the GOPATH anyways.
For whatever reason, make local build doesn't remove Docker commands from the rest of the process so I had to comment a few lines out for the build to work.
Yeah, the build target has the builder container as a prereq. Maybe a better approach would be to have the build/containerpilot_build just drop an empty file saying "hey no docker here" if there's no Docker available.
I do want to emphasize that although I don't use the Docker build much for day-to-day development, we've had more than one person tell us that having the whole development environment available inside Docker w/o requiring anything else has helped them make minor contributions that they might not have otherwise.
the whole development environment available inside Docker w/o requiring anything else has helped them make minor contributions that they might not have otherwise
I certainly concur with this statement and think Docker/Linux containers in development facilitate far easier public contributions. I'd like to continue this as an option for end users.