summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-01-30 15:06:32 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-01-30 15:06:32 +0000
commitcb76f79dbb0c87f72cfadfb0d10ef3ba0493ad10 (patch)
tree0c5c96c0f7dcb52e6e2dd2504ecae8d8942eefbc
parent4d8e27df41c9ae17ac8b3200fa889b1cbc0c3d4b (diff)
parentbe386cb2cf1853cb7658b6c17196965efc046fe9 (diff)
downloadgitlab-ce-cb76f79dbb0c87f72cfadfb0d10ef3ba0493ad10.tar.gz
Merge branch 'cluster_status_for_ugprading' into 'master'
Expose app version to frontend See merge request gitlab-org/gitlab-ce!24791
-rw-r--r--app/serializers/cluster_application_entity.rb1
-rw-r--r--changelogs/unreleased/cluster_status_for_ugprading.yml5
-rw-r--r--spec/fixtures/api/schemas/cluster_status.json1
-rw-r--r--spec/serializers/cluster_application_entity_spec.rb6
4 files changed, 12 insertions, 1 deletions
diff --git a/app/serializers/cluster_application_entity.rb b/app/serializers/cluster_application_entity.rb
index 7b1a0be75ca..62b23a889c8 100644
--- a/app/serializers/cluster_application_entity.rb
+++ b/app/serializers/cluster_application_entity.rb
@@ -4,6 +4,7 @@ class ClusterApplicationEntity < Grape::Entity
expose :name
expose :status_name, as: :status
expose :status_reason
+ expose :version
expose :external_ip, if: -> (e, _) { e.respond_to?(:external_ip) }
expose :hostname, if: -> (e, _) { e.respond_to?(:hostname) }
expose :email, if: -> (e, _) { e.respond_to?(:email) }
diff --git a/changelogs/unreleased/cluster_status_for_ugprading.yml b/changelogs/unreleased/cluster_status_for_ugprading.yml
new file mode 100644
index 00000000000..ca1f8b3a786
--- /dev/null
+++ b/changelogs/unreleased/cluster_status_for_ugprading.yml
@@ -0,0 +1,5 @@
+---
+title: Expose version for each application in cluster_status JSON endpoint
+merge_request: 24791
+author:
+type: other
diff --git a/spec/fixtures/api/schemas/cluster_status.json b/spec/fixtures/api/schemas/cluster_status.json
index 3d9e0628f63..138a6c5ed6b 100644
--- a/spec/fixtures/api/schemas/cluster_status.json
+++ b/spec/fixtures/api/schemas/cluster_status.json
@@ -30,6 +30,7 @@
]
}
},
+ "version": { "type": "string" },
"status_reason": { "type": ["string", "null"] },
"external_ip": { "type": ["string", "null"] },
"hostname": { "type": ["string", "null"] },
diff --git a/spec/serializers/cluster_application_entity_spec.rb b/spec/serializers/cluster_application_entity_spec.rb
index 852b6af9f7f..88d16a5b360 100644
--- a/spec/serializers/cluster_application_entity_spec.rb
+++ b/spec/serializers/cluster_application_entity_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe ClusterApplicationEntity do
describe '#as_json' do
- let(:application) { build(:clusters_applications_helm) }
+ let(:application) { build(:clusters_applications_helm, version: '0.1.1') }
subject { described_class.new(application).as_json }
it 'has name' do
@@ -13,6 +13,10 @@ describe ClusterApplicationEntity do
expect(subject[:status]).to eq(:not_installable)
end
+ it 'has version' do
+ expect(subject[:version]).to eq('0.1.1')
+ end
+
it 'has no status_reason' do
expect(subject[:status_reason]).to be_nil
end