jenkins gitlab crumb
时间: 2023-08-09 14:07:45 浏览: 98
Jenkins GitLab crumb is a security feature used to prevent cross-site request forgery (CSRF) attacks when integrating Jenkins with GitLab. CSRF attacks occur when an attacker tricks a user's browser into making a malicious request on their behalf.
To use Jenkins with GitLab, you need to obtain a crumb token from GitLab, which is then used in subsequent requests to Jenkins. This token acts as a proof of authenticity and ensures that the request is coming from a trusted source.
To obtain the crumb token, you can use the following command:
```bash
curl -u <gitlab_username>:<gitlab_password> -X GET "https://<gitlab_instance>/crumbIssuer/api/json"
```
Replace `<gitlab_username>`, `<gitlab_password>`, and `<gitlab_instance>` with your GitLab credentials and instance URL respectively. This command will return a JSON response containing the crumb token.
You can then use this crumb token in your Jenkins pipeline or job configurations to authenticate requests made to GitLab APIs.
Note: It is important to keep your GitLab credentials secure and avoid exposing them in plain text.
阅读全文