简体   繁体   English

Jenkins:依赖其他工件/项目的构建作业

[英]Jenkins: Build job with dependency to other artifact/project

I'm trying to configure my jenkins jobs but I have some problems regarding the setup. 我正在尝试配置我的詹金斯工作,但是关于设置有一些问题。

My Goal: 我的目标:

  • One build job for the core project 核心项目的一项构建工作
  • One build job for a project which has dependencies to the core project 与核心项目有依赖性的项目的一个构建作业

Current Setup: 当前设置:

- core 
-- src/
-- build.gradle
-- settings.gradle
- project
-- src/
-- build.gradle
-- settings.gradle

"core" and "project" are in separate git repositories. “核心”和“项目”位于单独的git存储库中。

The settings.gradle of the "project" contains the following code: “项目”的settings.gradle包含以下代码:

include ':drivers', ':capabilities', ':features', ':extensions', ':pageobjects', ':reports'
project(':drivers').projectDir = new File(settingsDir, '../core/drivers')
project(':capabilities').projectDir = new File(settingsDir, '../core/capabilities')
project(':features').projectDir = new File(settingsDir, '../core/features')
project(':extensions').projectDir = new File(settingsDir, '../core/extensions')
project(':pageobjects').projectDir = new File(settingsDir, '../core/pageobjects')
project(':reports').projectDir = new File(settingsDir, '../core/reports') 

So, the "project" needs the modules of the core. 因此,“项目”需要核心模块。 On my local machine (using eclipse, one workspace) it works like a charm, but I don't know how to setup the jenkins jobs. 在我的本地机器上(使用eclipse,一个工作区),它的工作原理很像,但是我不知道如何设置詹金斯工作。 Maybe the path to settingsDir is not suitable for Jenkins? 也许settingsDir的路径不适用于Jenkins? It's also possible to include both repositories in one job, but it would be better if there are two build jobs. 也可以将两个存储库都包含在一个作业中,但是如果有两个构建作业会更好。

How do I configure this properly? 如何正确配置?

In your case as you want to use different Jobs for Core and Project, the gradle settings projectDir doesn't meet the path structure with respective to Jenkins workspaces if you use as is which comes by Jenkins default workspace management. 在您要使用Core和Project的不同Jobs的情况下,如果按原样使用Jenkins默认工作空间管理,则gradle设置projectDir不符合Jenkins工作空间的路径结构。

Use Custom Workspace , which helps this to point to the folder where you have setup a folder similar to the Dev folder structure. 使用Custom Workspace ,这可以帮助您指向已在其中设置了与Dev文件夹结构类似的文件夹的文件夹。

Ex: Create root folder to hold the Core and Projects and assuming that you are running Jenkins (/var/lib/jenkins/workspace/code) 例如:创建根文件夹以保存Core和Projects,并假设您正在运行Jenkins(/ var / lib / jenkins / workspace / code)

Code

-core -核心

--src/ --src /

--build.gradle --build.gradle

--settings.gradle --settings.gradle

-project -项目

--src/ --src /

--build.gradle --build.gradle

--settings.gradle --settings.gradle

Use the custom workspace for core job as /var/lib/jenkins/workspace/code/core 使用核心工作的自定义工作区为/ var / lib / jenkins / workspace / code / core

and for the project job use the custom workspace as /var/lib/jenkins/workspace/code/project 对于项目作业,请使用自定义工作区作为/ var / lib / jenkins / workspace / code / project

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

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