Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
34836d37
Commit
34836d37
authored
Aug 13, 2021
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove scripts/api/play_job.rb because it's unused
parent
d5677dc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
64 deletions
+0
-64
scripts/api/play_job.rb
scripts/api/play_job.rb
+0
-64
No files found.
scripts/api/play_job.rb
deleted
100755 → 0
View file @
d5677dc1
#!/usr/bin/env ruby
# frozen_string_literal: true
require
'rubygems'
require
'gitlab'
require
'optparse'
require_relative
'get_job_id'
class
PlayJob
DEFAULT_OPTIONS
=
{
project:
ENV
[
'CI_PROJECT_ID'
],
pipeline_id:
ENV
[
'CI_PIPELINE_ID'
],
# Default to "CI scripts API usage" at https://gitlab.com/gitlab-org/gitlab/-/settings/access_tokens
api_token:
ENV
[
'PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE'
]
}.
freeze
def
initialize
(
options
)
@options
=
options
Gitlab
.
configure
do
|
config
|
config
.
endpoint
=
'https://gitlab.com/api/v4'
config
.
private_token
=
options
.
fetch
(
:api_token
)
end
end
def
execute
job
=
JobFinder
.
new
(
options
.
slice
(
:project
,
:api_token
,
:pipeline_id
,
:job_name
).
merge
(
scope:
'manual'
)).
execute
Gitlab
.
job_play
(
project
,
job
.
id
)
end
private
attr_reader
:options
def
project
options
[
:project
]
end
end
if
$0
==
__FILE__
options
=
PlayJob
::
DEFAULT_OPTIONS
.
dup
OptionParser
.
new
do
|
opts
|
opts
.
on
(
"-p"
,
"--project PROJECT"
,
String
,
"Project where to find the job (defaults to $CI_PROJECT_ID)"
)
do
|
value
|
options
[
:project
]
=
value
end
opts
.
on
(
"-j"
,
"--job-name JOB_NAME"
,
String
,
"A job name that needs to exist in the found pipeline"
)
do
|
value
|
options
[
:job_name
]
=
value
end
opts
.
on
(
"-t"
,
"--api-token API_TOKEN"
,
String
,
"A value API token with the `read_api` scope"
)
do
|
value
|
options
[
:api_token
]
=
value
end
opts
.
on
(
"-h"
,
"--help"
,
"Prints this help"
)
do
puts
opts
exit
end
end
.
parse!
PlayJob
.
new
(
options
).
execute
end
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