fix(core): update

This commit is contained in:
Philipp Kunz 2019-01-10 00:28:12 +01:00
parent 57594728df
commit ea117bc391
8 changed files with 125 additions and 57 deletions

View File

@ -1,62 +1,139 @@
image: hosttoday/ht-docker-dbase:npmci # gitzone standard
services: image: hosttoday/ht-docker-node:npmci
- docker:dind
cache: cache:
paths: paths:
- .yarn/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: "$CI_BUILD_STAGE"
stages: stages:
- test - security
- release - test
- trigger - release
- 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 stage: test
script: script:
- npmci test stable - npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless - docker
- priv - priv
release: release:
image: hosttoday/ht-docker-node:npmci
stage: release stage: release
script: script:
- npmci publish npm - npmci node install stable
- npmci npm publish
only: only:
- tags - tags
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 - priv
trigger: trigger:
image: hosttoday/ht-docker-node:npmci stage: metadata
stage: trigger
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- lossless - docker
- priv - notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: pages stage: metadata
script: script:
- npmci command yarn global add npmpage - npmci command npm install -g typedoc typescript
- npmci command npmpage --publish gitlab - npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags: tags:
- docker - docker
- notpriv
only: only:
- tags - tags
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true

View File

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

View File

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

View File

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

View File

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

View File

@ -1,2 +1,2 @@
// tslint:disable-next-line: interface-over-type-literal // tslint:disable-next-line: interface-over-type-literal
export type TLabels = {[key: string]: string }; export type TLabels = { [key: string]: string };