Skip to content

Commit 144acce

Browse files
committed
빌드 여러개 가능 하도록 수정
1 parent a783a45 commit 144acce

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

zimmyrabbit/templates/jenkins/main.html

+23-19
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,35 @@
8585
});
8686

8787
btnBuild.addEventListener('click', e=> {
88-
let content = document.querySelector('.content').value;
88+
let contents = document.querySelector('.content').value;
8989
let id = document.querySelector('.id').value;
9090
let token = document.querySelector('.token').value;
9191

92-
let param = {
93-
'buildJob' : content,
94-
'id' : id,
95-
'token' : token,
96-
}
97-
9892
let url = btnBuild.getAttribute('data-url');
93+
94+
let conts = contents.split(/\r?\n/);
9995

100-
$.ajax({
101-
url : url,
102-
type : 'POST',
103-
data : JSON.stringify(param),
104-
headers: {
105-
'X-CSRFToken': csrftoken // CSRF 토큰 요청 헤더에 포함
106-
},
107-
success : function(data) {
108-
109-
},
110-
error: function() {
111-
console.log('error');
96+
conts.forEach(cont => {
97+
let param = {
98+
'buildJob' : cont,
99+
'id' : id,
100+
'token' : token,
112101
}
102+
103+
$.ajax({
104+
url : url,
105+
type : 'POST',
106+
data : JSON.stringify(param),
107+
headers: {
108+
'X-CSRFToken': csrftoken // CSRF 토큰 요청 헤더에 포함
109+
},
110+
success : function(data) {
111+
112+
},
113+
error: function() {
114+
console.log('error');
115+
}
116+
});
113117
});
114118
});
115119

zimmyrabbit/zimmyrabbit/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def request_build(request):
7575

7676
id = jsonObject.get('id')
7777
token = jsonObject.get('token')
78-
build_job = 'lis_' + jsonObject.get('buildJob')
78+
build_job = jsonObject.get('buildJob')
7979
jenkins_url = f'{os.environ.get("JENKINS_ADDRESS")}{build_job}/build'
8080
print(f"build url : {jenkins_url}")
8181
print(f"id : {id}")

0 commit comments

Comments
 (0)