saagie / gradle-saagie-dataops-plugin

Saagie Gradle Plugin for the new version (2.0) of Saagie Dataops Orchestrator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error 500 when exporting global scope variables

medamineziraoui opened this issue · comments

When using this build with this command line
gradle -b build.exportV2.gradle projectsExport

File name : Build.exportV2.gradle

plugins {
    id 'groovy'
    id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.4'
}

saagie {
    server {
        url = saagieurl
        login = saagieuserid
        password = saagiepassword
        environment = 4
        jwt = true
        acceptSelfSigned = true
    }
    
    project {
        id = saagieprojectid
    }
    
    env {
        include_all_var = true
        scope = 'global'
    }

    exportArtifacts {
        export_file = "/test_gradle/variable_export_4.zip"
        temporary_directory='/test_gradle/tmp'
        overwrite=true
    }
}

We get build failure :

> Task :projectsExport FAILED
Error 500 when requesting 


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':projectsExport'.
> Error 500 when requesting 

Release 2.1.2

How to test :
Export variables:

plugins {
    id 'groovy'
    id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.2'
}

saagie {
    server {
        url = saagieurl
        login = saagieuserid
        password = saagiepassword
        environment = 4
        jwt = true
        acceptSelfSigned = true
    }
    
    project {
        id = saagieprojectid
    }
    
    env {
        include_all_var = false // <==== should be true or false
        scope = 'project' // <=== alternate between project | global
        name = ['PROJECT_VAR', 'pro'] // <===== name should bot be empty if include_all_var is false
    }

    exportArtifacts {
        export_file = "/path/to/exported/variable/export_variables.zip"
        overwrite=true
    }
}

Commande line :
gradle -b build.exportV2.gradle projectsExport

case scope is global and include_all_var is true :
exportV2ScopeGlobalAllVars

case scope is global and include_all_var is false with names defined:
exportV2ScopeGlobalVarsByName

case scope is project and ( include_all_var is true and include_all_var is false with names defined )
exportV2ScopeProjectAllVarAndByName
:

Import Variables :

plugins {
    id 'groovy'
    id 'io.saagie.gradle-saagie-dataops-plugin' version '2.1.2'
}

saagie {
    server {
        url = saagieurl
        login = saagieuserid
        password = saagiepassword
        environment = saagieplatformid
        jwt = true
        acceptSelfSigned = true
    }

    project {
        id = saagieprojectid
    }

    importArtifacts {
        import_file = "/path/to/export/fileShouldExist/export_project_var.zip" // <==== switch between export_project_var and export_global_var_name for global var import and project var import

    }
}

export_project_var :
export_project_var.zip

export_global_var_name :
export_global_var_name.zip

Commande line :
gradle -b build.import.gradle projectsImport

Should have successful build:

{status=success, job=[], pipeline=[], variable=[{id=id, name=PROJECT_VAR_FROM_TEST_2.1.2}, {id=id, name=pro_FROM_PROJECT_2.1.2}]}
BUILD SUCCESSFUL in 3s

Importing environment variable test for global scope:
importv2globalscope

Importing environment variable test for project scope:
IMPORTANT NOTE: Those variables shouldn t exist on the server.
importv2projectvar

  • i have tested the issue for the exportV2 : test works successfully as expected

293

  • i have tested the issue for the importV2 : test works successfully as expected

293-import

  • It's validated for me

Test for release 2.1.5

  • i have tested the issue for the exportV2 : test works successfully as expected

293exportNew

  • i have tested the issue for the importV2 : test works successfully as expected

293importNew

  • It's validated for me