新增:流水线接口代码

This commit is contained in:
2024-03-05 09:43:34 +08:00
parent 6a4f63d8ea
commit 8eefb8ca07
10 changed files with 174 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
json.total_count @data.size
json.files @data.each do |file|
json.name file["Name"]
end

View File

@@ -0,0 +1,19 @@
json.total_data @result_object[:total_data].to_i
json.runs @result_object[:data]["Runs"].each do |run|
json.workflow run["WorkflowID"]
json.index run["Index"]
json.title run["Title"]
json.trigger_user do
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(run['TriggerUser']), name: run['TriggerUser']['Name'] }
end
if run["Ref"].starts_with?("refs/tags")
json.ref run["Ref"].gsub!("/refs/tags/", "")
else
json.ref run["Ref"].gsub!("refs/heads/", "")
end
json.status run["Status"]
json.time_ago time_from_now(run["Stopped"])
json.holding_time run["Stopped"]-run["Started"]
end

View File

@@ -0,0 +1,16 @@
json.state do
json.run do
json.title @result_object["state"]["run"]["title"]
json.status @result_object["state"]["run"]["status"]
json.done @result_object["state"]["run"]["done"]
json.jobs @result_object["state"]["run"]["jobs"]
json.current_job do
json.title @result_object["state"]["currentJob"]["title"]
json.detail @result_object["state"]["currentJob"]["detail"]
json.steps @result_object["state"]["currentJob"]["steps"]
end
end
end
json.logs do
json.steps_log @result_object["logs"]["stepsLog"]
end