mr
package to help deploy merge requests project on test environment with docker, and provide a page to view these projects
this package can listen your project, and auto clone source code to deploy in docker for each merge request. When a merge request is closed or merged, this program will remove docker image and container which used by the closed or merged request.
Each time this program run, it will get all merge_requests are opened and try to deploy them.
finally, you can view them on localhost:8099
(of course you can set this port)
Install
npm install test-mr-server
Before use
To use this package with docker-compose
or docker build
, we hope you provide a configuration file named mr.json
or $PROJECT_NAME-mr.json
in your project to us to know some details about your project like language .etc.
Besides, if you had build artifacts
before deploy, we hope you can provide a script in your project to us to get these artifacts
, otherwise, we would just clone this project and install dependence, build, this process may be very long...
Finally, you should open the gitlab or github web hooks to send request for this program to listen to your project. At least, you should open Job events and merge requests.
the mr.json
maybe like this
{
"artifacts": {
"fetch": true
},
"scripts": {
"before-build": "./scripts/install.sh",
"build": "./scripts/build.sh",
"post-build": "./scripts/post-build.sh"
},
"deployment": {
"env": {
"NODE_DEBUG": "xxx"
},
"compose": {
"file": "",
"entry": ""
}
}
}
Usage
mr ~/Document/mr.config.json
you can run this program with this command, which means set config file link to ~/Document/mr.config.json
, about this .json
, like this:
{
"project": "makeflow/makeflow-web",
"service": {
"type": "gitlab",
"ci": {
"type": "gitlab"
},
"options": {
"url": "",
"credentials": {
"privateToken": "xxx"
}
}
},
"server": {
"hostname": "mr.makeflow.io",
"http": {
"port": 80,
"internalPort": 8099
}
},
"branches": {
"colors": {
"feature": "blue",
"fix": "red"
}
},
"deployment": {
"env": {
"OSS_KEY": "",
"OSS_SECRET": ""
}
},
"workDir": "./downloaded",
"concurrency": 2,
"maxPollingTimes": 10,
"pollingGap": 60
}
And then, this program would run as a resident process, it would output some message on the shell like docker building info, unzip file info, error message .etc.