Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why ?
We would like to export new environment variables from v2 platform with the
projectsExport
. to then import to the same target environment withprojectsImport
task.Links / Ressources
#285
Actual status / Investigations
We checked for the api call for export v2:
Those are the ones we need
Query for
getting
all scope GLOBAL:Query for
getting
all scope PROJECT:Mutation for adding environment variables:
For scope GLOBAL
creation
:For scope GLOBAL
edition
:For scope PROJECT
creation
:For scope PROJECT
edition
:How?
Our work will be devided in two main part Export V2 and Import V2.
First part Export V2 :
Add object
EnvVariable
togroovy/io/saagie/plugin/dataops/models
with propertiesEnvVariable Class
scope
: Stringinclude_all_var
: booleanname
: ArrayListAdd
getGlobalEnvironmentVariables
togroovy/io/saagie/plugin/dataops/utils/SaagieUtils.groovy
that will fetch all global variablesAdd
getProjectEnvironmentVariables
togroovy/io/saagie/plugin/dataops/utils/SaagieUtils.groovy
that will fetch all project variablesupdating
exportArtifacts
toSaagieClient.groovy
, add the logic to get the list of variables from one the the querygetGlobalEnvironmentVariables
orgetProjectEnvironmentVariables
depending on the value of
scope
(global|project)Create a new Class
ExportVariables
that will includeExportVariables Class
name
: stringdescription
: stringisPassword
: booleanvalue
: stringscope
: stringoverriddenValues
: OverridenValuesOverridenValues Class
id
: StringExportVariables
we need to change theFolderGenerator
and add methodgenerateFolderForVariables
that will create a new folder for the exported variables.### Second part Import:
we need to added static method
extractVariableConfigAndPackageFromExportedVariables
in thegroovy/io/saagie/plugin/dataops/clients/SaagieClientUtils.groovy
whitch will extract the information for the exported variable.We create a callback
callbackVariablesToExport
which will be responsible for creating or updating variables from mutations.We create a new Class service
ImportVariableService
which will extract the Variable exported from the zip file and pass them tocallbackVariablesToExport
we change the log for the the resulting success of the task
projectsImport
to