-
-
Save OldCrowEW/bb60c314dd69cfc221728e5ca0b7f66a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def getPlanStatus(runid) { | |
def result = "" | |
def response = httpRequest( | |
customHeaders: [[ name: "Authorization", value: "Bearer " + env.BEARER_TOKEN ]], | |
url: "https://app.terraform.io/api/v2/runs/${runid}" | |
) | |
def data = new JsonSlurper().parseText(response.content) | |
switch (data.data.attributes.status) { | |
case 'pending': | |
result = "noop" | |
break | |
... | |
case 'policy_override': | |
result = "approve_policy:" + data.data.relationships["policy-checks"].data[0].id | |
break | |
... | |
default: | |
result = "running" | |
break | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment