Git Repository Deployment

You can use the globalrepo service to deploy Git repositories to the server.

Tip

This feature is not designed to roll out your application. You can still clone repositories manually via SSH or through a CI job, which will be better in most use cases. If in doubt, contact us, and we will help you select the best approach.

Options

ensure

  • present enable repository

  • absent disable and remove the repository

  • default: present

source

  • Repository source address, e.g. git@git.example.net:myproject.git

  • you can add a hash of multiple sources and select the appropriate one through the remote parameter

path

  • local path where the data ends up on the server

  • default: /opt/global/<name>

revision

  • desired Git revision (commit-id)

ssh_private_key

  • SSH private key used to fetch a private repository

  • default: empty

Tip

Use cat /tmp/private_key | python3 -c "import json,sys; print(json.dumps(sys.stdin.read()))" to convert a key into a single line with escaped line breaks. Make sure the string ends with a line break, otherwise SSH will be unable to load the key.

exec_after

  • command executed after update, e.g. composer update

  • default: empty

Minimal configuration

Use the Custom JSON at the Server Level Configuration.

{
  "globalrepo::repo": {
    "myproject": {
      "source": "git@git.example.net:myproject.git",
      "revision": "7151c3ebb6bf624388528853afb1613e6543021c"
    }
  }
}

Full example

Use the Custom JSON at the Server Level Configuration.

{
  "globalrepo::repo": {
    "myproject": {
      "ensure": "present",
      "source": "git@git.example.net:myproject.git",
      "path": "/opt/global/myproject",
      "revision": "7151c3ebb6bf624388528853afb1613e6543021c",
      "ssh_private_key": "ssh-private-key",
      "exec_after": "composer update"
    }
  }
}