diff --git a/manifest.jps b/manifest.jps index 8a2f21c..a84d9fb 100644 --- a/manifest.jps +++ b/manifest.jps @@ -145,8 +145,11 @@ actions: targetEnv: ${env.envName} delete-redeploy-script: - - jelastic.dev.scripting.DeleteScript: - name: ${env.envName}-${globals.scriptName} + - script: | + return api.dev.scripting.DeleteScript({ + appid: api.dev.apps.CreatePersistence ? "${env.appid}" : appid, + name: "${env.envName}-${globals.scriptName}" + }); - web-hook: act: delete - if (nodes.build): diff --git a/scripts/create-redeploy-script.cs b/scripts/create-redeploy-script.cs index 3fe9541..7889cb6 100644 --- a/scripts/create-redeploy-script.cs +++ b/scripts/create-redeploy-script.cs @@ -5,6 +5,7 @@ import com.hivext.api.utils.Random; var buildEnv = "${env.envName}"; +var targetAppid = api.dev.apps.CreatePersistence ? "${env.appid}" : appid; //reading script from URL var scriptBody = new Transport().get(url) @@ -72,10 +73,10 @@ var scriptName = "${env.envName}-${globals.scriptName}"; //delete the script if it exists already -jelastic.dev.scripting.DeleteScript(scriptName); +api.dev.scripting.DeleteScript(targetAppid, session, scriptName); //create a new script -var resp = jelastic.dev.scripting.CreateScript(scriptName, 'js', scriptBody); +var resp = jelastic.dev.scripting.CreateScript(targetAppid, session, scriptName, 'js', scriptBody); if (resp.result != 0) return resp; //get app host @@ -87,7 +88,7 @@ call : { procedure : next, params : { - appid : appid, + appid : targetAppid, host : host, token : token }