Class: PEClient::Resource::CodeManagerV1

Inherits:
BaseWithPort show all
Defined in:
lib/pe_client/resources/code_manager.v1.rb

Overview

You can use the Code Manager API to deploy code and check the status of deployments on your primary server and compilers without direct shell access.

Constant Summary collapse

BASE_PATH =

The base path for Code Manager API v1 endpoints.

"/code-manager/v1"
PORT =

Default Code Manager API Port

8170

Instance Method Summary collapse

Methods inherited from BaseWithPort

#initialize

Constructor Details

This class inherits a constructor from PEClient::Resource::BaseWithPort

Instance Method Details

#deploys(deploy_all: nil, environments: nil, deploy_modules: nil, modules: nil, wait: nil, dry_run: nil) ⇒ Array

Trigger Code Manager to deploy code to a specific environment or all environments, or use the dry-run parameter to test your control repo connection.

Parameters:

  • deploy_all (Boolean) (defaults to: nil)

    Set to true if you want to trigger code deployments for all known environments. If false or omitted, you must include the environments key.

  • environments (Array<String>) (defaults to: nil)

    Specify the names of one or more specific environments for which you want to trigger code deployments. This key is required if deploy-all is false or omitted.

  • deploy_modules (Boolean) (defaults to: nil)

    Indicate whether Code Manager deploys modules declared in an environment’s Puppetfile. If false, modules aren’t deployed. If omitted, the default value is true.

  • modules (Array<String>) (defaults to: nil)

    Specific modules to deploy.

  • wait (Boolean) (defaults to: nil)

    Indicates how soon you want Code Manager to return a response. If false or omitted, Code Manager returns a list of queued deployments immediately after receiving the request. If true, Code Manager returns a more detailed response after all deployments have finished (either successfully or with an error).

  • dry_run (Boolean) (defaults to: nil)

    Use to test Code Manager’s connection to your source control provider. If true, Code Manager attempt to connect to each of your remotes, attempts to fetch a list of environments from each source, and reports any connection errors.

Returns:

  • (Array)

See Also:



51
52
53
54
55
56
# File 'lib/pe_client/resources/code_manager.v1.rb', line 51

def deploys(deploy_all: nil, environments: nil, deploy_modules: nil, modules: nil, wait: nil, dry_run: nil)
  @client.post "#{BASE_PATH}/deploys", body: {
    environments:, modules:, wait:,
    "deploy-all": deploy_all, "deploy-modules": deploy_modules, "dry-run": dry_run
  }.compact
end

#status(id: nil) ⇒ Hash

Get the status of code deployments that Code Manager is currently processing for each environment. You can specify an id query parameter to get the status of a particular deployment.

Parameters:

  • id (Integer) (defaults to: nil)

    Get the status of a specific deployment by calling its position in the current deployment queue.

Returns:

  • (Hash)


80
81
82
# File 'lib/pe_client/resources/code_manager.v1.rb', line 80

def status(id: nil)
  @client.get "#{BASE_PATH}/deploys/status", params: {id:}.compact
end

#webhook(type:, prefix: nil, token: nil) ⇒ Hash

Deploy code by triggering your Code Manager webhook.

Parameters:

  • type (String)

    Identifies your Git host.

  • prefix (String) (defaults to: nil)

    Required if your source configuration uses prefixing. Specifies the prefix to use when converting branch names to environment names.

  • token (String) (defaults to: nil)

    Required unless you disabled authenticate_webhook in your Code Manager configuration. You must supply the authentication token in the token parameter. Tokens supplied in query parameters might appear in access logs.

Returns:

  • (Hash)

See Also:



70
71
72
# File 'lib/pe_client/resources/code_manager.v1.rb', line 70

def webhook(type:, prefix: nil, token: nil)
  @client.post "#{BASE_PATH}/webhook", params: {type:, prefix:, token:}.compact
end