简体   繁体   English

从Jenkins Job访问GitLab插件的API令牌

[英]Access GitLab Plug-in's API Token from Jenkins Job

I have instances of Jenkins and GitLab which are successfully connected. 我有成功连接的Jenkins和GitLab实例。 Part of setting up the GitLab plug-in involves providing an API token. 设置GitLab插件的一部分涉及提供API令牌。 I believe this is used by the plug-in to get details of the commit which is triggering a job. 我相信插件会使用它来获取触发作业的提交的详细信息。

I need to run a daily Jenkins job which collects some statistics using the API and then (using R) generates a report. 我需要运行每日Jenkins作业,该作业使用API​​收集一些统计信息,然后(使用R)生成报告。 So this is not triggered by an event in GitLab. 因此,这不是由GitLab中的事件触发的。

To complicate issues a little further, the R code will run inside a container (to avoid hving to install R and all the packages on every Jenkins slave), 为了使问题进一步复杂化,R代码将在容器内运行(以避免在每个Jenkins从站上安装R和所有软件包),

It does not appear that the plug-in makes the token available to be used in jobs ... and I can see a sane reason for that. 似乎该插件没有使令牌可用于作业中...我可以看到一个理智的理由。

Is it possible to access the API token from the plug-in? 是否可以从插件访问API令牌?

带参数的作业 There is a plugin which supports credential injecting ( https://wiki.jenkins.io/display/JENKINS/Credentials+Binding+Plugin ) to the builds which could be used later as an environment variable. 有一个支持凭据注入的插件( https://wiki.jenkins.io/display/JENKINS/Credentials+Binding+Plugin ),可以稍后用作环境变量。 Gitlab api token could be also selected. 还可以选择Gitlab api令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM