#!groovy

def pypi_ansible = ["curl", "-s", "-H", "Accept: application/json", "-H", "Content-type: application/json", "GET", "https://pypi.org/pypi/ansible/json"].execute().text
def pypi_ansible_latest = new groovy.json.JsonSlurper().parseText(pypi_ansible).info.version        // Use `info.version` instead of `.releases.keySet()[-1]`, to avoid alpha and release candidate versions

node {
    stage('Call ansible/blockdevmap-release-tag') {
        build job: 'ansible/blockdevmap-release-tag', parameters: [string(name: 'NEW_VERSION', value: "next"), string(name: 'ANSIBLE_VERSION', value: pypi_ansible_latest)]
    }
}