Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const purge = (provisionerId, workerType, selectedCaches, successMessage) => {
// Setup purgeCache
const purgeCache = localStorage.credentials ?
new taskcluster.PurgeCache({credentials: JSON.parse(localStorage.credentials)}) :
new taskcluster.PurgeCache();
return async dispatch => {
dispatch(taskActionsInProgress(true));
try {
const promises = selectedCaches
.map(cacheName => purgeCache.purgeCache(provisionerId, workerType, {cacheName}));
await Promise.all(promises);
dispatch(renderActionSuccess(successMessage));
dispatch(taskActionsInProgress(false));
} catch (err) {
dispatch(renderActionError(err));
dispatch(taskActionsInProgress(false));
run: async () => {
let purge = new taskcluster.PurgeCache(taskcluster.fromEnvVars());
const provisionerId = 'built-in';
const workerType = 'succeed';
const payload = {
cacheName: 'smoketest-cache',
};
await purge.purgeCache(provisionerId, workerType, payload);
const pretendWorker = await purge.purgeRequests(provisionerId, workerType);
assert.equal(pretendWorker.requests[0].cacheName, payload.cacheName, "Error");
},
});
let config = require('typed-env-config');
let taskcluster = require('taskcluster-client');
let cfg = config({profile: 'verify'});
let purgeCache = new taskcluster.PurgeCache({
...cfg.taskcluster,
});
purgeCache.purgeCache(
'verifyprovisioner',
'verifyworker',
{cacheName: 'verifycache'}
).catch(function(err) {console.log(err);});
module.exports = options => ({
auth: new Auth(options),
github: new Github(options),
hooks: new Hooks(options),
index: new Index(options),
purgeCache: new PurgeCache(options),
queue: new Queue(options),
secrets: new Secrets(options),
queueEvents: new QueueEvents(options),
notify: new Notify(options),
workerManager: new WorkerManager(options),
});