Environment

environment.Build

Estimated reading: 15 minutes 701 views
Namespace: Environment
REST: https://[hoster-api-host]/1.0/environment/build/rest/{method-name}
Scripting: environment.build.{method-name}
This service provides methods to manage Java project deployment from the version control system (VCS) repositories. The process requires a dedicated Maven build automation node that will build and deploy Java projects. With Maven, you can add any public or private project directly from your VCS repository (Git or SVN) using the appropriate link type: http, https, git (or svn). After the addition, Java projects can be deployed to the appropriate application servers. You can learn more about Java VCS Deployment with Maven in the linked document.

Methods

AddProject (envName, session, nodeId, name, type, path, [keyId], [login], [password], [targetEnv], [context], [branch], autoUpdate, [interval], autoResolveConflict, [delay], [deployNow], [hooks], [workDir], [targetNodeGroup], [isSequential] ) :

Adds the project from VCS to the environment.
Currently only username/password authentication is supported.
In case your environment contains more than one application server node, you need to call this method for each of them.

(use the AddProjectWithCreds or AddProjectWithKey methods instead).

URL

https://[hoster-api-host]/1.0/environment/build/rest/addproject

Deprecated

Parameters

  • envName : “string”
  • session : “string”
  • nodeId : “int”
  • name : “string”
  • type : “string”
  • path : “string”
  • keyId : “int” (optional)
  • login : “string” (optional)
  • password : “string” (optional)
  • targetEnv : “string” (optional)
  • context : “string” (optional)
  • branch : “string” (optional)
  • autoUpdate : “boolean”
  • interval : “string” (optional)
  • autoResolveConflict : “boolean”
  • delay : “int” (optional)
  • deployNow : “boolean” (optional)
  • hooks : “string” (optional)
  • workDir : “string” (optional)
  • targetNodeGroup : “string” (optional)
  • isSequential : “boolean” (optional)

Example

Method: POST

POST https://[hoster-api-host]/1.0/environment/build/rest/addproject?

targetNodeGroup=[string]&autoUpdate=[boolean]&deployNow=[boolean]&session=[string]&keyId=[int]&type=[string]&login=[string]&branch=[string]&isSequential=[boolean]&path=[string]&password=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&name=[string]&context=[string]&interval=[string]&workDir=[string]&nodeId=[int]&hooks=[string]&targetEnv=[string]

Response

  • BuildProjectResponse
    {
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "env": "string",
       "error": "string",
       "hash": "string",
       "hooks": "string",
       "id": "int",
       "interval": "string",
       "login": "string",
       "name": "string",
       "path": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "targetNodeGroup": "string",
       "type": "string",
       "workDir": "string"
    }
    

AddProjectWithCreds (envName, session, nodeId, name, type, path, [targetEnv], autoUpdate, autoResolveConflict, [login], [password], [context], [branch], [interval], [delay], [deployNow], [hooks], [workDir] ) : BuildProjectRespons

Adds Java project from the VCS repository to the environment with build node (Maven) using the login/password authentication method.

URL

https://[hoster-api-host]/1.0/environment/build/rest/addprojectwithcreds

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”
  • nodeId : “int”

    unique identifier of the build node.

  • name : “string”

    project name.

  • type : “string”

    VCS repository type (“GIT” or “SVN”).

  • path : “string”

    URL to the repository (including protocol).

  • targetEnv : “string” (optional)

    target environment name (with a Java application server).

  • autoUpdate : “boolean”

    defines whether to enable (true) or disable (false) automatic project updates (only upon code changes in the remote repository); auto-update frequency is set with the interval parameter.

  • autoResolveConflict : “boolean”

    defines whether to automatically resolve (true) or not (false) merge conflicts (by updating the contradictory files to the repository version, i.e. locally made changes are discarded).

  • login : “string” (optional)

    login for authentication in VCS.

  • password : “string” (optional)

    password or token for authentication in VCS.

  • context : “string” (optional)

    custom context name for the deployed project (ROOT by default).

  • branch : “string” (optional)

    remote repository branch (master by default).

  • interval : “string” (optional)

    delay (in minutes) for automatic project updates.

  • delay : “int” (optional)

    delay (in seconds) between two consecutive deployments when using the sequential deployment type (I.e. when deployment is performed on servers one-by-one to ensure uptime).

  • deployNow : “boolean” (optional)

    defines whether to just create (false) or create and immediately deploy (true) the project.

  • hooks : “string” (optional)

    JSON object with custom scripts (actual content) to be executed before and after the build/deployment operations. For example: {“preDeploy”:”script”, “postDeploy”:”script”, “preBuild”:”script”, “postBuild”:”script”}.

  • workDir : “string” (optional)

    relative path to the repository subdirectory with application source code.

