Commit 4eded0b7 authored by Kamil Trzciński's avatar Kamil Trzciński

Add config_options|variables to BuildMetadata

These are data columns that store runtime configuration
of build needed to execute it on runner and within pipeline.

The definition of this data is that once used, and when no longer
needed (due to retry capability) they can be freely removed.

They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking
support for json datatype on old enough version).
parent 9e8910b7
...@@ -924,12 +924,10 @@ module Ci ...@@ -924,12 +924,10 @@ module Ci
# have the old integer only format. This method returns the retry option # have the old integer only format. This method returns the retry option
# normalized as a hash in 11.5+ format. # normalized as a hash in 11.5+ format.
def normalized_retry def normalized_retry
value = options&.dig(:retry) strong_memoize(:normalized_retry) do
value = options&.dig(:retry)
if value.is_a?(Integer) value = value.is_a?(Integer) ? { max: value } : value.to_h
{ max: value }.with_indifferent_access value.with_indifferent_access
else
value || {}
end end
end end
......
...@@ -340,10 +340,10 @@ class AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0] ...@@ -340,10 +340,10 @@ class AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0]
end end
``` ```
On MySQL the `JSON` and `JSONB` is translated to `TEXT 1MB`, as `JSONB` is PostrgreSQL only feature. On MySQL the `JSON` and `JSONB` is translated to `TEXT 1MB`, as `JSONB` is PostgreSQL only feature.
For above reason you have to use serializer to provide translation layer For above reason you have to use a serializer to provide a translation layer
to support seamlessly PostgreSQL and MySQL: in order to support PostgreSQL and MySQL seamlessly:
```ruby ```ruby
class BuildMetadata class BuildMetadata
......
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