summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-02 11:56:45 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-08-02 11:56:45 +0000
commit9ade8e80513285586f75b85b49afa74d10fb2065 (patch)
tree6def12da769e3806ad46f46e31e544302022044f /app/models
parenteed31ddcef3ad469838df3281dbefdaff2be5b53 (diff)
parent0cd76190deb01db8ff080186f3daa5b6067a27f6 (diff)
downloadgitlab-ce-9ade8e80513285586f75b85b49afa74d10fb2065.tar.gz
Merge branch '48834-chart-versions-for-applications-installed-by-one-click-install-buttons-should-be-version-locked' into 'master'
Resolve "Chart versions for applications installed by one click install buttons should be version locked" Closes #48834 See merge request gitlab-org/gitlab-ce!20765
Diffstat (limited to 'app/models')
-rw-r--r--app/models/clusters/applications/ingress.rb6
-rw-r--r--app/models/clusters/applications/jupyter.rb4
-rw-r--r--app/models/clusters/applications/prometheus.rb3
-rw-r--r--app/models/clusters/applications/runner.rb4
-rw-r--r--app/models/clusters/concerns/application_version.rb17
5 files changed, 30 insertions, 4 deletions
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb
index 27fc3b85465..4a8fd9a0b8c 100644
--- a/app/models/clusters/applications/ingress.rb
+++ b/app/models/clusters/applications/ingress.rb
@@ -1,15 +1,18 @@
module Clusters
module Applications
class Ingress < ActiveRecord::Base
+ VERSION = '0.23.0'.freeze
+
self.table_name = 'clusters_applications_ingress'
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
+ include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
include AfterCommitQueue
default_value_for :ingress_type, :nginx
- default_value_for :version, :nginx
+ default_value_for :version, VERSION
enum ingress_type: {
nginx: 1
@@ -33,6 +36,7 @@ module Clusters
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name,
+ version: VERSION,
chart: chart,
values: values
)
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb
index 975d434e1a4..72dd734246b 100644
--- a/app/models/clusters/applications/jupyter.rb
+++ b/app/models/clusters/applications/jupyter.rb
@@ -1,12 +1,13 @@
module Clusters
module Applications
class Jupyter < ActiveRecord::Base
- VERSION = '0.0.1'.freeze
+ VERSION = 'v0.6'.freeze
self.table_name = 'clusters_applications_jupyter'
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
+ include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
belongs_to :oauth_application, class_name: 'Doorkeeper::Application'
@@ -36,6 +37,7 @@ module Clusters
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name,
+ version: VERSION,
chart: chart,
values: values,
repository: repository
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb
index ea6ec4d6b03..53ac9199ae2 100644
--- a/app/models/clusters/applications/prometheus.rb
+++ b/app/models/clusters/applications/prometheus.rb
@@ -9,6 +9,7 @@ module Clusters
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
+ include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
default_value_for :version, VERSION
@@ -44,8 +45,8 @@ module Clusters
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name,
+ version: VERSION,
chart: chart,
- version: version,
values: values
)
end
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb
index e6f795f3e0b..6d97dd1448a 100644
--- a/app/models/clusters/applications/runner.rb
+++ b/app/models/clusters/applications/runner.rb
@@ -1,12 +1,13 @@
module Clusters
module Applications
class Runner < ActiveRecord::Base
- VERSION = '0.1.13'.freeze
+ VERSION = '0.1.31'.freeze
self.table_name = 'clusters_applications_runners'
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
+ include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
belongs_to :runner, class_name: 'Ci::Runner', foreign_key: :runner_id
@@ -29,6 +30,7 @@ module Clusters
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name,
+ version: VERSION,
chart: chart,
values: values,
repository: repository
diff --git a/app/models/clusters/concerns/application_version.rb b/app/models/clusters/concerns/application_version.rb
new file mode 100644
index 00000000000..ccad74dc35a
--- /dev/null
+++ b/app/models/clusters/concerns/application_version.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Clusters
+ module Concerns
+ module ApplicationVersion
+ extend ActiveSupport::Concern
+
+ included do
+ state_machine :status do
+ after_transition any => [:installing] do |application|
+ application.update(version: application.class.const_get(:VERSION))
+ end
+ end
+ end
+ end
+ end
+end