Launching Today: CircleCI 2.0 Reaches General Availability
circleci.com
circleci.com
I have an open source Rails app <https://github.com/coreinfrastructure/best-practices-badge> that self-certifies that open source projects are following best practices. It currently uses CircleCI 1.0 and then deploys to Heroku <https://circleci.com/gh/coreinfrastructure/best-practices-ba....
If I configure it for development and test, it will contain all the test and development gems in addition to the production ones <https://github.com/coreinfrastructure/best-practices-badge/b.... I would also need to include gcc and other build tools. But I would have immutability in that my dev, test and production images would be identical.
Or, should I use one image for dev and test, and then build a different image for production, in order to have the smallest possible size? CircleCI supports building <https://circleci.com/docs/2.0/building-docker-images/> further Docker images, but then there's a chance of losing dev/prod parity if, for example, a software dependency gets updated in the meantime.
https://docs.docker.com/engine/userguide/eng-image/multistag...
However, that doesn't fix the problem of having lots of development and test gems installed in test that I don't want for production. I don't know of a way of copying just my production gems to a production image.
Or maybe have more than one path for gems and change load paths between environments?
Or keep tests in a separate image from the production image under test? Similarly, build tools could live in a different image/layer.
You could also point BUNDLE_PATH at the last place bundler ran for that environment (don’t delete the old gems) and that would speed up the install, but a better approach might be to package to a shared folder and then install to env specific bundle path folders in your docker image/build workspace, if you want bundler to manage the shared caching while keeping gem output separate and unique to each build.
It’s important to remember that gems are just folders of ruby files placed in the load path, sometimes with compiled bits to load at runtime, that could in turn be dynamically compiled to rely on system libraries or non-Ruby packages. So you have similar constraints with Ruby that you would have with Node.js – the potential for issues from the portability or lack thereof for native code dependencies. That’s why there’s a distinction between “install” and “package” – install will make sure the binary output can run on the current system unless flagged not to.
I hope this helps.
My question is whether development and testing gems should be included in production or not.
My question is when switching to a Docker workflow, does it make sense to use the same image for test on CircleCI as for deployment on staging and production.
- base image that installs OS Updates + OS package requirements + production dependencies
- dev image inherits from base image, installs dev dependencies + source code volume mounted on '/app/src'
- test image inherits from base image, installs test dependencies + source code volume mounted on '/app/src' (image used both for local tests and CI)
- prod image inherits from base image, adds source code to '/app/src' (this image will eventually be tagged and pushed to a production registry after builds)
Only adding source code to the image in prod image for not breaking cache during development.
On one hand, having dev/test gems in the image should be innocuous, if I recall correctly bundler will not activate them when the environment is production. So other than some additional image size (is this really a problem?) it doesn't have any material effect. But I empathize with wanting to have a completely minimalist prod image, regardless of whether it has measurable benefit.
iron.io has for quite some time advocated having two parallel base images, one dev which has the build tools, and then copying the built production gems to a prod image. [1] If you do this, then the build tools (gcc and the like) are never in the docker image which is used for test or prod. But yes you still need test gems in an image that runs rspec/capybara/etc.
Maybe the real solution then is to take your prod image, and deploy it to some staging environment which then gets treated to a functional test suite. The approach would necessitate running the suite in one container, targeting the application running in another container however. (This is naturally how you would do it if you were using webdriver/selenium-based testing tools.)
You could install all the dev gems, build tools, etc in the CircleCI build container and run unit testing. Once everything looks good and you can build your file app that passes, then take the app and throw it in a new Docker image. Then, integration test that Docker image itself.
That final piece could be done on some sort of staging server of in a new build environment using CircleCI 2.0 Workflows.
When I've needed support (mainly around installing custom versions of various apps) the staff have been very responsive.
Circle folk: for me it still displays 'Leave 2.0 beta' and 'Join 2.0 beta' - do I need to anything to get 2.0 final?
Thanks for pointing that out, let me see if we can make that less head-scratchy.
You should also see a little icon in your dashboard that says 1.0 or 2.0 to the right of each of your builds - that will tell you what version you're on :)
- go unanswered
- get answered by the community with "here is how you do it," without the "here is why" part.
- the question can't be answered by the community and all you see are messages along the lines of "same issue here."
Rarely do I see the "here is how you do it and here is why" answer I am looking for.
Not great, but works.
Like isn't the point of docker to not be able to install a bunch of stuff after the image is built?
For example, if you've used CircleCI 1.0 before, those builds run in LXC which is Docker's underlying technology. My suggestion is more down that path rather than 2.0's bring your own Dockerfile approach.
The base image you choose just means you don't need to install that specific language/toolset manually, which saves part of the build time and work writing the config.
You can choose a base image (or machine, a VM), and then go from there. No custom Docker image.
Also, what's wrong with Discourse? It's not perfect but surely the best forum system around I think.
Aside from CircleCI Discuss, we also have actual Support and Docs.
We use it a ton and you might like it too.
Rather than have every customer repeat these steps to transform their file, why don't you do it for them, and make a circle.yml to .circleci/config.yml converter?
I'm currently trying to work out what
dependencies:
pre:
Turns into for 2.0. There's instructions for dependencies:
override:
But I'm not sure if the same logic applies to pre, and the replacement shown there is indented in such a way that it looks like there's some missing information about what the parent container should be. All I can do is guess what the replacement for dependencies:
pre:
should be.For the 'dependencies: pre' step, you would replace that with a 'run' step, the same as outlined for 'dependencies: override'. We'll update the docs - thanks for pointing it out.
Edit: looking at another doc, https://circleci.com/docs/2.0/configuration-reference/#deplo..., the missing parent key is 'jobs:'
Also shouldn't "Search and Replace Deprecated 2.0 Keys" be "Search and Replace Deprecated 1.0 Keys" (or better "Search and Replace Deprecated Keys")?
https://circleci.com/docs/2.0/configuration-reference/#table...
Implies 'steps' is directly under 'jobs', whereas:
https://circleci.com/docs/2.0/configuration-reference/#full-...
shows that 'steps' is under 'jobs > build'
- Re:
* missing executor type
* is not supported executor type
Include https://circleci.com/docs/2.0/executor-types in the error.- This should be one error, not two.
- Why is 'working_directory' mandatory now? It wasn't before. Why not provide a default?
- 'working_directory: ~' fails. But 'working_directory: ~/' works (but then fails later). This is silly. Do path normalisation.
- https://circleci.com/docs/2.0/executor-types should include a node 8 image already. it's the current version of node and '@latest' won't be great when 9.x comes out.
- Re: https://discuss.circleci.com/t/directory-tmp-you-are-trying-.... The error is missing a word. Also checking out to a directory with existing contents should be fine.
Edit: finally got it:
https://gist.github.com/mikemaccana/b6a7be0351d769a9099f5fdb...
Always use `$HOME`!
In CircleCI 2.0, there is no longer inferred commands. You just run the commands you want.
I use it almost everywhere.
Unfortunately here in Berlin mostly everyone switches to self-hosted version of Jenkins at one point.
(In case it's not super obvious, I work at CircleCI)
- Privacy issues - Owning critical service component
Unfortunately I've never heard the reason that I think is the right one ( at least from what I can see is happening here ), which sounds like :
"Hey, we don't need this, because at Zalando / Nokia Maps, etc. we used Jenkins, so I don't wanna spend time maintaining a new tool ( CircleCI )."
Same stuff happens with project management ( dominated by JIRA around Berlin ).
At one point a company trashed all my CD-setup ( which was with the free plan anyway ) to run Jenkins with Docker ( I don't know how well supported docker is with CircleCI, but I doubt that is so much different than Jenkins ).
EDIT: I'm freelancing in Berlin, so I usually do a hand-over when the team of devs is hired.
That's ~$40k/year for 100 devs, plus the infrastructure costs. A Jenkins license is $0 (or $100k+ for enterprise support). If it was my budget, I'd have a hard time fronting up a large fraction of a developer's salary to a third party to provide a fuzzy level of support, versus spending zero money and putting the support burden on an in-house team I can trust and directly influence.
TeamCity has great support, I trust them from JetBrains's great work with IDEs, and their top-shelf license is ~$22k (one-off with 1-year of support & upgrade; iirc the yearly support fee is discounted 50% of original license).
Right now we're evaluating GitLab CI and it looks like the way forward (for us).
I appreciate that there's the option, but I'm thinking more along the lines of what Sentry offers: Open source, self-hostable for free, optional paid enterprise support, optional paid hosting for teams of all sizes. In my book that's the perfect lineup.
Travis doesn't offer self-hosting, Jenkins doesn't offer (non-enteprise) paid hosting.
CircleCI 2.0 was built with first-class Docker support, so if that's something you're interested in, definitely take a look.
We're looking for something with security, control, support etc that we didn't see when we looked at 1.0.
All the security and control of an on-premises solution with all the benefits of SaaS.