Skip to content

Commit

Permalink
Merge pull request #16 from hamza-tam/fix/send-file-instead-of-content
Browse files Browse the repository at this point in the history
Send file instead of the file content when sending data to Jenkins server
  • Loading branch information
ckipp01 authored Dec 5, 2023
2 parents 6e740a9 + f34b256 commit b6b48b0
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lua/jenkinsfile_linter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ local function get_crumb_job()
})
end

local function urlencode(text)
text = text:gsub("([^A-Za-z0-9%-_.!~*'()])", function(c)
return string.format("%%%02X", string.byte(c))
end)
return text
end

local validate_job = vim.schedule_wrap(function(crumb_job)
local concatenated_crumbs = table.concat(crumb_job._stdout_results, " ")
if string.find(concatenated_crumbs, unauthorized_msg) then
Expand All @@ -38,7 +31,6 @@ local validate_job = vim.schedule_wrap(function(crumb_job)
log.error("Unable to hit your crumb provider. Please check your host")
else
local args = vim.fn.json_decode(concatenated_crumbs)
local buf_contents = vim.api.nvim_buf_get_lines(0, 0, -1, false)

return Job:new({
command = "curl",
Expand All @@ -50,8 +42,8 @@ local validate_job = vim.schedule_wrap(function(crumb_job)
"POST",
"-H",
"Jenkins-Crumb:" .. args.crumb,
"-d",
"jenkinsfile=" .. urlencode(table.concat(buf_contents, "\n")),
"-F",
"jenkinsfile=<" .. vim.fn.expand("%:p"),
jenkins_url .. "/pipeline-model-converter/validate",
},

Expand Down

0 comments on commit b6b48b0

Please sign in to comment.