The Golive Java API is a powerful tool that empowers your teams to effortlessly manage deployments in your Atlassian environment. Whether you're using Groovy scripts with ScriptRunner or custom-made Atlassian plugins, this API provides a fluent and intuitive way to interact with deployment processes, saving you time and reducing the risk of errors.
You can access Golive Java API from ScriptRunner with the following snippet:
import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.apwide.env.api.GoliveAccessor @WithPlugin("com.holydev.env.plugin.jira-holydev-env-plugin") @PluginModule GoliveAccessor goliveAccessor def golive = goliveAccessor.golive()
From there, you can use golive instance to interact with Golive.
Golive Java API is a fluent api organized into different domains for ease of use and to provide a structured approach to interacting with various aspects of the environment management:
environments: find environments by id, name, application and category, updated environment details…
deployments: search deployments, deploy new versions…
environmentFields: find field from an issue by name, get/set values for a given issue field…
applications: find applications.
environmentCategories: find categories.
Example to get an environment by application and category name:
def ecomStagingEnvironment = golive.environments.getByAppCat("eCommerce", "Staging")
To streamline operations on your environments, fluent api expose available operations directly on the returned objects. If we want to deploy a new version on the returned environment, we can do it directly on the instance by building a deployment request:
def deployment = ecomStagingEnvironment.deploy(com.apwide.env.api.Deployments.DeploymentRequest .builder() .versionName("1.4.5") .buildNumber("#345") .description(""" Release Notes: - bugs fixed: BUG-123, BUG-344 - new features: FEAT-34, FEAT-56 """) .attribute("Team", "firstname.lastname@example.org") .build())
By default, the Golive API acts on behalf of the authenticated user who is making the API calls. This ensures that proper permissions and access controls are enforced.
In certain scenarios, you may need to bypass user authentication and perform actions on behalf of the system. To achieve this, you can call the
golive.bypassSecurity method, which returns an instance of the API that bypasses security checks but supports exact same protocol:
def noSecurityGolive = golive.bypassSecurity() def ecomProdEnvironment = noSecurityGolive.environments.getByAppCat("eCommerce", "Production")
Use this with caution, as it can have security implications.
Explore a range of sample scripts that can be utilized as-is, or adapted to suit your particular requirements:
If you encounter any issues, need assistance or would like to see additional capabilities in the Java API, our dedicated support team is here to help. Contact us at email@example.com.