Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fe9134f4a | |||
| 7681f09d38 | |||
| d55c77560a | |||
| 0e337a3574 |
@@ -10,9 +10,11 @@ stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
@@ -31,25 +33,9 @@ snyk:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
codequality:
|
||||
stage: security
|
||||
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
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
testLEGACY:
|
||||
stage: test
|
||||
script:
|
||||
@@ -88,7 +74,6 @@ release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm prepare
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
@@ -96,8 +81,30 @@ release:
|
||||
- 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:
|
||||
stage: trigger
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
@@ -108,7 +115,7 @@ trigger:
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shipzone/npmci",
|
||||
"version": "3.0.46",
|
||||
"version": "3.0.48",
|
||||
"description": "node and docker in gitlab ci on steroids",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
@@ -49,5 +49,6 @@
|
||||
"smartstring": "^2.0.24",
|
||||
"smartsystem": "^2.0.2",
|
||||
"through2": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as plugins from '../npmci.plugins';
|
||||
import * as paths from '../npmci.paths';
|
||||
import * as npmciConfig from '../npmci.config';
|
||||
import { bash, bashNoError, nvmAvailable, yarnAvailable } from '../npmci.bash';
|
||||
import { bash, bashNoError, nvmAvailable } from '../npmci.bash';
|
||||
|
||||
/**
|
||||
* handle cli input
|
||||
@@ -49,6 +50,7 @@ export let install = async versionArg => {
|
||||
}
|
||||
await bash('node -v');
|
||||
await bash('npm -v');
|
||||
await bash(`npm config set cache ${paths.NpmciCacheDir} --global `);
|
||||
// lets look for further config
|
||||
await npmciConfig.getConfig().then(async configArg => {
|
||||
plugins.beautylog.log('Now checking for needed global npm tools...');
|
||||
@@ -60,11 +62,7 @@ export let install = async versionArg => {
|
||||
plugins.beautylog.log(`Tool ${npmTool} is available`);
|
||||
} else {
|
||||
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
|
||||
if (await yarnAvailable.promise) {
|
||||
await bash(`yarn global add ${npmTool}`);
|
||||
} else {
|
||||
await bash(`npm install ${npmTool} -q -g`);
|
||||
}
|
||||
await bash(`npm install ${npmTool} -q -g`);
|
||||
}
|
||||
}
|
||||
plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as plugins from './mod.plugins';
|
||||
import * as configModule from '../npmci.config';
|
||||
import { bash, bashNoError, nvmAvailable, yarnAvailable } from '../npmci.bash';
|
||||
import { bash, bashNoError, nvmAvailable } from '../npmci.bash';
|
||||
|
||||
/**
|
||||
* handle cli input
|
||||
@@ -72,13 +72,13 @@ let publish = async () => {
|
||||
await bash(`npm -v`);
|
||||
|
||||
// -> build it
|
||||
await bash(`yarn install`);
|
||||
await bash(`yarn run build`);
|
||||
await bash(`npm install`);
|
||||
await bash(`npm run build`);
|
||||
|
||||
plugins.beautylog.success(`Nice!!! The build for the publication was successfull!`);
|
||||
plugins.beautylog.log(`Lets clean up so we don't publish any packages that don't belong to us:`);
|
||||
// -> clean up before we publish stuff
|
||||
await bash(`rm -r .yarn`);
|
||||
await bashNoError(`rm -r .npmci_cache`);
|
||||
await bash(`rm -r node_modules`);
|
||||
|
||||
plugins.beautylog.success(`Cleaned up!:`);
|
||||
@@ -91,14 +91,10 @@ let publish = async () => {
|
||||
|
||||
let install = async (): Promise<void> => {
|
||||
plugins.beautylog.info('now installing dependencies:');
|
||||
if (await yarnAvailable.promise) {
|
||||
await bash('yarn install');
|
||||
} else {
|
||||
await bash('npm install');
|
||||
}
|
||||
await bash('npm install');
|
||||
};
|
||||
|
||||
export let test = async (): Promise<void> => {
|
||||
plugins.beautylog.info('now starting tests:');
|
||||
await bash('yarn test');
|
||||
await bash('npm test');
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@ import * as smartq from 'smartq';
|
||||
* wether nvm is available or not
|
||||
*/
|
||||
export let nvmAvailable = smartq.defer<boolean>();
|
||||
export let yarnAvailable = smartq.defer<boolean>();
|
||||
/**
|
||||
* the smartshell instance for npmci
|
||||
*/
|
||||
@@ -35,22 +34,8 @@ let checkToolsAvailable = async () => {
|
||||
} else {
|
||||
nvmAvailable.resolve(false);
|
||||
}
|
||||
|
||||
// check for yarn
|
||||
await plugins.smartshell.which('yarn').then(
|
||||
async () => {
|
||||
await plugins.smartshell.exec(
|
||||
`yarn config set cache-folder ${plugins.path.join(paths.cwd, '.yarn')}`
|
||||
);
|
||||
yarnAvailable.resolve(true);
|
||||
},
|
||||
() => {
|
||||
yarnAvailable.resolve(false);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
nvmAvailable.resolve(true);
|
||||
yarnAvailable.resolve(true);
|
||||
}
|
||||
};
|
||||
checkToolsAvailable();
|
||||
|
||||
@@ -15,100 +15,109 @@ const npmciSmartcli = new plugins.smartcli.Smartcli();
|
||||
npmciSmartcli.addVersion(npmciInfo.version);
|
||||
|
||||
// clean
|
||||
npmciSmartcli
|
||||
.addCommand('clean')
|
||||
.subscribe(async argv => {
|
||||
npmciSmartcli.addCommand('clean').subscribe(
|
||||
async argv => {
|
||||
let modClean = await npmciMods.modClean.load();
|
||||
await modClean.clean();
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// cloudflare
|
||||
npmciSmartcli
|
||||
.addCommand('cloudflare')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('cloudflare').subscribe(
|
||||
async argvArg => {
|
||||
let modPurge = await npmciMods.modCloudflare.load();
|
||||
await modPurge.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// command
|
||||
npmciSmartcli
|
||||
.addCommand('command')
|
||||
.subscribe(async argv => {
|
||||
npmciSmartcli.addCommand('command').subscribe(
|
||||
async argv => {
|
||||
let modCommand = await npmciMods.modCommand.load();
|
||||
await modCommand.command();
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// command
|
||||
npmciSmartcli
|
||||
.addCommand('git')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('git').subscribe(
|
||||
async argvArg => {
|
||||
let modGit = await npmciMods.modGit.load();
|
||||
await modGit.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// build
|
||||
npmciSmartcli
|
||||
.addCommand('docker')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('docker').subscribe(
|
||||
async argvArg => {
|
||||
let modDocker = await npmciMods.modDocker.load();
|
||||
await modDocker.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// node
|
||||
npmciSmartcli
|
||||
.addCommand('node')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('node').subscribe(
|
||||
async argvArg => {
|
||||
let modNode = await npmciMods.modNode.load();
|
||||
await modNode.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// npm
|
||||
npmciSmartcli
|
||||
.addCommand('npm')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('npm').subscribe(
|
||||
async argvArg => {
|
||||
let modNpm = await npmciMods.modNpm.load();
|
||||
await modNpm.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// trigger
|
||||
npmciSmartcli
|
||||
.addCommand('ssh')
|
||||
.subscribe(async argvArg => {
|
||||
npmciSmartcli.addCommand('ssh').subscribe(
|
||||
async argvArg => {
|
||||
let modSsh = await npmciMods.modSsh.load();
|
||||
await modSsh.handleCli(argvArg);
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// trigger
|
||||
npmciSmartcli
|
||||
.addCommand('trigger')
|
||||
.subscribe(async argv => {
|
||||
npmciSmartcli.addCommand('trigger').subscribe(
|
||||
async argv => {
|
||||
let modTrigger = await npmciMods.modTrigger.load();
|
||||
await modTrigger.trigger();
|
||||
}, err => {
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
npmciSmartcli.startParse();
|
||||
|
||||
@@ -6,3 +6,4 @@ export let NpmciPackageRoot = plugins.path.join(__dirname, '../');
|
||||
export let NpmciPackageConfig = plugins.path.join(NpmciPackageRoot, './config.json');
|
||||
export let NpmciProjectDir = cwd;
|
||||
export let NpmciTestDir = plugins.path.join(cwd, './test');
|
||||
export let NpmciCacheDir = plugins.path.join(cwd, './.npmci_cache');
|
||||
|
||||
Reference in New Issue
Block a user