Example

Method: POST

POST https://[hoster-api-host]/1.0/environment/build/rest/addprojectwithcreds?

autoUpdate=[boolean]&deployNow=[boolean]&session=[string]&type=[string]&login=[string]&branch=[string]&path=[string]&password=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&name=[string]&context=[string]&interval=[string]&workDir=[string]&nodeId=[int]&hooks=[string]&targetEnv=[string]

Response

  • BuildProjectResponse
    {
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "env": "string",
       "error": "string",
       "hash": "string",
       "hooks": "string",
       "id": "int",
       "interval": "string",
       "login": "string",
       "name": "string",
       "path": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "targetNodeGroup": "string",
       "type": "string",
       "workDir": "string"
    }
    

AddProjectWithKey (envName, session, nodeId, name, type, path, [targetEnv], autoUpdate, autoResolveConflict, [keyId], [context], [branch], [interval], [delay], [deployNow], [hooks], [workDir] ) :

Adds Java project from the VCS repository to the environment with build node (Maven) using the SSH key authentication method.

URL

https://[hoster-api-host]/1.0/environment/build/rest/addprojectwithkey

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeId : “int”

    unique identifier of the build node.

  • name : “string”

    project name.

  • type : “string”

    VCS repository type (“GIT” or “SVN”).

  • path : “string”

    URL to the repository (including protocol).

  • targetEnv : “string” (optional)

    target environment name (with a Java application server).

  • autoUpdate : “boolean”

    Defines whether to enable (true) or disable (false) automatic project updates (only upon code changes in the remote repository); auto-update frequency is set with the interval parameter.

  • autoResolveConflict : “boolean”

    defines whether to automatically resolve (true) or not (false) merge conflicts (by updating the contradictory files to the repository version, i.e. locally made changes are discarded).

  • keyId : “int” (optional)

    unique identifier of a private SSH key on the account. It can be found in the dashboard (account Settings > SSH Keys > Private Keys) or fetched with the Management > Account > GetSSHKeys method.

  • context : “string” (optional)

    custom context name for the deployed project (ROOT by default).

  • branch : “string” (optional)

    remote repository branch (master by default).

  • interval : “string” (optional)

    delay (in minutes) for automatic project updates.

  • delay : “int” (optional)

    delay (in seconds) between two consecutive deployments when using the sequential deployment type (I.e. when deployment is performed on servers one-by-one to ensure uptime).

  • deployNow : “boolean” (optional)

    defines whether to just create (false) or create and immediately deploy (true) the project.

  • hooks : “string” (optional)

    JSON object with custom scripts (actual content) to be executed before and after the build/deployment operations. For example: {“preDeploy”:”script”, “postDeploy”:”script”, “preBuild”:”script”, “postBuild”:”script”}.

  • workDir : “string” (optional)

    relative path to the repository subdirectory with application source code.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/addprojectwithkey?autoUpdate=[boolean]&deployNow=[boolean]&session=[string]&keyId=[int]&type=[string]&branch=[string]&path=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&name=[string]&context=[string]&interval=[string]&workDir=[string]&nodeId=[int]&hooks=[string]&targetEnv=[string]

Response

  • BuildProjectResponse
    {
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "env": "string",
       "error": "string",
       "hash": "string",
       "hooks": "string",
       "id": "int",
       "interval": "string",
       "login": "string",
       "name": "string",
       "path": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "targetNodeGroup": "string",
       "type": "string",
       "workDir": "string"
    }
    

