Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
holmes
Commits
d8ff13c1
Commit
d8ff13c1
authored
Jun 10, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增jenkins构建接口
parent
e6a66793
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
JenkinsController.java
...ava/cn/qg/holmes/controller/gitlab/JenkinsController.java
+40
-0
No files found.
src/main/java/cn/qg/holmes/controller/gitlab/JenkinsController.java
0 → 100644
View file @
d8ff13c1
package
cn
.
qg
.
holmes
.
controller
.
gitlab
;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.utils.JenkinsService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
@Slf4j
@CrossOrigin
@RestController
@RequestMapping
(
"/jenkins"
)
public
class
JenkinsController
{
@Autowired
JenkinsService
jenkinsService
;
/**
* 构建指定的jenkins job
* @param type 类型,java/ui/node
* @param project 项目名
* @param branch 分支名
* @param namespace 环境
* @return
*/
@GetMapping
(
"/build"
)
public
JsonResult
buildSpecifiedJob
(
@RequestParam
String
type
,
@RequestParam
String
project
,
@RequestParam
String
branch
,
@RequestParam
String
namespace
)
{
try
{
log
.
info
(
"开始构建jenkins项目:项目类型:{}, 项目名:{}, 分支:{}, 部署至环境:{}"
,
type
,
project
,
branch
,
namespace
);
jenkinsService
.
buildJenkinsJob
(
type
,
project
,
branch
,
namespace
);
return
JsonResult
.
buildSuccessResult
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
JsonResult
.
buildErrorStateResult
(
"构建失败!"
,
false
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment