diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4c1bff..3dc6b727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! This project adheres to [Semantic Versioning](http://semver.org/). +## v7.16.7 - 2018-08-16 + +* Update docker-toolbelt to pull in typings #727 [Cameron Diver] +* Refactor: Add docker-utils typings #727 [Cameron Diver] +* Refactor: Convert log-types module to typescript #727 [Cameron Diver] + ## v7.16.6 - 2018-08-13 * Docs: Add documentation for the v2/applications/state endpoint #722 [Cameron Diver] diff --git a/package.json b/package.json index 8baa4abb..c9a92282 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "resin-supervisor", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", - "version": "7.16.6", + "version": "7.16.7", "license": "Apache-2.0", "repository": { "type": "git", @@ -42,7 +42,7 @@ "dbus-native": "^0.2.5", "docker-delta": "^2.1.0", "docker-progress": "^2.7.2", - "docker-toolbelt": "^3.2.1", + "docker-toolbelt": "^3.3.2", "duration-js": "^4.0.0", "event-stream": "^3.0.20", "express": "^4.0.0", diff --git a/src/lib/docker-utils.d.ts b/src/lib/docker-utils.d.ts new file mode 100644 index 00000000..6c057fae --- /dev/null +++ b/src/lib/docker-utils.d.ts @@ -0,0 +1,35 @@ +import * as Bluebird from 'bluebird'; +import DockerToolbelt = require('docker-toolbelt'); + +// This is the EnvVarObject from src/lib/types, but it seems we cannot +// reference it relatively. Just redefine it as it's simple and won't change +// often + +interface EnvVarObject { + [name: string]: string; +} + +interface TaggedRepoImage { + repo: string; + tag: string; +} + +declare class DockerUtils extends DockerToolbelt { + constructor(opts: any); + + getRepoAndTag(image: string): Bluebird; + + fetchDeltaWithProgress(imgDest: string, fullDeltaOpts: any, onProgress: (args: any) => void): Bluebird; + + fetchImageWithProgress( + image: string, + config: { uuid: string, currentApiKey: string }, + onProgress: (args: any) => void, + ): Bluebird; + + getImageEnv(id: string): Bluebird; + getNetworkGateway(netName: string): Bluebird; + +} + +export = DockerUtils; diff --git a/src/lib/log-types.coffee b/src/lib/log-types.coffee deleted file mode 100644 index 65993971..00000000 --- a/src/lib/log-types.coffee +++ /dev/null @@ -1,132 +0,0 @@ -module.exports = - stopService: - eventName: 'Service kill' - humanName: 'Killing service' - stopServiceSuccess: - eventName: 'Service stop' - humanName: 'Killed service' - stopServiceNoop: - eventName: 'Service already stopped' - humanName: 'Service is already stopped, removing container' - stopRemoveServiceNoop: - eventName: 'Service already stopped and container removed' - humanName: 'Service is already stopped and the container removed' - stopServiceError: - eventName: 'Service stop error' - humanName: 'Failed to kill service' - - removeDeadService: - eventName: 'Remove dead container' - humanName: 'Removing dead container' - removeDeadServiceError: - eventName: 'Remove dead container error' - humanName: 'Error removing dead container' - - downloadImage: - eventName: 'Docker image download' - humanName: 'Downloading image' - downloadImageDelta: - eventName: 'Delta image download' - humanName: 'Downloading delta for image' - downloadImageSuccess: - eventName: 'Image downloaded' - humanName: 'Downloaded image' - downloadImageError: - eventName: 'Image download error' - humanName: 'Failed to download image' - - installService: - eventName: 'Service install' - humanName: 'Installing service' - installServiceSuccess: - eventName: 'Service installed' - humanName: 'Installed service' - installServiceError: - eventName: 'Service install error' - humanName: 'Failed to install service' - - deleteImage: - eventName: 'Image removal' - humanName: 'Deleting image' - deleteImageSuccess: - eventName: 'Image removed' - humanName: 'Deleted image' - deleteImageError: - eventName: 'Image removal error' - humanName: 'Failed to delete image' - imageAlreadyDeleted: - eventName: 'Image already deleted' - humanName: 'Image already deleted' - deltaStillProcessingError: - eventName: 'Delta still processing remotely.' - humanName: 'Delta still processing remotely. Will retry...' - - startService: - eventName: 'Service start' - humanName: 'Starting service' - startServiceSuccess: - eventName: 'Service started' - humanName: 'Started service' - startServiceNoop: - eventName: 'Service already running' - humanName: 'Service is already running' - startServiceError: - eventName: 'Service start error' - humanName: 'Failed to start service' - - updateService: - eventName: 'Service update' - humanName: 'Updating service' - updateServiceError: - eventName: 'Service update error' - humanName: 'Failed to update service' - - serviceExit: - eventName: 'Service exit' - humanName: 'Service exited' - - serviceRestart: - eventName: 'Service restart' - humanName: 'Restarting service' - - updateServiceConfig: - eventName: 'Service config update' - humanName: 'Updating config for service' - updateServiceConfigSuccess: - eventName: 'Service config updated' - humanName: 'Updated config for service' - updateServiceConfigError: - eventName: 'Service config update error' - humanName: 'Failed to update config for service' - - createVolume: - eventName: 'Volume creation' - humanName: 'Creating volume' - - createVolumeError: - eventName: 'Volume creation error' - humanName: 'Error creating volume' - - removeVolume: - eventName: 'Volume removal' - humanName: 'Removing volume' - - removeVolumeError: - eventName: 'Volume removal error' - humanName: 'Error removing volume' - - createNetwork: - eventName: 'Network creation' - humanName: 'Creating network' - - createNetworkError: - eventName: 'Network creation error' - humanName: 'Error creating network' - - removeNetwork: - eventName: 'Network removal' - humanName: 'Removing network' - - removeNetworkError: - eventName: 'Network removal error' - humanName: 'Error removing network' diff --git a/src/lib/log-types.ts b/src/lib/log-types.ts new file mode 100644 index 00000000..9d4afcb3 --- /dev/null +++ b/src/lib/log-types.ts @@ -0,0 +1,169 @@ +export const stopService= { + eventName: 'Service kill', + humanName: 'Killing service', +}; +export const stopServiceSuccess= { + eventName: 'Service stop', + humanName: 'Killed service', +}; +export const stopServiceNoop = { + eventName: 'Service already stopped', + humanName: 'Service is already stopped, removing container', +}; +export const stopRemoveServiceNoop = { + eventName: 'Service already stopped and container removed', + humanName: 'Service is already stopped and the container removed', +}; +export const stopServiceError = { + eventName: 'Service stop error', + humanName: 'Failed to kill service', +}; + +export const removeDeadService = { + eventName: 'Remove dead container', + humanName: 'Removing dead container', +}; +export const removeDeadServiceError = { + eventName: 'Remove dead container error', + humanName: 'Error removing dead container', +}; + +export const downloadImage = { + eventName: 'Docker image download', + humanName: 'Downloading image', +}; +export const downloadImageDelta = { + eventName: 'Delta image download', + humanName: 'Downloading delta for image', +}; +export const downloadImageSuccess = { + eventName: 'Image downloaded', + humanName: 'Downloaded image', +}; +export const downloadImageError = { + eventName: 'Image download error', + humanName: 'Failed to download image', +}; + +export const installService = { + eventName: 'Service install', + humanName: 'Installing service', +}; +export const installServiceSuccess = { + eventName: 'Service installed', + humanName: 'Installed service', +}; +export const installServiceError = { + eventName: 'Service install error', + humanName: 'Failed to install service', +}; + +export const deleteImage = { + eventName: 'Image removal', + humanName: 'Deleting image', +}; +export const deleteImageSuccess = { + eventName: 'Image removed', + humanName: 'Deleted image', +}; +export const deleteImageError = { + eventName: 'Image removal error', + humanName: 'Failed to delete image', +}; +export const imageAlreadyDeleted = { + eventName: 'Image already deleted', + humanName: 'Image already deleted', +}; +export const deltaStillProcessingError = { + eventName: 'Delta still processing remotely.', + humanName: 'Delta still processing remotely. Will retry...', +}; + +export const startService = { + eventName: 'Service start', + humanName: 'Starting service', +}; +export const startServiceSuccess = { + eventName: 'Service started', + humanName: 'Started service', +}; +export const startServiceNoop = { + eventName: 'Service already running', + humanName: 'Service is already running', +}; +export const startServiceError = { + eventName: 'Service start error', + humanName: 'Failed to start service', +}; + +export const updateService = { + eventName: 'Service update', + humanName: 'Updating service', +}; +export const updateServiceError = { + eventName: 'Service update error', + humanName: 'Failed to update service', +}; + +export const serviceExit = { + eventName: 'Service exit', + humanName: 'Service exited', +}; + +export const serviceRestart = { + eventName: 'Service restart', + humanName: 'Restarting service', +}; + +export const updateServiceConfig = { + eventName: 'Service config update', + humanName: 'Updating config for service', +}; +export const updateServiceConfigSuccess = { + eventName: 'Service config updated', + humanName: 'Updated config for service', +}; +export const updateServiceConfigError = { + eventName: 'Service config update error', + humanName: 'Failed to update config for service', +}; + +export const createVolume = { + eventName: 'Volume creation', + humanName: 'Creating volume', +}; + +export const createVolumeError = { + eventName: 'Volume creation error', + humanName: 'Error creating volume', +}; + +export const removeVolume = { + eventName: 'Volume removal', + humanName: 'Removing volume', +}; + +export const removeVolumeError = { + eventName: 'Volume removal error', + humanName: 'Error removing volume', +}; + +export const createNetwork = { + eventName: 'Network creation', + humanName: 'Creating network', +}; + +export const createNetworkError = { + eventName: 'Network creation error', + humanName: 'Error creating network', +}; + +export const removeNetwork = { + eventName: 'Network removal', + humanName: 'Removing network', +}; + +export const removeNetworkError = { + eventName: 'Network removal error', + humanName: 'Error removing network', +};