Skip to content
Snippets Groups Projects
Commit bfa5295d authored by Pavel Shutsin's avatar Pavel Shutsin :two:
Browse files

Merge branch 'add-environment-scope-to-variable-type' into 'master'

Add `environment_scope` to `VariableType`

See merge request !91913
parents 2ef5a008 9766d471
No related branches found
No related tags found
1 merge request!91913Add `environment_scope` to `VariableType`
Pipeline #588926636 passed with warnings
......@@ -26,6 +26,15 @@ class VariableType < BaseObject
field :raw, GraphQL::Types::Boolean, null: true,
description: 'Indicates whether the variable is raw.'
field :environment_scope, GraphQL::Types::String, null: true,
description: 'Scope defining the environments in which the variable can be used.'
def environment_scope
if object.respond_to?(:environment_scope)
object.environment_scope
end
end
end
end
end
......@@ -10097,6 +10097,7 @@ GitLab CI/CD configuration template.
 
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="civariableenvironmentscope"></a>`environmentScope` | [`String`](#string) | Scope defining the environments in which the variable can be used. |
| <a id="civariableid"></a>`id` | [`ID!`](#id) | ID of the variable. |
| <a id="civariablekey"></a>`key` | [`String`](#string) | Name of the variable. |
| <a id="civariablemasked"></a>`masked` | [`Boolean`](#boolean) | Indicates whether the variable is masked. |
......@@ -5,7 +5,7 @@
RSpec.describe GitlabSchema.types['CiVariable'] do
it 'contains attributes related to CI variables' do
expect(described_class).to have_graphql_fields(
:id, :key, :value, :variable_type, :protected, :masked, :raw
:id, :key, :value, :variable_type, :protected, :masked, :raw, :environment_scope
)
end
end
......@@ -21,6 +21,7 @@
protected
masked
raw
environmentScope
}
}
}
......@@ -35,7 +36,7 @@
it "returns the group's CI variables" do
variable = create(:ci_group_variable, group: group, key: 'TEST_VAR', value: 'test',
masked: false, protected: true, raw: true)
masked: false, protected: true, raw: true, environment_scope: 'staging')
post_graphql(query, current_user: user)
......@@ -46,7 +47,8 @@
'variableType' => 'ENV_VAR',
'masked' => false,
'protected' => true,
'raw' => true
'raw' => true,
'environmentScope' => 'staging'
})
end
end
......
......@@ -17,6 +17,7 @@
protected
masked
raw
environmentScope
}
}
}
......@@ -39,7 +40,8 @@
'variableType' => 'ENV_VAR',
'masked' => false,
'protected' => true,
'raw' => true
'raw' => true,
'environmentScope' => nil
})
end
end
......
......@@ -21,6 +21,7 @@
protected
masked
raw
environmentScope
}
}
}
......@@ -35,7 +36,7 @@
it "returns the project's CI variables" do
variable = create(:ci_variable, project: project, key: 'TEST_VAR', value: 'test',
masked: false, protected: true, raw: true)
masked: false, protected: true, raw: true, environment_scope: 'production')
post_graphql(query, current_user: user)
......@@ -46,7 +47,8 @@
'variableType' => 'ENV_VAR',
'masked' => false,
'protected' => true,
'raw' => true
'raw' => true,
'environmentScope' => 'production'
})
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment