Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-27 00:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-27 00:08:42 +0300
commit413c6d807b260f6086fdd05c01618f459335d465 (patch)
tree87db227decb68234fb05c95143ba52dd26aec65f /qa
parentdd9af4e967d19806838befb3a99a0083123a9a6e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/resource/job.rb35
-rw-r--r--qa/qa/resource/project.rb13
2 files changed, 48 insertions, 0 deletions
diff --git a/qa/qa/resource/job.rb b/qa/qa/resource/job.rb
new file mode 100644
index 00000000000..96c502e567c
--- /dev/null
+++ b/qa/qa/resource/job.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+module QA
+ module Resource
+ class Job < Base
+ attr_accessor :id, :name, :project
+
+ attributes :id,
+ :project
+
+ def fabricate_via_api!
+ resource_web_url(api_get)
+ rescue ResourceNotFoundError
+ super
+ end
+
+ def artifacts
+ parse_body(api_get_from(api_get_path))[:artifacts]
+ end
+
+ def api_get_path
+ "/projects/#{project.id}/jobs/#{id}"
+ end
+
+ def api_post_path
+ end
+
+ def api_post_body
+ {
+ artifacts: artifacts
+ }
+ end
+ end
+ end
+end
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index dba3eb2e219..5a66b8f1567 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -190,6 +190,10 @@ module QA
"#{api_get_path}/pipeline_schedules"
end
+ def api_jobs_path
+ "#{api_get_path}/jobs"
+ end
+
def api_issues_path
"#{api_get_path}/issues"
end
@@ -354,6 +358,15 @@ module QA
auto_paginated_response(request_url(api_pipelines_path, per_page: '100'), attempts: attempts)
end
+ def jobs
+ response = get(request_url(api_jobs_path))
+ parse_body(response)
+ end
+
+ def job_by_name(job_name)
+ jobs.find { |job| job[:name] == job_name }
+ end
+
def issues(auto_paginate: false, attempts: 0)
return parse_body(api_get_from(api_issues_path)) unless auto_paginate