Skip to main content
Skip table of contents

Update deployment of an environment

Script example to update the deployed version and other deployment attributes of an environment.

Script

GROOVY
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.apwide.env.api.GoliveAccessor
import com.apwide.env.api.Deployments.DeploymentRequest

@WithPlugin("com.holydev.env.plugin.jira-holydev-env-plugin")
@PluginModule
GoliveAccessor goliveAccessor

def golive = goliveAccessor.golive()
def eCommerceStaging = golive.environments.getByName("eCommerce Staging")
def versionName = "My new version name"

def deployment = eCommerceStaging.deploy(DeploymentRequest.builder()
    .versionName("My new version name")
    .versionId("10001")
    .buildNumber("#345")
    .description("""Release Notes:

  - bugs fixed: BUG-123, BUG-344
  - new features: FEAT-34, FEAT-56
  
  Full release notes: <a href="https://my-release-notes.example.com/$versionName">$versionName</a>
""")
    .attribute("Components", "frontend, backend, api")
    .attribute("Team", "red-team@example.com")
    .build())

return """
  Deployed version name=${deployment.versionName},
  Deployed version id=${deployment.versionId},
  Deployed build number=${deployment.buildNumber},
  Deployed on=${deployment.deployed},
  Deployment description=${deployment.description},
  Deployment attributes=${deployment.attributes?.flatten({"${it.attribute.name}=${it.value}"})}}
"""

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.