BuildDeployProject (envName, session, nodeid, projectid, [delay], [update], [isSequential] ) :

Builds Java project added from the VCS repository and deploys it to the target environment.

URL

https://[hoster-api-host]/1.0/environment/build/rest/builddeployproject

Parameters

  • envName : “string”

    target environment name.

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int”

    unique identifier of the added project that should be built and deployed.

  • delay : “int” (optional)

    delay (in seconds) between two consecutive deployments when using the sequential deployment type (I.e. when deployment is performed on servers one-by-one to ensure uptime).

  • update : “boolean” (optional)

    defines whether to update (true) or not (false) the project before deployment.

  • isSequential : “boolean” (optional)

    defines whether to deploy project on application servers one-by-one to ensure uptime (true) or simultaneously (false).

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/builddeployproject?delay=[int]&envName=[string]&session=[string]&update=[boolean]&nodeid=[int]&projectid=[int]&isSequential=[boolean]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

BuildProject (envName, session, nodeid, projectid, [update], [skipPublish], [async] ) :

Builds Java project from the VCS repository and adds it to the list of archives in the platform Deployment Manager.

URL

https://[hoster-api-host]/1.0/environment/build/rest/buildproject

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int”

    unique identifier of the added project that should be built.

  • update : “boolean” (optional)

    defines whether to update (true) or not (false) the project before building.

  • skipPublish : “boolean” (optional)

    defines whether to add built project to the Deployment Manager (false) or not (true).

  • async : “boolean” (optional)

    defines whether to build projects asynchronously (true) or not (false).

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/buildproject?async=[boolean]&skipPublish=[boolean]&envName=[string]&session=[string]&update=[boolean]&nodeid=[int]&projectid=[int]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

DeployProject (envName, session, nodeid, projectid, [delay], [isSequential] ) :

Deploys Java project to the target environment.

URL

https://[hoster-api-host]/1.0/environment/build/rest/deployproject

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int”

    unique identifier of the built project that should be deployed.

  • delay : “int” (optional)

    delay (in seconds) between two consecutive deployments when using the sequential deployment type (I.e. when deployment is performed on servers one-by-one to ensure uptime).

  • isSequential : “boolean” (optional)

    defines whether to use sequential (true) or simultaneous (false) deployment type; the former can ensure uptime, and the latter is faster.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/deployproject?delay=[int]&envName=[string]&session=[string]&nodeid=[int]&projectid=[int]&isSequential=[boolean]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

EditProject (envName, session, nodeid, projectid, name, type, path, [keyId], [login], [password], [env], [context], [branch], [autoupdate], [interval], [autoResolveConflict], [delay], [hooks], [workDir], [targetNodeGroup] ) :

Applies required changes to the existing Java project from VCS.

URL

https://[hoster-api-host]/1.0/environment/build/rest/editproject

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int”

    unique identifier of the project.

  • name : “string”

    project name.

  • type : “string”

    VCS repository type (“GIT” or “SVN”).

  • path : “string”

    URL to the repository (including protocol).

  • keyId : “int” (optional)

    unique identifier of a private SSH key on the account. It can be found in the dashboard (account Settings > SSH Keys > Private Keys) or fetched with the Management > Account > GetSSHKeys method.

  • login : “string” (optional)

    login for authentication in VCS.

  • password : “string” (optional)

    password or token for authentication in VCS.

  • env : “string” (optional)

    target environment name (with a Java application server).

  • context : “string” (optional)

    custom context name for the deployed project (ROOT by default).

  • branch : “string” (optional)

    remote repository branch (master by default).

  • autoupdate : “boolean” (optional)

    defines whether to enable (true) or disable (false) automatic project updates (only upon code changes in the remote repository); auto-update frequency is set with the interval parameter.

  • interval : “string” (optional)

    delay (in minutes) for automatic project updates.

  • autoResolveConflict : “boolean” (optional)

    defines whether to automatically resolve (true) or not (false) merge conflicts (by updating the contradictory files to the repository version, i.e. locally made changes are discarded).

  • delay : “int” (optional)

    delay (in seconds) between two consecutive deployments when using the sequential deployment type (I.e. when deployment is performed on servers one-by-one to ensure uptime).

  • hooks : “string” (optional)

    JSON object with custom scripts (actual content) to be executed before and after the build/deployment operations. For example: {“preDeploy”:”script”, “postDeploy”:”script”, “preBuild”:”script”, “postBuild”:”script”}.

  • workDir : “string” (optional)

    relative path to the repository subdirectory with application source code.

  • targetNodeGroup : “string” (optional)

    target node group (layer) with Java application servers.

