Update attributes of an environment
Script example to get an Environment and update its attributes.
Script
GROOVY
package com.apwide.golive.example
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
final owner = "Fred"
final team = "Red Team"
final teamUrl = "https://red-team.example.com"
def environments = goliveAccessor.golive().environments
def eCommerceStaging = environments.getByName("eCommerce Staging")
eCommerceStaging = eCommerceStaging.updateAttributes([
"Team": """<a href="${teamUrl}">${team}</a>""",
"Owner": owner,
])
return """
Updated environment : ${eCommerceStaging},
Team=${helper.getAttributeValue(eCommerceStaging, "Team")},
Owner=${helper.getAttributeValue(eCommerceStaging, "Owner")}
"""