summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-01-14 13:05:24 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-01-25 10:33:53 +0100
commit4967fe945400e0855cda93f06add1e81c0462911 (patch)
tree5b78b70fe9ea213133fa84294100dbbd57a43da7
parent3a8b9aad69dd1b6a54b84a82f51fb81ffbdc5127 (diff)
downloadgitlab-ce-4967fe945400e0855cda93f06add1e81c0462911.tar.gz
Do not assigne unused attributes to CI/CD builds
-rw-r--r--lib/gitlab/ci/yaml_processor.rb2
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb33
2 files changed, 1 insertions, 34 deletions
diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb
index 5515092ccf1..07ba6f83d47 100644
--- a/lib/gitlab/ci/yaml_processor.rb
+++ b/lib/gitlab/ci/yaml_processor.rb
@@ -55,7 +55,7 @@ module Gitlab
instance: job[:instance],
start_in: job[:start_in],
trigger: job[:trigger]
- }.compact }
+ }.compact }.compact
end
def stage_builds_attributes(stage)
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 20c35573cfb..91139d421f5 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -21,15 +21,12 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"]
},
allow_failure: false,
when: "on_success",
- environment: nil,
yaml_variables: []
})
end
@@ -154,12 +151,9 @@ module Gitlab
builds:
[{ stage_idx: 1,
stage: "test",
- tag_list: [],
name: "rspec",
allow_failure: false,
when: "on_success",
- environment: nil,
- coverage_regex: nil,
yaml_variables: [],
options: { script: ["rspec"] },
only: { refs: ["branches"] },
@@ -169,12 +163,9 @@ module Gitlab
builds:
[{ stage_idx: 2,
stage: "deploy",
- tag_list: [],
name: "prod",
allow_failure: false,
when: "on_success",
- environment: nil,
- coverage_regex: nil,
yaml_variables: [],
options: { script: ["cap prod"] },
only: { refs: ["tags"] },
@@ -344,8 +335,6 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"],
@@ -356,7 +345,6 @@ module Gitlab
},
allow_failure: false,
when: "on_success",
- environment: nil,
yaml_variables: []
})
end
@@ -378,8 +366,6 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"],
@@ -390,7 +376,6 @@ module Gitlab
},
allow_failure: false,
when: "on_success",
- environment: nil,
yaml_variables: []
})
end
@@ -410,8 +395,6 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"],
@@ -420,7 +403,6 @@ module Gitlab
},
allow_failure: false,
when: "on_success",
- environment: nil,
yaml_variables: []
})
end
@@ -438,8 +420,6 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"],
@@ -448,7 +428,6 @@ module Gitlab
},
allow_failure: false,
when: "on_success",
- environment: nil,
yaml_variables: []
})
end
@@ -763,8 +742,6 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "rspec",
- coverage_regex: nil,
- tag_list: [],
options: {
before_script: ["pwd"],
script: ["rspec"],
@@ -779,7 +756,6 @@ module Gitlab
},
when: "on_success",
allow_failure: false,
- environment: nil,
yaml_variables: []
})
end
@@ -976,14 +952,11 @@ module Gitlab
stage: "test",
stage_idx: 1,
name: "normal_job",
- coverage_regex: nil,
- tag_list: [],
options: {
script: ["test"]
},
when: "on_success",
allow_failure: false,
- environment: nil,
yaml_variables: []
})
end
@@ -1023,28 +996,22 @@ module Gitlab
stage: "build",
stage_idx: 0,
name: "job1",
- coverage_regex: nil,
- tag_list: [],
options: {
script: ["execute-script-for-job"]
},
when: "on_success",
allow_failure: false,
- environment: nil,
yaml_variables: []
})
expect(subject.second).to eq({
stage: "build",
stage_idx: 0,
name: "job2",
- coverage_regex: nil,
- tag_list: [],
options: {
script: ["execute-script-for-job"]
},
when: "on_success",
allow_failure: false,
- environment: nil,
yaml_variables: []
})
end