Newer
Older
pmd-jenkins-library / vars / dataset.groovy
@Robin Gower Robin Gower on 17 Oct 2018 775 bytes Split draft creation and use
def delete(String datasetLabel) {
    echo "Deleting dataset graphs from label ${datasetLabel}"

    configFileProvider([configFile(fileId: 'pmd', variable: 'configfile')]) {
        def config = readJSON(text: readFile(file: configfile))
        String PMD = config['pmd_api']
        String credentials = config['credentials']
        String baseURI = config['base_uri']

        def draftset = jobDraft.find() // assume it already exists

        String datasetPath = util.slugise(datasetLabel)
        String datasetGraph = "${baseURI}/graph/${datasetPath}"
        String metadataGraph = "${datasetGraph}/metadata"
        drafter.deleteGraph(PMD, credentials, draftset.id, metadataGraph)
        drafter.deleteGraph(PMD, credentials, draftset.id, datasetGraph)
    }
}