Tool for Gitlab-Runners
Define a tool that is available in the educs/docker-deployment-image>
Reads data from deployment.yaml
(or deployment.yml
) and uses CI_VARIABLES, to identify both CI_VARIABLES DEPLOYMENT_SERVER
and TARGET_DIR
.
Currently, it should store the data as part of a single json file (not too many data):
[
{
"project_id": "123",
"allowed_hosts": ["docker-1.educs-hosting.net", "docker-2.educs-hosting.net"],
"deployments": [
{
"name": "example",
"host": "docker-1.educs-hosting.net",
"pinned": false
}
]
}
]
If the tool requests info (GET /<project_id>/<deployment_name>
), the json is returned and environment-variables are set, used by the runner:
-
DEPLOYMENT_SERVER
(in the example:docker-1.educs-hosting.net
) -
TARGET_DIR
(in the example:/srv/example
-> based onBASE_DIR
(/srv
) and the name)
If the data is not present, a new object is defined, but not registered! As the deployment may fail, a later register step should be used.
flowchart LR
tool[Tool] --> exists{registered?}
exists -->|Yes| Config
exists -->|No| host[Select host]
host --> Config
The tool can store the info at the end, and the REST-API will store the data as part of a own gitlab repository (push/pull -> merge_requests).
Extend the deployment.jtd.json
to allow for both name
(think of unchangeable prefix?) and scale
to allow for multiple hosts (where?)
Todos:
-
Define specification -
Create projects for REST-API, Scripts/Executables -
Add tooling to deployment image