fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-13 16:57:21 +02:00
parent 87ff0f01bb
commit 55f45b1c3a
4 changed files with 19 additions and 12 deletions

View File

@ -1,6 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as docker from '../ts/index';
import { DockerService } from '../ts/index';
let testDockerHost: docker.DockerHost;
@ -94,8 +93,11 @@ tap.test('should create a service', async () => {
labels: {},
contentArg: '{"hi": "wow"}'
});
const testService = await DockerService.createService(testDockerHost, {
image: 'nginx:latest',
const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, {
imageUrl: 'nginx:latest'
});
const testService = await docker.DockerService.createService(testDockerHost, {
image: testImage,
labels: {
'testlabel': 'hi'
},

View File

@ -119,7 +119,13 @@ export class DockerImage {
});
}
public tagImage(newTag) {}
/**
* tag an image
* @param newTag
*/
public async tagImage(newTag) {
throw new Error('.tagImage is not yet implemented');
}
/**
* pulls the latest version from the registry

View File

@ -39,13 +39,11 @@ export class DockerService {
// lets get the image
plugins.smartlog.defaultLogger.log(
'info',
`downloading image for service ${serviceCreationDescriptor.name}`
`now creating service ${serviceCreationDescriptor.name}`
);
const serviceImage = await DockerImage.createFromRegistry(dockerHost, {
imageUrl: serviceCreationDescriptor.image
});
const serviceVersion = serviceImage.Labels.version;
// await serviceCreationDescriptor.image.pullLatestImageFromRegistry();
const serviceVersion = await serviceCreationDescriptor.image.getVersion();
const labels: interfaces.TLabels = {
...serviceCreationDescriptor.labels,
@ -78,7 +76,7 @@ export class DockerService {
Name: serviceCreationDescriptor.name,
TaskTemplate: {
ContainerSpec: {
Image: serviceCreationDescriptor.image,
Image: serviceCreationDescriptor.image.RepoTags[0],
Labels: labels,
Secrets: secretArray
},

View File

@ -1,10 +1,11 @@
import * as interfaces from './';
import { DockerNetwork } from '../docker.classes.network';
import { DockerSecret } from '../docker.classes.secret';
import { DockerImage } from '../docker.classes.image';
export interface IServiceCreationDescriptor {
name: string;
image: string;
image: DockerImage;
labels: interfaces.TLabels;
networks: DockerNetwork[];
networkAlias: string;