saagie / gradle-saagie-dataops-plugin

Saagie Gradle Plugin for the new version (2.0) of Saagie Dataops Orchestrator
Apache License 2.0
2 stars 0 forks source link

Pipeline Import fails with error #259

Closed sgokaram-saagie closed 4 years ago

sgokaram-saagie commented 4 years ago

Exported a V1 pipeline - 484.

Tried to import this pipeline , but this failed with error

saagies-mbp:Gradle shivakumar$ gradle projectImportPipelineWithJobandVersion

Task :projectExportPipelineWithJobandVersion {"status":"success","exportfile":"./pipeline/pipelinejobver.zip"}

Task :projectImportPipelineWithJobandVersion FAILED Something went wrong when adding new job version: {"errors":[{"message":"Unexpected error"}],"data":null}

FAILURE: Build failed with an exception.

BUILD FAILED in 37s 2 actionable tasks: 2 executed

medamineziraoui commented 4 years ago

When exporting a pipeline from the v1 you must include _job because when importing the pipeline we search for the job name in the jobs property of the pipeline from the job list of the v2. and since we export pipeline from v1, the jobs that contains are from v1. so if we don t export them from v1, the import will not find them. i don t see a simple way to fix this.

sgokaram-saagie commented 4 years ago

So if thats not an option then why even ask , automatically make it true or do it. I dont see the point of the option, we should just remove it for v1 then.

medamineziraoui commented 4 years ago

Alright roger that :+1:

medamineziraoui commented 4 years ago

Duplication with #232

medamineziraoui commented 4 years ago

How to test :

Version to test : 2.0.28 We going to call this process Export/Import-job

The Export phase:

Create a build file: Example of build.projectsExportV1.gradle:

plugins {
  id "io.saagie.gradle-saagie-dataops-plugin" version "2.0.28"
}
saagie {
    server {
        url = "REPLACE_SAAGIEURL"
        login = "REPLACE_SAAGIELOGIN"
    password = "REPLACE_SAAGIEPASSWORD"
        environment = "REPLACE_SAAGIE"
    jwt = true
    }
    pipeline {
          ids =  [ "484" ]
        }
    exportArtifacts {
          export_file = "./job/export.zip" // <=== url "./job/" should exist  
          overwrite=true
      temporary_directory='./tmp'    // <=== temporary_directory ./tmp'  should exist        
    }
}

Export job using this commande : The command line : gradle -b build.projectsExportV1.gradle projectsExportV1

The Import phase:

Create a build file: Example of build.projectsImport.gradle:

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

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

    project {
        id = saagieProject
    }

    importArtifacts {
        import_file = "./job/export.zip"
        temporary_directory='/import/path/must/exist/tmp'
    }
}

Import job using this commande : The command line : gradle -b build.projectsImport.gradle projectsImport

You should get

> Task :projectsImport
{status=success, job=[{id=2779, name=ERP Data Cleansing}, {id=2778, name=Import ERP Data}, {id=9726, name=Build model (sales / ERP)}, {id=2777, name=Build new Model}], pipeline=[{id=484, name=Churn Update model}]}

BUILD SUCCESSFUL in 11s
1 actionable task: 1 executed