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
152f82ea
Commit
152f82ea
authored
Aug 20, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we use a finite loop in scripts/trigger-build
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
b405f8d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
scripts/trigger-build
scripts/trigger-build
+8
-10
No files found.
scripts/trigger-build
View file @
152f82ea
...
...
@@ -321,8 +321,6 @@ module Trigger
INTERVAL
=
60
# seconds
MAX_DURATION
=
3600
*
3
# 3 hours
attr_reader
:project
,
:id
def
self
.
unscoped_class_name
name
.
split
(
'::'
).
last
end
...
...
@@ -334,13 +332,11 @@ module Trigger
def
initialize
(
project
,
id
)
@project
=
project
@id
=
id
@start
=
Time
.
now
.
to_i
@start
_time
=
Time
.
now
.
to_i
end
def
wait!
loop
do
raise
"
#{
self
.
class
.
unscoped_class_name
}
timed out after waiting for
#{
duration
}
minutes!"
if
timeout?
(
MAX_DURATION
/
INTERVAL
).
times
do
case
status
when
:created
,
:pending
,
:running
print
"."
...
...
@@ -354,14 +350,12 @@ module Trigger
STDOUT
.
flush
end
end
def
timeout?
Time
.
now
.
to_i
>
(
@start
+
MAX_DURATION
)
raise
"
#{
self
.
class
.
unscoped_class_name
}
timed out after waiting for
#{
duration
}
minutes!"
end
def
duration
(
Time
.
now
.
to_i
-
@start
)
/
60
(
Time
.
now
.
to_i
-
start_time
)
/
60
end
def
status
...
...
@@ -372,6 +366,10 @@ module Trigger
# timeout anyway.
:running
end
private
attr_reader
:project
,
:id
,
:start_time
end
Job
=
Class
.
new
(
Pipeline
)
...
...
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