Spec file

The spec file is a simple description of your steps. It should be placed in your project, where you want.

The steps are executed in order, in case of failure the deployement is stopped.

Sample

deploy.yaml
version: '1.0'
from: 'romainlavabrefairfair/deploy-java' # Image of the build container

steps:
    -   name: '@test' # First step, launch test
        script: '/.free-commit/live/test.sh' # Bash script from project root

    -   name: '@resolve-version' # Resolve the new version of the project
        script: '/.free-commit/live/version.sh'

    -   name: '@build' # Builds the project in docker image and pushes to dockerhub
        script: '/.free-commit/live/build.sh'

    -   name: '@deploy' # Deploys the new version
        script: '/.free-commit/live/deploy.sh'

    -   name: '@tag' # Tags the project with the new version
        script: '/.free-commit/live/tag.sh'
        
    -   name: '@script-with-arg' 
        script: /.free-commit/live/script-with-arg.sh arg1 arg2

⚠️ @ is required before the step name

⚠️ Scripts path must start with /

Scripts are called in entrypoint.sh in the Docker container (with bash environment, not sh), they are called with "."

So the deploy.yaml will be converted to :

Error detection

As you can see in the entryoint.sh example, free commit will test if the last executed command exited with code 0.

Be careful to creating atomic scripts to avoid undetected errors.

This script exit with 0

This script exit with 2000 and print "my-bad-cmd is really bad, oops"

Base image

You can use all images from Dockerhub.

In somes cases, you need to run an installation script, but it's too long (time * number of build), so you can create you own image.

Last updated