mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Toolkit: catch errors from signing service (#23486)
This commit is contained in:
parent
2da704be55
commit
b710f21a06
@ -77,18 +77,23 @@ const manifestRunner: TaskRunner<ManifestOptions> = async ({ folder }) => {
|
||||
|
||||
console.log('Request Signature:', url);
|
||||
const axios = require('axios');
|
||||
const info = await axios.post(url, manifest, {
|
||||
headers: { Authorization: 'Bearer ' + GRAFANA_API_KEY },
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
if (info.status === 200) {
|
||||
console.log('OK: ', info.data);
|
||||
const buffer = new Buffer(info.data, 'binary');
|
||||
fs.writeFileSync(outputPath, buffer);
|
||||
} else {
|
||||
console.warn('Error: ', info);
|
||||
console.log('Saving the unsigned manifest');
|
||||
fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
|
||||
|
||||
try {
|
||||
const info = await axios.post(url, manifest, {
|
||||
headers: { Authorization: 'Bearer ' + GRAFANA_API_KEY },
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
if (info.status === 200) {
|
||||
console.log('OK: ', info.data);
|
||||
const buffer = new Buffer(info.data, 'binary');
|
||||
fs.writeFileSync(outputPath, buffer);
|
||||
} else {
|
||||
console.warn('Error: ', info);
|
||||
console.log('Saving the unsigned manifest');
|
||||
fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('ERROR Fetching response', err);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user