Compare commits

..

6 Commits

Author SHA1 Message Date
55acb39071 1.0.29 2019-01-10 00:37:32 +01:00
f7b17a4684 fix(core): update 2019-01-10 00:37:32 +01:00
d95f6c8e7f 1.0.28 2019-01-10 00:31:49 +01:00
001cdadb6b fix(core): update 2019-01-10 00:31:48 +01:00
82655623d1 1.0.27 2019-01-10 00:28:13 +01:00
ea117bc391 fix(core): update 2019-01-10 00:28:12 +01:00
10 changed files with 183 additions and 67 deletions

View File

@ -1,62 +1,139 @@
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:dind
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
- metadata
before_script:
- npmci prepare docker-gitlab
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
test:
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
sast:
stage: security
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- npmci npm prepare
- npmci npm install
- npmci command npm run build
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
artifacts:
reports:
sast: gl-sast-report.json
tags:
- docker
- priv
# ====================
# test stage
# ====================
testSTABLE:
image: hosttoday/ht-docker-dbase:npmci
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
release:
image: hosttoday/ht-docker-node:npmci
stage: release
script:
- npmci publish npm
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger:
image: hosttoday/ht-docker-node:npmci
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- priv
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
stage: metadata
script:
- npmci command yarn global add npmpage
- npmci command npmpage --publish gitlab
- npmci command npm install -g typedoc typescript
- npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

View File

@ -1,8 +1,4 @@
{
"npmts": {
"mode": "default",
"coverageTreshold": 10
},
"npmdocker": {
"baseImage": "hosttoday/ht-docker-node:npmci",
"command":
@ -10,6 +6,8 @@
"dockerSock": true
},
"npmci": {
"globalNpmTools": ["npmts", "npmdocker"]
"npmGlobalTools": [],
"npmAccessLevel": "public",
"npmRegistryUrl": "registry.npmjs.org"
}
}

50
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/docker",
"version": "1.0.26",
"version": "1.0.29",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -40,6 +40,22 @@
"typescript": "^3.0.1"
}
},
"@gitzone/tstest": {
"version": "1.0.18",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.18.tgz",
"integrity": "sha512-/owFKFsiFWh6miL+G/DYxBr+B6mgy9WzthLTqNyC7xriYoymvBgnmm5Wo3bo1NQN+1GY83zKeSpY7JB4r2LuEQ==",
"dev": true,
"requires": {
"@gitzone/tsrun": "^1.1.17",
"@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartfile": "^6.0.11",
"@pushrocks/smartlog": "^2.0.9",
"@pushrocks/smartpromise": "^2.0.5",
"@pushrocks/smartshell": "^2.0.11",
"@types/figures": "^2.0.0",
"figures": "^2.0.0"
}
},
"@pushrocks/consolecolor": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fconsolecolor/-/consolecolor-2.0.1.tgz",
@ -188,6 +204,17 @@
"rxjs": "^6.3.3"
}
},
"@pushrocks/smartshell": {
"version": "2.0.13",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.13.tgz",
"integrity": "sha512-jLfAhLxMVKAScKdln1QrQqBI7A7INhMNHIq28fJEBi0BNDUS0eerw4yMAnR4CRmcrh4xFp1z+ju1kaPO3I/4MA==",
"dev": true,
"requires": {
"@pushrocks/smartpromise": "^2.0.5",
"@types/which": "^1.3.1",
"which": "^1.3.1"
}
},
"@pushrocks/smarttime": {
"version": "3.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.5.tgz",
@ -235,6 +262,12 @@
"@types/chai": "*"
}
},
"@types/figures": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/@types%2ffigures/-/figures-2.0.0.tgz",
"integrity": "sha512-mcRgJ+ncKuNI+Dwac7omO18B8C8u+YBS+AU/oyLhEyjAnT3cUUThhHgZpbiIvu5ZqSvdD30BXtrqg9nxc3OKMg==",
"dev": true
},
"@types/form-data": {
"version": "2.2.1",
"resolved": "https://verdaccio.lossless.one/@types%2fform-data/-/form-data-2.2.1.tgz",
@ -276,6 +309,12 @@
"@types/node": "*"
}
},
"@types/which": {
"version": "1.3.1",
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-1.3.1.tgz",
"integrity": "sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ==",
"dev": true
},
"@types/yargs": {
"version": "12.0.5",
"resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-12.0.5.tgz",
@ -644,6 +683,15 @@
"strip-eof": "^1.0.0"
}
},
"figures": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/figures/-/figures-2.0.0.tgz",
"integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.5"
}
},
"find-up": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/find-up/-/find-up-3.0.0.tgz",

View File

@ -1,12 +1,13 @@
{
"name": "@mojoio/docker",
"version": "1.0.26",
"version": "1.0.29",
"description": "easy communication with docker remote api from node, TypeScript ready",
"private": false,
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "tsrun test/test.ts",
"build": "(npmts --notest && npmdocker)"
"test": "tstest test/",
"build": "tsbuild"
},
"repository": {
"type": "git",
@ -33,11 +34,12 @@
"rxjs": "^6.3.3"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.4",
"@gitzone/tsrun": "^1.1.17",
"@gitzone/tstest": "^1.0.18",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.12.18",
"tslint": "^5.12.0",
"tslint-config-prettier": "^1.17.0"
},
"private": false
}
}

View File

@ -13,12 +13,11 @@ tap.test('should list containers', async () => {
console.log(containers);
});
tap.skip.test('should pull an image from imagetag', async () => {
// await testDockerHost.pullImage('hosttoday/ht-docker-node:npmci');
});
tap.test('should return a change Objservable', async (tools) => {
tap.test('should return a change Objservable', async tools => {
const testObservable = await testDockerHost.getEventObservable();
const subscription = testObservable.subscribe(changeObject => {
console.log(changeObject);

View File

@ -24,9 +24,7 @@ export class DockerContainer {
*
* @param containerId
*/
static async getContainerById(containerId: string) {
}
static async getContainerById(containerId: string) {}
static async create() {}
// ========
@ -36,7 +34,7 @@ export class DockerContainer {
constructor(dockerContainerObjectArg: any) {
Object.keys(dockerContainerObjectArg).forEach(keyArg => {
this[keyArg] = dockerContainerObjectArg[keyArg];
})
});
}
Id: string;

View File

@ -37,7 +37,7 @@ export class DockerHost {
async getContainers() {
const containerArray = await DockerContainer.getContainers(this);
return containerArray;
};
}
async getEventObservable(): Promise<plugins.rxjs.Observable<any>> {
const response = await this.requestStreaming('GET', '/events');
@ -70,7 +70,8 @@ export class DockerHost {
async requestStreaming(methodArg: string, routeArg: string, dataArg = {}) {
const requestUrl = `${this.sockPath}${routeArg}`;
const response = await plugins.smartrequest.request(
requestUrl, {
requestUrl,
{
method: methodArg,
headers: {
// 'Content-Type': 'application/json',

View File

@ -4,16 +4,9 @@ import * as smartlog from '@pushrocks/smartlog';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest';
export {
lik,
smartlog,
smartpromise,
smartrequest
};
export { lik, smartlog, smartpromise, smartrequest };
// third party
import * as rxjs from 'rxjs';
export {
rxjs
};
export { rxjs };