Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Link to the product reference as output in flavour builder

Oliver Güntherb9106f6db926
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 79645dfc92e..9bfe7ba7cf0 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -31,4 +31,12 @@ module AdminHelper
options_for_select([[I18n.t(:label_all), ''],
[I18n.t(:status_active), 1]], selected)
end
+
+ def linked_sha_reference(sha, url)
+ if sha && url
+ link_to sha, url, target: '_blank'
+ else
+ sha
+ end
+ end
end
diff --git a/app/views/admin/info.html.erb b/app/views/admin/info.html.erb
index bc664ab5e87..3533a369ad1 100644
--- a/app/views/admin/info.html.erb
+++ b/app/views/admin/info.html.erb
@@ -34,8 +34,12 @@ See COPYRIGHT and LICENSE files for more details.
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component|
component.with_header(title: I18n.t('label_information_plural'))
- if (product_version = OpenProject::VERSION.product_version).present?
- component.with_attribute(key: t(:label_product_version), value: product_version)
+ if Setting.show_product_version?
+ core_link = linked_sha_reference(OpenProject::VERSION.core_sha, OpenProject::VERSION.core_url)
+ component.with_attribute(key: t(:label_core_build), value: core_link) if core_link.present?
+
+ product_link = linked_sha_reference(OpenProject::VERSION.product_sha, OpenProject::VERSION.product_url)
+ component.with_attribute(key: t(:label_product_version), value: product_link) if product_link.present?
end
component.with_attribute(key: t(:label_core_version), value: OpenProject::Info.versioned_name)
diff --git a/config/constants/settings/definition.rb b/config/constants/settings/definition.rb
index d1f0c2c3cf2..1137a08825e 100644
--- a/config/constants/settings/definition.rb
+++ b/config/constants/settings/definition.rb
@@ -871,6 +871,10 @@ module Settings
default: true,
writable: false
},
+ show_product_version: {
+ description: 'Show product version information in the administration section',
+ default: true,
+ },
show_pending_migrations_warning: {
description: 'Enable or disable warning bar in case of pending migrations',
default: true,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 3813e0620dd..ac6210bcb4a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1763,6 +1763,7 @@ en:
label_copy_workflow_from: "Copy workflow from"
label_copy_project: "Copy project"
label_core_version: "Core version"
+ label_core_build: "Core build"
label_current_status: "Current status"
label_current_version: "Current version"
label_custom_field_add_no_type: "Add this field to a work package type"
diff --git a/lib/open_project/cache/cache_key.rb b/lib/open_project/cache/cache_key.rb
index 13e5fe997ca..06f974ccaad 100644
--- a/lib/open_project/cache/cache_key.rb
+++ b/lib/open_project/cache/cache_key.rb
@@ -30,7 +30,7 @@ module OpenProject
module Cache
module CacheKey
def self.key(*parts)
- version_part = expand([OpenProject::VERSION, OpenProject::VERSION.product_version].compact)
+ version_part = expand([OpenProject::VERSION, OpenProject::VERSION.product_sha].compact)
[version_part] + parts.flatten(1)
end
diff --git a/lib/open_project/version.rb b/lib/open_project/version.rb
index d2a4e38710b..fec09ca3b35 100644
--- a/lib/open_project/version.rb
+++ b/lib/open_project/version.rb
@@ -52,24 +52,36 @@ module OpenProject
end
def revision
- revision_from_core_version || revision_from_git
+ revision_from_core_sha || revision_from_git
end
- def product_version
- cached_or_block(:@product_version) do
- path = Rails.root.join('config', 'PRODUCT_VERSION')
- if File.exist? path
- File.read(path)
- end
+ def core_sha
+ cached_or_block(:@core_sha) do
+ read_optional 'CORE_VERSION'
end
end
- def core_version
- cached_or_block(:@core_version) do
- path = Rails.root.join('config', 'CORE_VERSION')
- if File.exist? path
- File.read(path)
- end
+ def core_url
+ cached_or_block(:@core_url) do
+ read_optional 'CORE_URL'
+ end
+ end
+
+ def product_sha
+ cached_or_block(:@product_sha) do
+ read_optional 'PRODUCT_VERSION'
+ end
+ end
+
+ def product_url
+ cached_or_block(:@product_url) do
+ read_optional 'PRODUCT_URL'
+ end
+ end
+
+ def builder_sha
+ cached_or_block(:@builder_sha) do
+ read_optional 'BUILDER_VERSION'
end
end
@@ -93,7 +105,7 @@ module OpenProject
def release_date_from_file
cached_or_block(:@release_date_from_file) do
- path = Rails.root.join('config', 'RELEASE_DATE')
+ path = Rails.root.join('RELEASE_DATE')
if File.exist? path
s = File.read(path)
Date.parse(s)
@@ -108,10 +120,10 @@ module OpenProject
end
end
- def revision_from_core_version
- return unless core_version.is_a?(String)
+ def revision_from_core_sha
+ return unless core_sha.is_a?(String)
- core_version.split.first
+ core_sha.split.first
end
def revision_from_git
@@ -123,6 +135,13 @@ module OpenProject
end
end
+ def read_optional(file)
+ path = Rails.root.join(file)
+ if File.exist? path
+ File.read(path)
+ end
+ end
+
def cached_or_block(variable)
return instance_variable_get(variable) if instance_variable_defined?(variable)
diff --git a/lib_static/open_project/appsignal.rb b/lib_static/open_project/appsignal.rb
index 43111581f20..058cf95e0af 100644
--- a/lib_static/open_project/appsignal.rb
+++ b/lib_static/open_project/appsignal.rb
@@ -68,7 +68,7 @@ module OpenProject
version: OpenProject::VERSION.to_semver,
core_hash: OpenProject::VERSION.revision,
core_version: OpenProject::VERSION.core_version,
- product_version: OpenProject::VERSION.product_version
+ product_version: OpenProject::VERSION.product_sha
}.compact
end
end
diff --git a/packaging/setup b/packaging/setup
index e4d70d65da2..be83296ce35 100755
--- a/packaging/setup
+++ b/packaging/setup
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Set RELEASE_DATE for the application
-date +%F > config/RELEASE_DATE
+date -u +"%Y-%m-%dT%H:%M:%SZ" > RELEASE_DATE
# Copy default database.yml
cp -f packaging/conf/database.yml config/database.yml
diff --git a/spec/lib/api/v3/queries/schemas/project_filter_dependency_representer_spec.rb b/spec/lib/api/v3/queries/schemas/project_filter_dependency_representer_spec.rb
index b75e36ceab5..02045210e79 100644
--- a/spec/lib/api/v3/queries/schemas/project_filter_dependency_representer_spec.rb
+++ b/spec/lib/api/v3/queries/schemas/project_filter_dependency_representer_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe API::V3::Queries::Schemas::ProjectFilterDependencyRepresenter do
it 'busts the cache on different OpenProject::VERSION.product_version' do
allow(OpenProject::VERSION)
.to receive(:instance_variable_get)
- .with(:@product_version)
+ .with(:@product_sha)
.and_return(4)
allow(instance)