Registry / devops / screwdriver-queue-worker

screwdriver-queue-worker

JSON →
library2.10.1jsnpmunverified

A Resque Worker implementation for Screwdriver CD that consumes jobs from a Resque queue and executes builds in designated execution engines. Current stable version is 2.10.1, maintained by Yahoo. It handles starting and stopping build tasks, supports configuration via YAML or environment variables, and integrates with the Screwdriver API. Key differentiator: it provides a pluggable executor interface for CI/CD pipelines, built specifically for the Screwdriver ecosystem.

npm install screwdriver-queue-worker
INSTALL
IMPORT
SIG · SCREWDRIVER-QUEUE-
S
screwdriver-queue-worker
devopsjavascriptv2.10.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QueueWorker
import QueueWorker from 'screwdriver-queue-worker'
const { QueueWorker } = require('screwdriver-queue-worker')
Default export since v2.0.0
start
const worker = new QueueWorker(); worker.start(config, callback)
QueueWorker.start(config)
Must instantiate before calling start method
stop
const worker = new QueueWorker(); worker.stop(config, callback)
QueueWorker.stop(config)
Must instantiate before calling stop method
QueueWorker type
import type { QueueWorkerConfig } from 'screwdriver-queue-worker'
import { QueueWorkerConfig } from 'screwdriver-queue-worker'
Config type is only exported as a type, not a value

Demonstrates creating a QueueWorker instance, starting a build with required config, and stopping it, including error handling callbacks.

import QueueWorker from 'screwdriver-queue-worker'; import config from 'config'; const worker = new QueueWorker(config.get('queueWorker')); worker.start( { annotations: {}, apiUri: 'https://api.screwdriver.cd', buildId: 'abc123', container: 'node:18', token: process.env.SD_TOKEN ?? '', jobId: 'job123', blockedBy: 'job456' }, (err, result) => { if (err) { console.error('Failed to start build:', err); return; } console.log('Build started:', result); } ); worker.stop( { annotations: {}, buildId: 'abc123', jobId: 'job123', blockedBy: 'job456' }, (err, result) => { if (err) { console.error('Failed to stop build:', err); return; } console.log('Build stopped:', result); } );
Debug
Known issues
gotchaThe start and stop methods require a callback function; not providing one will cause the queue job to hang.
fix
Always provide a callback function when calling start() or stop().
affects: >=1.0.0 <3.0.0
breakingVersion 2.0.0 changed from CommonJS to ES modules. require() will fail.
fix
Use import syntax or set type: module in package.json.
affects: >=2.0.0
deprecatedThe 'blockedBy' parameter is deprecated in v2.5.0 and will be removed in a future release.
fix
Use 'jobId' and pipeline-level blocking configuration instead.
affects: >=2.5.0
gotchaQueueWorker constructor expects a configuration object with queue options; omitting it will use defaults which may not connect to your Redis instance.
fix
Pass a configuration object or ensure default config matches your environment.
affects: >=1.0.0
gotchaThe 'token' parameter must be a valid JWT for the Screwdriver API; expired tokens cause silent failures.
fix
Validate the token is current and has correct permissions before starting a build.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: worker.start is not a function
Forgot to instantiate QueueWorker with new keyword
fix
Change to const worker = new QueueWorker(config); worker.start(...)
Error: Cannot find module 'screwdriver-queue-worker'
Package not installed or wrong import path
fix
Run npm install screwdriver-queue-worker and use relative path if installed locally.
ReferenceError: require is not defined in ES module scope
Using require() in an ES module environment without default import
fix
Use import QueueWorker from 'screwdriver-queue-worker' instead of require.
Upgrade
Version history
2.10.1latest on npm
Audit
Dependencies
configrequiredDefault configuration and environment variable support
screwdriver-executor-baserequiredExecutor interface base class
resquerequiredResque queue job processing
Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
screwdriver-queue-worker — npm install screwdriver-queue-worker · libregistry