Newer
Older
pmd-jenkins-library / vars / dataset.groovy
@Robin Gower Robin Gower on 17 Oct 2018 830 bytes drafter.findOrCreateDraftset
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 = drafter.findOrCreateDraftset(PMD, credentials, env.JOB_NAME as String) // 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)
    }
}