Jenkins:如何使用 GitHub webhook 在 JenkinsFile 中安全地声明环境变量?
我是 Jenkins 的初学者,我必须为项目构建 Jenkins 管道。我决定使用 GitHub 作为 SCM。 GitHub 在每次推送时借助 webhook 启动 Jenkins 管道。
Jenkins 管道是一个多分支管道。这样我就可以在每个 GitHub 分支上拥有一个 Jenkinsfile。
借助我的 Jenkins 管道,我还使用 Terraform 在 AWS 上构建 EC2 实例。因此,我必须管理我的 IAM 凭证以及我可以在工作流程中使用的其他一些重要变量。
如何在工作流程中保护我的变量?我的 jenkinsfile 版本在 Github 上。如果我在 JenkinsFile 中使用“env”步骤,我的所有变量都将可见。如果我不使用 GitHub Action,GitHub 不允许管理环境变量。我现在不知道 Jenkins 插件是否可以帮助我或 Jenkins 上我不知道的功能?我知道 Jenkins 上的全局环境变量,但我的所有变量都集中在一个项目上,而不是所有项目上。
感谢您的帮助。 加蒂
I'm beginner with Jenkins and I must build a Jenkins Pipeline for a project. I decided to use GitHub as SCM. GitHub launch Jenkins pipeline thanks to webhook on each push.
The Jenkins pipeline is a multibranche pipeline. So I can have one Jenkinsfile on each GitHub branch.
I also use Terraform to build EC2 Instance on AWS thanks to my Jenkins pipeline. So I must manage my IAM credentials and some other important variables that I can be able to use during the workflow.
How can I secure my variables during the workflow ? My jenkinsfile is versioned on Github. If I use the "env" step in JenkinsFile, all my variables will be visible. GitHub doesn't allow to manage environment variable if I didn't use GitHub Action. I don't now if a Jenkins plugin can help me or a function that I not know on Jenkins ? I know the global environment variables on Jenkins but all my variables are focused on one project and not on all.
Thank you for your help.
Gati
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论