diff --git a/manifest.jps b/manifest.jps index e902329..17bb072 100644 --- a/manifest.jps +++ b/manifest.jps @@ -3,7 +3,7 @@ version: 1.7 id: git-push-deploy name: Git-Push-Deploy Add-On homepage: https://www.virtuozzo.com/application-platform-docs/git-push-deploy/ -baseUrl: https://cdn.jsdelivr.net/gh/jelastic-jps/git-push-deploy@master +baseUrl: https://raw.githubusercontent.com/sych74/git-push-deploy/refs/heads/JE-72978 description: text: /text/description.md short: Simple CI/CD pipeline for Git projects. diff --git a/scripts/redeploy.cs b/scripts/redeploy.cs index b23672c..5fc03ce 100644 --- a/scripts/redeploy.cs +++ b/scripts/redeploy.cs @@ -1,4 +1,5 @@ //@req(token, action) +import com.hivext.api.server.system.service.utils.EnvironmentStatus; if (token == "${TOKEN}") { var targetEnv = "${TARGET_ENV}", nodeGroup = "${NODE_GROUP}", @@ -12,6 +13,19 @@ build = ${BUILD}, context = "${CONTEXT}"; + + var resp = jelastic.env.control.GetEnvInfo(envName, session); + if (resp.result != 0) return resp; + var status = resp.env.status; + var isEnvRunning = status == EnvironmentStatus['ENV_STATUS_TYPE_RUNNING'].getValue() ? true : false; + + if (!isEnvRunning) { + if (jelastic.marketplace && jelastic.marketplace.console) { + jelastic.marketplace.console.WriteLog(appid, session, "GIT-PUSH-DEPLOY: environment is not running"); + } + return { result: 0 }; + } + if (action == 'redeploy') { if (certified) { return {result:99, error: 'redeploy action triggers automatically for certified containers', type: 'warning'};