fix(core): update
This commit is contained in:
		| @@ -38,13 +38,11 @@ snyk: | ||||
| # test stage | ||||
| # ==================== | ||||
|  | ||||
| testLTS: | ||||
|   services: | ||||
|     - docker:18-dind | ||||
| testStable: | ||||
|   stage: test | ||||
|   script: | ||||
|   - npmci npm prepare | ||||
|   - npmci node install lts | ||||
|   - npmci node install stable | ||||
|   - npmci npm install | ||||
|   - npmci npm test | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
| @@ -56,7 +54,7 @@ testBuild: | ||||
|   stage: test | ||||
|   script: | ||||
|   - npmci npm prepare | ||||
|   - npmci node install lts | ||||
|   - npmci node install stable | ||||
|   - npmci npm install | ||||
|   - npmci command npm run build | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
| @@ -67,7 +65,7 @@ testBuild: | ||||
| release: | ||||
|   stage: release | ||||
|   script: | ||||
|   - npmci node install lts | ||||
|   - npmci node install stable | ||||
|   - npmci npm publish | ||||
|   only: | ||||
|   - tags | ||||
| @@ -102,7 +100,7 @@ trigger: | ||||
| pages: | ||||
|   image: hosttoday/ht-docker-dbase:npmci | ||||
|   services: | ||||
|    - docker:18-dind | ||||
|    - docker:stable-dind | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci command npm install -g @gitzone/tsdoc | ||||
|   | ||||
| @@ -72,7 +72,6 @@ tap.test('should remove a secret by name', async () => { | ||||
|   await mySecret.remove(); | ||||
| }); | ||||
|  | ||||
|  | ||||
| // SERVICES | ||||
| tap.test('should activate swarm mode', async () => { | ||||
|   await testDockerHost.activateSwarm(); | ||||
| @@ -99,7 +98,7 @@ tap.test('should create a service', async () => { | ||||
|   const testService = await docker.DockerService.createService(testDockerHost, { | ||||
|     image: testImage, | ||||
|     labels: { | ||||
|       'testlabel': 'hi' | ||||
|       testlabel: 'hi' | ||||
|     }, | ||||
|     name: 'testService', | ||||
|     networks: [testNetwork], | ||||
|   | ||||
| @@ -73,7 +73,6 @@ export class DockerHost { | ||||
|    * | ||||
|    */ | ||||
|  | ||||
|  | ||||
|   /** | ||||
|    * gets all containers | ||||
|    */ | ||||
|   | ||||
| @@ -21,7 +21,6 @@ export class DockerImage { | ||||
|       } else { | ||||
|         return false; | ||||
|       } | ||||
|        | ||||
|     }); | ||||
|     return result; | ||||
|   } | ||||
| @@ -30,7 +29,6 @@ export class DockerImage { | ||||
|     dockerHostArg: DockerHost, | ||||
|     creationObject: interfaces.IImageCreationDescriptor | ||||
|   ): Promise<DockerImage> { | ||||
|  | ||||
|     // lets create a sanatized imageUrlObject | ||||
|     const imageUrlObject: { | ||||
|       imageUrl: string; | ||||
| @@ -46,9 +44,7 @@ export class DockerImage { | ||||
|       const imageTag = imageUrlObject.imageUrl.split(':')[1]; | ||||
|       if (imageUrlObject.imageTag) { | ||||
|         throw new Error( | ||||
|           `imageUrl ${imageUrlObject.imageUrl} can't be tagged with ${ | ||||
|             imageUrlObject.imageTag | ||||
|           } because it is already tagged with ${imageTag}` | ||||
|           `imageUrl ${imageUrlObject.imageUrl} can't be tagged with ${imageUrlObject.imageTag} because it is already tagged with ${imageTag}` | ||||
|         ); | ||||
|       } else { | ||||
|         imageUrlObject.imageUrl = imageUrl; | ||||
|   | ||||
| @@ -17,17 +17,20 @@ export class DockerSecret { | ||||
|     return secrets; | ||||
|   } | ||||
|  | ||||
|   public static async getSecretByID (dockerHostArg: DockerHost, idArg: string) { | ||||
|   public static async getSecretByID(dockerHostArg: DockerHost, idArg: string) { | ||||
|     const secrets = await this.getSecrets(dockerHostArg); | ||||
|     return secrets.find(secret => secret.ID === idArg); | ||||
|   } | ||||
|  | ||||
|   public static async getSecretByName (dockerHostArg: DockerHost, nameArg: string) { | ||||
|   public static async getSecretByName(dockerHostArg: DockerHost, nameArg: string) { | ||||
|     const secrets = await this.getSecrets(dockerHostArg); | ||||
|     return secrets.find(secret => secret.Spec.Name === nameArg); | ||||
|   } | ||||
|  | ||||
|   public static async createSecret(dockerHostArg: DockerHost, secretDescriptor: interfaces.ISecretCreationDescriptor) { | ||||
|   public static async createSecret( | ||||
|     dockerHostArg: DockerHost, | ||||
|     secretDescriptor: interfaces.ISecretCreationDescriptor | ||||
|   ) { | ||||
|     const labels: interfaces.TLabels = { | ||||
|       ...secretDescriptor.labels, | ||||
|       version: secretDescriptor.version | ||||
| @@ -40,7 +43,10 @@ export class DockerSecret { | ||||
|  | ||||
|     const newSecretInstance = new DockerSecret(dockerHostArg); | ||||
|     Object.assign(newSecretInstance, response.body); | ||||
|     Object.assign (newSecretInstance, await DockerSecret.getSecretByID(dockerHostArg, newSecretInstance.ID)); | ||||
|     Object.assign( | ||||
|       newSecretInstance, | ||||
|       await DockerSecret.getSecretByID(dockerHostArg, newSecretInstance.ID) | ||||
|     ); | ||||
|     return newSecretInstance; | ||||
|   } | ||||
|  | ||||
| @@ -51,7 +57,7 @@ export class DockerSecret { | ||||
|     Labels: interfaces.TLabels; | ||||
|   }; | ||||
|   public Version: { | ||||
|     Index:string; | ||||
|     Index: string; | ||||
|   }; | ||||
|  | ||||
|   public dockerHost: DockerHost; | ||||
| @@ -62,20 +68,23 @@ export class DockerSecret { | ||||
|   /** | ||||
|    * updates a secret | ||||
|    */ | ||||
|   public async update (contentArg: string) { | ||||
|   public async update(contentArg: string) { | ||||
|     const route = `/secrets/${this.ID}/update?=version=${this.Version.Index}`; | ||||
|     const response = await this.dockerHost.request('POST', `/secrets/${this.ID}/update?version=${this.Version.Index}`, { | ||||
|     const response = await this.dockerHost.request( | ||||
|       'POST', | ||||
|       `/secrets/${this.ID}/update?version=${this.Version.Index}`, | ||||
|       { | ||||
|         Name: this.Spec.Name, | ||||
|         Labels: this.Spec.Labels, | ||||
|         Data: plugins.smartstring.base64.encode(contentArg) | ||||
|     }); | ||||
|       } | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   public async remove () { | ||||
|   public async remove() { | ||||
|     await this.dockerHost.request('DELETE', `/secrets/${this.ID}`); | ||||
|   } | ||||
|  | ||||
|  | ||||
|   // get things | ||||
|   public async getVersion() { | ||||
|     return this.Spec.Labels.version; | ||||
|   | ||||
| @@ -1,9 +1,7 @@ | ||||
| // node native path | ||||
| import * as path from 'path'; | ||||
|  | ||||
| export { | ||||
|   path | ||||
| }; | ||||
| export { path }; | ||||
|  | ||||
| // @pushrocks scope | ||||
| import * as lik from '@pushrocks/lik'; | ||||
| @@ -19,7 +17,18 @@ import * as smartversion from '@pushrocks/smartversion'; | ||||
|  | ||||
| smartlog.defaultLogger.enableConsole(); | ||||
|  | ||||
| export { lik, smartfile, smartjson, smartlog, smartnetwork, smartpath, smartpromise, smartrequest, smartstring, smartversion }; | ||||
| export { | ||||
|   lik, | ||||
|   smartfile, | ||||
|   smartjson, | ||||
|   smartlog, | ||||
|   smartnetwork, | ||||
|   smartpath, | ||||
|   smartpromise, | ||||
|   smartrequest, | ||||
|   smartstring, | ||||
|   smartversion | ||||
| }; | ||||
|  | ||||
| // third party | ||||
| import * as rxjs from 'rxjs'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user