Adding support for building on wercker #1120
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently fnproject builds on circleci. This PR demonstrates changes that will be required to build it in wercker
Following are the changes required to build fnproject as is on wercker.
wercker.yml - Added a wercker.yml on lines of existing .circlecli/config.yml. Few things have changed for example we no more require to install
golang
as the basebox
being used isgolang:1.10
itself.Also changedCIRCLE_BRANCH
to equivalentWERCKER_GIT_BRANCH
. Not sure about the usage and need ofCIRCLE_PR_REPONAME
but if required - we can try to find equivalents in wercker for this as well.agent_test.go - Two tests were modified -
TestTmpFsRW
andTestTmpFsSize
. Both of these tests were trying to check if/proc/mounts
contains mount points for '/tmp' and/
both. When running in wercker - only/tmp
entry was there in/proc/mounts
. Also the attribute string was not exact as being compared (rw,nosuid,nodev,noexec,relatime
inTestTmpFsRW
andrw,nosuid,nodev,noexec,relatime,size=1024k,nr_inodes=1024
inTestTmpFsSize
) . Therefore changes these tests slightly to not look for/
entry in '/proc/mounts' and also verify presence of each attribute for/tmp
individually rather than as a whole string.release.sh, images/dind/release.sh, images/fn-test-utils/release.sh - In
release.sh
andimages/dind/release.sh
-git status
command was failing in wercker with a dirty tree error -showing
as being modified but not staged. Could not understand why these deps were checked in in vendor folder and also why git was giving a error - not sure if any of the build steps inside Makefile is touching these files. Therefore commented all the
git
related code inrelease.sh
andimages/dind/release.sh
. Also some code was changed in these scripts to tag and push to repositories under DOCKER_USER in dockerhub for testing instead of pushing to fnproject itself.test.sh - When running in wercker - we create a custom network for docker containers and any containers that requires access to each other ( even all the wercker
steps
are run in a container only calledbox
) - has to be on that network. Therefore changed the code that started the mysql, minio and postgres containers by adding a--network=$DOCKER_NETWORK_NAME
. Also as an advantage of this custom network - we no longer need thehost
function to deduce IP address of these containers as these can now simply be referred by the container name as will be visible in the script.Also to test
fnproject/swagger
it was required thatpwd
is mounted at/go/src/github.com/fnproject/fn
in the container - but as explained earlier since we run all the steps inside a docker container only - to make data available to any other container - we need to use dockervolume
. Therefore changes were done to copy firstpwd
to a dockervolume
using an ephemeral container and then attach that container tofnproject/swagger
to work as expectedHow I did it
As you can see this has been done in fork of fnproject and may or may not be merged directly to your main repo based on whether you would want to cut over to wercker completely or want to run circleci and wercker in parallel for some time. But this should give you an fare idea of the possibilities.!
How to verify it
I have created a pipeline in wercker staging at https://dev.wercker.com/ravi-r-singhal/fn/ and anyone with access to wercker staging should be able to view the application and builds
One line description for the changelog
One moving picture involving robots (not mandatory but encouraged)