mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-07 15:16:56 +00:00
feat: add ignoreNotFound input
This commit is contained in:
parent
2fb925f14c
commit
d7e76c68c3
3 changed files with 23 additions and 2 deletions
|
|
@ -89,6 +89,10 @@ inputs:
|
|||
secretEncodingType:
|
||||
description: 'The encoding type of the secret to decode. If not specified, the secret will not be decoded. Supported values: base64, hex, utf8'
|
||||
required: false
|
||||
ignoreNotFound:
|
||||
description: 'Whether or not the action should exit successfully if some requested secrets were not found.'
|
||||
default: 'false'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
|
|
|||
11
dist/index.js
vendored
11
dist/index.js
vendored
|
|
@ -3702,6 +3702,7 @@ function asPromise(normalizedOptions) {
|
|||
request._beforeError(new types_1.HTTPError(response));
|
||||
return;
|
||||
}
|
||||
request.destroy();
|
||||
resolve(request.options.resolveBodyOnly ? response.body : response);
|
||||
});
|
||||
const onError = (error) => {
|
||||
|
|
@ -18935,6 +18936,7 @@ module.exports = {
|
|||
/***/ 8452:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
const core = __nccwpck_require__(2186);
|
||||
const jsonata = __nccwpck_require__(4245);
|
||||
const { WILDCARD } = __nccwpck_require__(4438);
|
||||
const { normalizeOutputKey } = __nccwpck_require__(1608);
|
||||
|
|
@ -18959,6 +18961,7 @@ const { normalizeOutputKey } = __nccwpck_require__(1608);
|
|||
* @return {Promise<SecretResponse<TRequest>[]>}
|
||||
*/
|
||||
async function getSecrets(secretRequests, client) {
|
||||
const ignoreNotFound = (core.getInput('ignoreNotFound', { required: false }) || 'false').toLowerCase() != 'false';
|
||||
const responseCache = new Map();
|
||||
let results = [];
|
||||
|
||||
|
|
@ -18979,7 +18982,13 @@ async function getSecrets(secretRequests, client) {
|
|||
} catch (error) {
|
||||
const {response} = error;
|
||||
if (response?.statusCode === 404) {
|
||||
throw Error(`Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}`)
|
||||
msg = `Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}\n`;
|
||||
if (ignoreNotFound) {
|
||||
process.stdout.write(msg);
|
||||
continue;
|
||||
} else {
|
||||
throw Error(msg);
|
||||
}
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
const core = require('@actions/core');
|
||||
const jsonata = require("jsonata");
|
||||
const { WILDCARD } = require("./constants");
|
||||
const { normalizeOutputKey } = require("./utils");
|
||||
|
|
@ -22,6 +23,7 @@ const { normalizeOutputKey } = require("./utils");
|
|||
* @return {Promise<SecretResponse<TRequest>[]>}
|
||||
*/
|
||||
async function getSecrets(secretRequests, client) {
|
||||
const ignoreNotFound = (core.getInput('ignoreNotFound', { required: false }) || 'false').toLowerCase() != 'false';
|
||||
const responseCache = new Map();
|
||||
let results = [];
|
||||
|
||||
|
|
@ -42,7 +44,13 @@ async function getSecrets(secretRequests, client) {
|
|||
} catch (error) {
|
||||
const {response} = error;
|
||||
if (response?.statusCode === 404) {
|
||||
throw Error(`Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}`)
|
||||
msg = `Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}\n`;
|
||||
if (ignoreNotFound) {
|
||||
process.stdout.write(msg);
|
||||
continue;
|
||||
} else {
|
||||
throw Error(msg);
|
||||
}
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue