Commit d58d3098 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Rename used_timeout to timeout

parent f5e602ee
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
return `#${this.job.runner.id}`; return `#${this.job.runner.id}`;
}, },
timeout() { timeout() {
let t = `${this.job.metadata.used_timeout_human_readable}`; let t = `${this.job.metadata.timeout_human_readable}`;
if (this.job.metadata.timeout_source != null) { if (this.job.metadata.timeout_source != null) {
t += ` (from ${this.job.metadata.timeout_source})`; t += ` (from ${this.job.metadata.timeout_source})`;
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
/> />
<detail-row <detail-row
class="js-job-timeout" class="js-job-timeout"
v-if="job.metadata.used_timeout_human_readable" v-if="job.metadata.timeout_human_readable"
title="Timeout" title="Timeout"
:help-url="runnerHelpUrl" :help-url="runnerHelpUrl"
:value="timeout" :value="timeout"
......
...@@ -242,7 +242,7 @@ module Ci ...@@ -242,7 +242,7 @@ module Ci
end end
def timeout def timeout
metadata.used_timeout metadata.timeout
end end
def triggered_by?(current_user) def triggered_by?(current_user)
......
...@@ -10,7 +10,7 @@ module Ci ...@@ -10,7 +10,7 @@ module Ci
belongs_to :build, class_name: 'Ci::Build' belongs_to :build, class_name: 'Ci::Build'
chronic_duration_attr_reader :used_timeout_human_readable, :used_timeout chronic_duration_attr_reader :timeout_human_readable, :timeout
enum timeout_source: { enum timeout_source: {
unknown_timeout_source: 1, unknown_timeout_source: 1,
...@@ -22,7 +22,7 @@ module Ci ...@@ -22,7 +22,7 @@ module Ci
project_timeout = build.project&.build_timeout project_timeout = build.project&.build_timeout
timeout = [project_timeout, build.runner&.maximum_timeout].compact.min timeout = [project_timeout, build.runner&.maximum_timeout].compact.min
self.used_timeout = timeout self.timeout = timeout
self.timeout_source = timeout < project_timeout ? :runner_timeout_source : :project_timeout_source self.timeout_source = timeout < project_timeout ? :runner_timeout_source : :project_timeout_source
save! save!
......
class BuildMetadataEntity < Grape::Entity class BuildMetadataEntity < Grape::Entity
expose :used_timeout_human_readable do |metadata| expose :timeout_human_readable do |metadata|
metadata.used_timeout_human_readable unless metadata.used_timeout.nil? metadata.timeout_human_readable unless metadata.timeout.nil?
end end
expose :timeout_source do |metadata| expose :timeout_source do |metadata|
......
...@@ -6,7 +6,7 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration ...@@ -6,7 +6,7 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
def change def change
create_table :ci_builds_metadata, id: false do |t| create_table :ci_builds_metadata, id: false do |t|
t.integer :build_id, null: false t.integer :build_id, null: false
t.integer :used_timeout t.integer :timeout
t.integer :timeout_source, null: false, default: 1 t.integer :timeout_source, null: false, default: 1
t.primary_key :build_id t.primary_key :build_id
......
...@@ -330,7 +330,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do ...@@ -330,7 +330,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do
add_index "ci_builds", ["user_id"], name: "index_ci_builds_on_user_id", using: :btree add_index "ci_builds", ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
create_table "ci_builds_metadata", primary_key: "build_id", force: :cascade do |t| create_table "ci_builds_metadata", primary_key: "build_id", force: :cascade do |t|
t.integer "used_timeout" t.integer "timeout"
t.integer "timeout_source", default: 1, null: false t.integer "timeout_source", default: 1, null: false
end end
...@@ -463,8 +463,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do ...@@ -463,8 +463,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do
t.boolean "run_untagged", default: true, null: false t.boolean "run_untagged", default: true, null: false
t.boolean "locked", default: false, null: false t.boolean "locked", default: false, null: false
t.integer "access_level", default: 0, null: false t.integer "access_level", default: 0, null: false
t.integer "maximum_timeout"
t.string "ip_address" t.string "ip_address"
t.integer "maximum_timeout"
end end
add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree
......
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
}, },
}, },
metadata: { metadata: {
used_timeout_human_readable: '1m 40s', timeout_human_readable: '1m 40s',
timeout_source: 'runner', timeout_source: 'runner',
}, },
merge_request: { merge_request: {
......
...@@ -2050,8 +2050,8 @@ describe Ci::Build do ...@@ -2050,8 +2050,8 @@ describe Ci::Build do
end end
shared_examples 'saves data on transition' do shared_examples 'saves data on transition' do
it 'saves used_timeout' do it 'saves timeout' do
expect { job.run! }.to change { job.reload.metadata.used_timeout }.from(nil).to(expected_timeout) expect { job.run! }.to change { job.reload.metadata.timeout }.from(nil).to(expected_timeout)
end end
it 'saves timeout_source' do it 'saves timeout_source' do
......
...@@ -65,8 +65,8 @@ describe 'ChronicDurationAttribute' do ...@@ -65,8 +65,8 @@ describe 'ChronicDurationAttribute' do
end end
describe 'ChronicDurationAttribute - reader' do describe 'ChronicDurationAttribute - reader' do
let(:source_field) {:used_timeout} let(:source_field) {:timeout}
let(:virtual_field) {:used_timeout_human_readable} let(:virtual_field) {:timeout_human_readable}
subject {Ci::BuildMetadata.new} subject {Ci::BuildMetadata.new}
it "doesn't contain dynamically created writer method" do it "doesn't contain dynamically created writer method" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment