||5 years ago|
|logs||5 years ago|
|.gitignore||5 years ago|
|LICENSE||5 years ago|
|README.md||5 years ago|
|composer.json||5 years ago|
|composer.lock||5 years ago|
|deploy-config.example.php||5 years ago|
|deploy.php||5 years ago|
Small PHP GitLab CD v0.2.1
This project contains a simple script to deploy GitLab artifacts.
Build artifcats can be build using the GitLab CI (more here).
This project was heavily inspired by simple-php-git-deploy.
- You need
php >= 5.6.
composeris required for creating project with composer.
sendmailis required to send notifications on errors.
curlis required to download artifacts from gitlab using the api,
unzipis required to extract the artifacts and finally
rsyncis required to move files from cache to the defined target.
- You also need read and write permissions to all defined directories (See Configuration).
- Clone this repository:
git clone https://github.com/jdoubleu/small-php-gitlab-cd.gitor
- Use Composer to create a new project:
composer create-project jdoubleu/small-php-gitlab-cd
deploy-config.php. The deploy script looks for a file with its name appended with "config" so
you can create as much configurations as you want.
Have a look at the comments in the config file(s)!
Go into your GitLab instance (or to gitlab.com), then go to the settings of your project and create a Webhook.
Build events and enter the url with appended value of
Now you're done! Every time a build happens your script is called. Only on fitting and successful builds your script tries to deploy the artifacts.
Run the deploy script manually using your php interpreter like this:
/usr/bin/php path/to/deploy.php -p 1 -b 10
- -p determines the project id (optional if no project id is given in config) and
- -b the build id
If the script failed check the error log!
Some errors are not displayed in the error log:
- When the API request returned a 401 Unauthenticated
- When the project and/or build cannot be found
- When there is no artifact for the given build
Please keep this in mind! Try to check this by executing the curl command manually on your shell.
You are welcome to contribute to this project. Either in creating issues or submitting code.
develop branch. If you want to introduce a new feature you should create a feature
branch out of the
If you are finished just create a PR on