Open sgokaram-saagie opened 4 years ago
Can you confirm that we can reset default value like this example build import for v1 environment variable :
plugins {
id 'groovy'
id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.4'
}
saagie {
server {
url = saagieurl
login = saagieuserid
password = saagiepassword
environment = saagieplatformid
jwt = true
acceptSelfSigned = true
}
env {
scope = 'project' // <==== override scope for variables to be soon imported
}
project {
id = saagieprojectid
}
importArtifacts {
import_file = "path/export.zip"
}
}
No thats not correct. Its
saagie { server {...}
project {
id = <project_uid>
}
importArtifacts {
import_file = <File Name with full path>
temporary_directory= < temporary directory used for extracting archive >
}
propertyOverride{
scope='project'
}
}
The override is during import of artifacts not during export
To clarify further , V1 does not have a concept of Global or Project but V2 has scope at Project and Global. To ensure compatibility between then below is the expected behavior
ExportV1 - When you export the variables from V1 you do not specify the 'scope' variable in the gradle task but the export artifact file ( i.e json file ) will have the scope always set to project, this way it can be directly imported into V2.
If an artifacat exported from V1 , you want to import this as a Global scope instead of project scope then you would use the propertyOverride during import and import them to be Global Variables.
How to test :
Version to test : 2.1.6
The Export phase:
Create a build file:
Example of build.projectsExport.gradle
:
plugins {
id 'groovy'
id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.6'
}
saagie {
server {
url = saagieurl
login = saagieuserid
password = saagiepassword
environment = 4
jwt = true
acceptSelfSigned = true
}
env {
include_all_var=true
}
exportArtifacts {
export_file = "/home/zouhair/bear/saagie/test_gradle/302.zip"
temporary_directory = '/home/zouhair/bear/saagie/test_gradle/tmp'
overwrite = true
}
importArtifacts {
import_file = "./job/export.zip"
temporary_directory='./tmp'
}
}
Export job using this commande :
The command line : gradle -b build.projectsExport.gradle projectsExportV1
The import phase:
Create a new build file: Example : build.projectsImport.gradle:
plugins {
id 'groovy'
id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.4'
}
saagie {
server {
url = "REPLACE_SAAGIEURL"
login = "REPLACE_SAAGIELOGIN"
password = "REPLACE_SAAGIEPASSWORD"
environment = "REPLACE_SAAGIE"
jwt = true
acceptSelfSigned = true
}
project {
id = "REPLACE_SAAGIE_PROJECT_ID"
}
propertyOverride{
scope='global'
}
importArtifacts {
import_file = "./job/export.zip"
temporary_directory='./tmp'
}
}
Then use this command line:
The command line : gradle -b build.projectsImport.gradle projectsImport
Expected behvior
Success message and importing jobs but not importing all theirs versions
Looks like there was some confusion. For V1 there is no scope, all env are technically Global in V1.