@nurturejs/gitlab-plugin
v0.3.2
Published
Gitlab plugin for NurtureJS - read values from a gitlab project's variables
Maintainers
Readme
Gitlab Nurture plugin
Access Gitlab project parameters from Nurture in this plugin.
Usage
Add a top level "gitlab" key to your config. At the moment, we take two parameters:
- credentialsPath: A path to a file containing a gitlab key that can be used to access the repo
- projectId: The project ID (available in the first page of the settings)
credentialsPath defaults to ~/.gitlab/credentials
Example usage:
{
"aws": {
"dev": {
"projectId": 1234,
"credentialsPath": "~/.gitlab/credentials"
},
"prod": {
"projectId": 1234,
"credentialsPath": "~/.gitlab/credentials"
}
},
"variables": [
{
"name": "GITLAB_VAR",
"description": "A project gitlab variable (you don't need key if you are not renaming the variable)",
"source": "gitlab",
"key": "I_NAMED_IT_SOMETHING_ELSE_IN_GITLAB"
}
]
}If using with mutliple sources, you can use the following syntax to prevent name collision:
"variables": [
{
"name": "GITLAB_VAR",
"description": "A project gitlab variable (you don't need key if you are not renaming the variable)",
"source": "gitlab",
"gitlab": {
"key": "I_NAMED_IT_SOMETHING_ELSE_IN_GITLAB"
}
}
]
}Errors
If the project has no CI/CD variable with that key, the plugin returns no value and says so, so the variable falls through to its next source or its default:
VariableNotSetError: Variable GITLAB_VAR not set. Tried:
- gitlab: GITLAB_VAR is not a CI/CD variable of GitLab project 42Any other API failure (a bad or expired token, a project you can't see, GitLab being unreachable) is raised with the HTTP status. Nurture catches it, logs it at level 1 and carries on to the variable's next source or its default; if the variable has neither, the run fails with that message.
