-
-
Save nishantagarwal1990/8be1f02f6d68edcfcccd59bbc40189b0 to your computer and use it in GitHub Desktop.
Setting access key for Metrics Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.kohsuke.stapler.* | |
import jenkins.metrics.api.* | |
import net.sf.json.JSONObject | |
def metrics = jenkins.model.Jenkins.instance.getExtensionList(jenkins.metrics.api.MetricsAccessKey.DescriptorImpl)[0] | |
def req = Stapler.getCurrentRequest(); | |
JSONObject obj = new JSONObject(); | |
JSONObject child_obj = new JSONObject(); | |
child_obj.put("key", "33DD8B2F1FD645B814993275703F_EE1FD4D4E204446D5F3200E0F6-C55AC14E"); | |
child_obj.put("canPing", "true"); | |
child_obj.put("canHealthCheck", "true"); | |
child_obj.put("canMetrics", "true"); | |
child_obj.put("origins", "*"); | |
obj.put("accessKeys", child_obj); | |
metrics.configure(req, obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment