andock.build
andock-build
andock-build is an Ansible role that performs several tasks. It checks out the latest commit from your branch, runs build hooks to manage dependencies, tests the code, and uploads the built artifact to a git repository.
Requirements
To build your applications with Andock, you need:
- Ansible installed on your deployment machine
- Build tools such as Composer or similar
- Git installed on both the source and target machines
Role Variables
Here's a list of variables you can configure:
vars:
git_source_repository_path: [email protected]:andock/drupal-8-demo.git # The source repository
git_target_repository_path: [email protected]:andock/drupal-8-demo-build.git # The target repository, can be the same as the source
build_path: ~/ansible # Where the build process occurs
branch: "master" # The source branch, the target branch will be master-build
hook_build_tasks: "hooks/build_tasks.yml" # Path to your build tasks hook file
Installation
You can install Andock role globally using Ansible Galaxy. Run the following command:
$ ansible-galaxy install andock.build
Update
To update the role, use the --force option when installing. Here’s the command:
$ ansible-galaxy install --force andock.build
Example Playbook
Here’s an example of how to use this role, including variable definitions:
- name: Deploy repository to build repository
hosts: localhost
roles:
- role: build
git_source_repository_path: [email protected]:andock/drupal-8-demo.git
build_path: ~/ansible
branch: "master"
hook_build_tasks: "hooks/build_tasks.yml"
Handling .gitignore
You can mark sections in your .gitignore
file with "BEGIN REMOVE ANDOCK" and "END REMOVE ANDOCK-CI". The Andock role will remove these sections before committing to the target repository.
Sample .gitignore for a Drupal 8 Composer Project
.idea
#### BEGIN REMOVE ANDOCK-CI ###
docroot/core
docroot/modules/contrib
docroot/themes/contrib
docroot/profiles/contrib
vendor
#### END REMOVE ANDOCK-CI ###
Build Hooks under .ansible/hooks/build.yml
- name: composer install
command: fin rc -T composer install
args:
chdir: "{{ build_path }}"
License
Licensed under GPL.
Author Information
Christian Wiedemann (christian.wiedemann@key-tec.de)