Environment

environment.Vcs

Estimated reading: 8 minutes 603 views
Namespace: Environment
REST: https://[hoster-api-host]/1.0/environment/vcs/rest/{method-name}
Scripting: environment.vcs.{method-name}
This service is the tool for managing your VCS (version control system) projects. Configure periodic automatic deployment of the committed changes, and you can work with GIT/SVN repository only. Just commit the updated code to your VCS project. The platform will detect changes and automatically push them to the assigned environment. In contrast to the GIT hooks, the auto-deploy feature does not require configuration on the GIT side and works with SVN. Learn more in the documentation.

Methods

CreateProject (envName, session, type, context, url, [branch], [keyId], [login], [password], [autoupdate], [interval], [autoResolveConflict], [zdt], [updateNow], [nodeGroup], [hooks], [delay], [repoHash] ) :

Creates a new project for the specified environment based on sources from the remote VCS repository.

URL

https://[hoster-api-host]/1.0/environment/vcs/rest/createproject

Parameters

  • envName : “string”

    target environment name.

  • session : “string”
  • type : “string”

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

  • context : “string”

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

  • url : “string”

    URL to the repository (including protocol).

  • branch : “string” (optional)

    remote repository branch (master by default).

  • 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.

  • 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).

  • zdt : “boolean” (optional)

    defines whether to use zero-downtime deployment for PHP (true) or not (false).

  • updateNow : “boolean” (optional)

    defines whether to deploy your project immediately after its creation (true) or postpone this operation (false).

  • nodeGroup : “string” (optional)

    unique identifier of the target node group (layer), e.g. “cp” for the default application server layer.

  • 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”}.

  • 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).

  • repoHash : “string” (optional)

    target repository hash.

Example

Method: POST

POST https://[hoster-api-host]/1.0/environment/vcs/rest/createproject?

session=[string]&keyId=[int]&zdt=[boolean]&type=[string]&login=[string]&branch=[string]&nodeGroup=[string]&url=[string]&autoupdate=[boolean]&password=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&context=[string]&repoHash=[string]&interval=[string]&updateNow=[boolean]&hooks=[string]

Response

  • VcsResponse
    {
       "atomicDeploy": "boolean",
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "error": "string",
       "hash": "string",
       "interval": "string",
       "log": "string",
       "login": "string",
       "project": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "type": "SVN(0) | GIT(1)",
       "url": "string"
    }
    

DeleteProject (envName, session, context, [nodeGroup] ) :

Deletes an existing VCS project from the specified environment.

URL

https://[hoster-api-host]/1.0/environment/vcs/rest/deleteproject

Parameters

  • envName : “string”

    target environment name.

  • session : “string”

    user session or personal access token.

  • context : “string”

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

  • nodeGroup : “string” (optional)

    unique identifier of the target node group (layer), e.g. “cp” for the default application server layer.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/vcs/rest/deleteproject?envName=[string]&session=[string]&context=[string]&nodeGroup=[string]

Response

  • VcsResponse
    {
       "atomicDeploy": "boolean",
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "error": "string",
       "hash": "string",
       "interval": "string",
       "log": "string",
       "login": "string",
       "project": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "type": "SVN(0) | GIT(1)",
       "url": "string"
    }
    

EditProject (envName, session, type, oldcontext, newcontext, url, [branch], [keyId], [login], [password], autoupdate, [interval], autoResolveConflict, zdt, [nodeGroup], [hooks], [delay], [repoHash] ) :

Edits an existing VCS project for the specified environment.

URL

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

Parameters

  • envName : “string”

    target environment name.

  • session : “string”

    user session or personal access token.

  • type : “string”

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

  • oldcontext : “string”

    context name of the existing project.

  • newcontext : “string”

    new context name for the edited project.

  • url : “string”

    URL to the repository (including protocol).

  • branch : “string” (optional)

    remote repository branch (master by default).

  • 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.

  • 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.

  • interval : “string” (optional)

    delay (in minutes) for automatic project updates.

  • 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).

  • zdt : “boolean”

    defines whether to use zero-downtime deployment for PHP (true) or not (false).

  • nodeGroup : “string” (optional)

    unique identifier of the target node group (layer), e.g. “cp” for the default application server layer.

  • 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”}.

  • 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).

  • repoHash : “string” (optional)

    target repository hash.

Example

Method: POST

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

session=[string]&keyId=[int]&oldcontext=[string]&zdt=[boolean]&type=[string]&login=[string]&branch=[string]&nodeGroup=[string]&url=[string]&autoupdate=[boolean]&password=[string]&delay=[int]&autoResolveConflict=[boolean]&envName=[string]&repoHash=[string]&interval=[string]&hooks=[string]&newcontext=[string]

Response

  • VcsResponse
    {
       "atomicDeploy": "boolean",
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "error": "string",
       "hash": "string",
       "interval": "string",
       "log": "string",
       "login": "string",
       "project": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "type": "SVN(0) | GIT(1)",
       "url": "string"
    }
    

GetProject (envName, session, [context], [nodeGroup] ) :

Returns information about an existing VCS project from the specified environment.

URL

https://[hoster-api-host]/1.0/environment/vcs/rest/getproject

Parameters

  • envName : “string”

    target environment name.

  • session : “string”

    user session or personal access token.

  • context : “string” (optional)

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

  • nodeGroup : “string” (optional)

    unique identifier of the target node group (layer), e.g. “cp” for the default application server layer.

Example

Method: POST

https://[hoster-api-host]/1.0/environment/vcs/rest/getproject?envName=[string]&session=[string]&context=[string]&nodeGroup=[string]

Response

  • VcsResponse
    {
       "atomicDeploy": "boolean",
       "autoResolveConflict": "boolean",
       "autoupdate": "boolean",
       "branch": "string",
       "context": "string",
       "error": "string",
       "hash": "string",
       "interval": "string",
       "log": "string",
       "login": "string",
       "project": "string",
       "reason": "int",
       "repoHash": "string",
       "result": "int",
       "source": "string",
       "type": "SVN(0) | GIT(1)",
       "url": "string"
    }
    

Update (envName, session, context, [nodeGroup], [nodeId], [delay] ) :

Updates an existing VCS project for the specified environment.

URL

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

Parameters

  • envName : “string”

    target environment name.

  • session : “string”

    user session or personal access token.

  • context : “string”

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

  • nodeGroup : “string” (optional)

    unique identifier of the target node group (layer), e.g. “cp” for the default application server layer.

  • nodeId : “int” (optional)

    unique identifier of the target node (container).

  • delay : “int” (optional)

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

Example

Method: POST

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

Response

  • VcsUpdateResponse
    {
       "error": "string",
       "log": "string",
       "message": "string",
       "reason": "int",
       "result": "int",
       "source": "string"
    }
    

Leave a Comment