Announcing Vagga 0.8.0
We are excited to announce the next version of vagga, the containerization tool that makes setting up development environments easy and fun.
This release is 5 months ahead of the previous release. Mostly we’re satisfied with features and productivity vagga allows. This release brings yarn support which recently became 1.0 and few enhancements to existing commands.
Yarn Support
Yarn support is just as simple as:
- !YarnDependencies
You can also specify a subdirectory where package.json
is:
- !YarnDependencies
dir: frontend
The interesting thing about yarn is how we treat yarn.lock
. Note, the lockfile is created as a side effect of yarn install
command. So sometimes we start without a lockfile and then get it added during the build process, and sometimes it’s updated during a build process. (If somebody changed apackage.json
file).
We can’t skip versioning yarn.lock
as we do to the build artifacts. As it’s possible that yarn lock is changed (and committed to version control) but a package.json
isn’t. This happens when a user upgrades dependencies.
So what we do instead: we don’t generate container version in advance if there is no yarn.lock
or it isn’t up to date (for the latter we need to duplicate yarn’s logic in vagga, it wasn’t that hard). And we make real container version hash after a container is built. This functionality was always in vagga waiting for command to use it :)
Git Describe
When building deployment container it’s often desirable to know the version of a container inside the container itself. There is now a simple way of doing that:
- !GitDescribe /version.txt
That’s it for the command, but we have to explain why this is an important addition.
Previously you could do just:
- !BuildDeps [git]
- !Sh “git describe > /version.txt”
The issues with installing dependency are obvious. But the key thing is versioning.
If you push a version to CI that is described as v1.0.0–65-g01beef
you get the container hashed with this version. Pushing a tag v1.1.0
for the aforementioned commit later doesn’t change the container hash so CI does not rebuild the container and version file is kept old in the container, even if the commit is now tagged.
Using !Depends
command to fix the issue while is possible is definitely non-trivial. Vagga uses an embedded libgit2
to do the work in an accurate way.
Copy With Rules
Another improvement of deploying containers is in the !Copy
build step. The command is often used to copy files from working copy to
the deployment container in a way similar to this:
- !Copy
source: /work/myproj
path: /app/myproj
- !Copy
source: /work/config
path: /app/config
- !Copy
source: /work/.babelrc
path: /app/.babelrc
Now you can write this as a number of rules:
- !Copy
source: /work
path: /app
rules:
- /myproj
- /config
- /.*rc
Or use ignore list:
- !Copy
source: /work
path: /app
rules:
- !*.old
- !tmp/
- / # all files and dirs
You can find more in release notes and upgrading guide.
Contributors
Release 0.8.0 consists of 230 commits from 9 contributors. Thank you!
- Alexander Koval
- Alex Kuzmenko
- Andriy Kushnir
- Igor Davydenko
- Livio Ribeiro
- Maksym Popenko
- Nikita Uvarov
- Paul Colomiets
- Sviatoslav Sydorenko