diff --git a/vars/uploadCodelist.groovy b/vars/uploadCodelist.groovy new file mode 100644 index 0000000..1ddc6a6 --- /dev/null +++ b/vars/uploadCodelist.groovy @@ -0,0 +1,16 @@ +def call(String csv, String name) { + configFileProvider([configFile(fileId: 'pmd', variable: 'configfile')]) { + def config = readJSON(text: readFile(file: configfile)) + String PMD = config['pmd_api'] + String credentials = config['credentials'] + String PIPELINE = config['pipeline_api'] + String baseURI = config['base_uri'] + + def draft = jobDraft.find() + + runPipeline("${PIPELINE}/ons-table2qb.core/codelist/import", + draft.id, credentials, [[name: 'codelist-csv', + file: [name: csv, type: 'text/csv']], + [name: 'codelist-name', value: name]]) + } +} diff --git a/vars/uploadComponents.groovy b/vars/uploadComponents.groovy new file mode 100644 index 0000000..3f431bd --- /dev/null +++ b/vars/uploadComponents.groovy @@ -0,0 +1,15 @@ +def call(String csv) { + configFileProvider([configFile(fileId: 'pmd', variable: 'configfile')]) { + def config = readJSON(text: readFile(file: configfile)) + String PMD = config['pmd_api'] + String credentials = config['credentials'] + String PIPELINE = config['pipeline_api'] + String baseURI = config['base_uri'] + + def draft = jobDraft.find() + + runPipeline("${PIPELINE}/ons-table2qb.core/components/import", + draft.id, credentials, [[name: 'components-csv', + file: [name: csv, type: 'text/csv']]]) + } +}