Example

Method: POST

POST https://[hoster-api-host]/1.0/environment/build/rest/editproject?

targetNodeGroup=[string]&session=[string]&keyId=[int]&type=[string]&login=[string]&env=[string]&branch=[string]&autoupdate=[boolean]&path=[string]&password=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&name=[string]&context=[string]&interval=[string]&workDir=[string]&nodeid=[int]&projectid=[int]&hooks=[string]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

GetProjectInfo (envName, session, nodeid, [projectid], [projectName] ) :

Returns information on the specific VCS project on the build node.

URL

https://[hoster-api-host]/1.0/environment/build/rest/getprojectinfo

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int” (optional)

    unique identifier of the project.

  • projectName : “string” (optional)

    project name.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/getprojectinfo?envName=[string]&session=[string]&projectName=[string]&nodeid=[int]&projectid=[int]

Response

  • BuildProjectResponse
    {
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "env": "string",
       "error": "string",
       "hash": "string",
       "hooks": "string",
       "id": "int",
       "interval": "string",
       "login": "string",
       "name": "string",
       "path": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "targetNodeGroup": "string",
       "type": "string",
       "workDir": "string"
    }
    

GetProjects (envName, session, [nodeGroup], [nodeId] ) :

Returns a list of VCS projects on the build node.

URL

https://[hoster-api-host]/1.0/environment/build/rest/getprojects

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeGroup : “string” (optional)

    unique identifier of the node group with a build node.

  • nodeId : “int” (optional)

    unique identifier of the build node.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/getprojects?envName=[string]&session=[string]&nodeGroup=[string]&nodeId=[int]

Response

  • BuildProjectResponses
    {
       "error": "string",
       "reason": "int",
       "responses": [
          {
             "autoResolveConflict": "boolean",
             "autoupdate": "boolean",
             "branch": "string",
             "context": "string",
             "env": "string",
             "error": "string",
             "hash": "string",
             "hooks": "string",
             "id": "int",
             "interval": "string",
             "login": "string",
             "name": "string",
             "path": "string",
             "reason": "int",
             "repoHash": "string",
             "result": "int",
             "source": "string",
             "targetNodeGroup": "string",
             "type": "string",
             "workDir": "string"
          },
          "..."
       ],
       "result": "int",
       "source": "string"
    }
    

RemoveProject (envName, session, nodeid, projectid ) :

Deletes the VCS project from the build node.

URL

https://[hoster-api-host]/1.0/environment/build/rest/removeproject

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeid : “int”

    unique identifier of the build node.

  • projectid : “int”

    unique identifier of the project.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/removeproject?envName=[string]&session=[string]&nodeid=[int]&projectid=[int]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

Update (envName, session, nodeId, [projectId], [context] ) :

Updates VCS project on the build node from the appropriate repository.

URL

https://[hoster-api-host]/1.0/environment/build/rest/update

Parameters

  • envName : “string”

    source environment name (with a build node).

  • session : “string”

    user session or personal access token.

  • nodeId : “int”

    unique identifier of the target (or build) node.

  • projectId : “int” (optional)

    unique identifier of the project.

  • context : “string” (optional)

    custom context name for the deployed project (ROOT by default).

Example

Method: POST

https://[hoster-api-host]/1.0/environment/build/rest/update?envName=[string]&session=[string]&context=[string]&nodeId=[int]&projectId=[int]

Response

  • Response
    {
       "error": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

Leave a Comment