Skip to content

Commit

Permalink
fix: allow customising launcher image (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
jithine authored Mar 1, 2021
1 parent 38010ff commit 7a1aa8e
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,33 @@ class DockerExecutor extends Executor {
/**
* Constructor
* @method constructor
* @param {Object} options Configuration options
* @param {Object} options.ecosystem Screwdriver Ecosystem
* @param {Object} options.ecosystem.api Routable URI to Screwdriver API
* @param {Object} options.ecosystem.store Routable URI to Screwdriver Store
* @param {Object} options.ecosystem.ui Routable URI to Screwdriver UI
* @param {Object} [options.docker] Docker configuration
* @param {String} [options.docker.protocol] Protocol to use
* @param {String} [options.docker.host] Docker Swarm host to interact with
* @param {String} [options.docker.port] Port number
* @param {String} [options.docker.socketPath] Docker socket to use
* @param {String} [options.docker.ca] Certificate authority
* @param {String} [options.docker.cert] Certificate to use
* @param {String} [options.docker.key] Key for the certificate
* @param {Object} [options.fusebox] Fusebox configuration
* @param {Object} [options.fusebox.breaker] Breaker configuration
* @param {Number} [options.fusebox.breaker.timeout=300000] Timeout before retrying
* @param {String} [options.launchVersion=stable] Launcher container version to use
* @param {String} [options.prefix=""] Prefix to all container names
* @param {Object} options Configuration options
* @param {Object} options.ecosystem Screwdriver Ecosystem
* @param {Object} options.ecosystem.api Routable URI to Screwdriver API
* @param {Object} options.ecosystem.store Routable URI to Screwdriver Store
* @param {Object} options.ecosystem.ui Routable URI to Screwdriver UI
* @param {Object} [options.docker] Docker configuration
* @param {String} [options.docker.protocol] Protocol to use
* @param {String} [options.docker.host] Docker Swarm host to interact with
* @param {String} [options.docker.port] Port number
* @param {String} [options.docker.socketPath] Docker socket to use
* @param {String} [options.docker.ca] Certificate authority
* @param {String} [options.docker.cert] Certificate to use
* @param {String} [options.docker.key] Key for the certificate
* @param {Object} [options.fusebox] Fusebox configuration
* @param {Object} [options.fusebox.breaker] Breaker configuration
* @param {Number} [options.fusebox.breaker.timeout=300000] Timeout before retrying
* @param {String} [options.launchImage=screwdrivercd/launcher] Launcher container version to use
* @param {String} [options.launchVersion=stable] Launcher container version to use
* @param {String} [options.prefix=""] Prefix to all container names
*/
constructor(options) {
super();

this.ecosystem = options.ecosystem;
this.docker = new Docker(options.docker);
this.launchVersion = options.launchVersion || 'stable';
this.launchImage = options.launchImage || 'screwdrivercd/launcher';
this.prefix = options.prefix || '';

const breakerOptions = hoek.applyToDefaults(
Expand Down Expand Up @@ -162,7 +164,7 @@ class DockerExecutor extends Executor {

return Promise.all([
this._createImage({
fromImage: 'screwdrivercd/launcher',
fromImage: this.launchImage,
tag: this.launchVersion
}),
this._createImage({
Expand All @@ -173,7 +175,7 @@ class DockerExecutor extends Executor {
.then(() =>
this._createContainer({
name: `${this.prefix}${config.buildId}-init`,
Image: `screwdrivercd/launcher:${this.launchVersion}`,
Image: `${this.launchImage}:${this.launchVersion}`,
Entrypoint: '/bin/true',
Labels: {
sdbuild: `${this.prefix}${config.buildId}`
Expand Down

0 comments on commit 7a1aa8e

Please sign in to comment.