Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bce84a0e74 | |||
| 79bed919d8 | |||
| 4b202ce00e | |||
| 16ca787314 | |||
| 3a9b6f658a | |||
| 5c5dbf303f | |||
| 4c07131e51 | |||
| ba039469ff | |||
| 49f2498ecd | |||
| 1060060366 | |||
| 0fa3a579f7 | |||
| 0e4556d59e | |||
| e2e7967fba | |||
| 45b8d67abf | |||
| 0a69aa5d62 | |||
| dfbab1a1df |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shipzone/npmci",
|
"name": "@shipzone/npmci",
|
||||||
"version": "4.1.12",
|
"version": "4.1.20",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "node and docker in gitlab ci on steroids",
|
"description": "node and docker in gitlab ci on steroids",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"@types/node": "^20.3.1"
|
"@types/node": "^20.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest": "^2.0.10",
|
"@apiglobal/typedrequest": "^2.0.12",
|
||||||
"@pushrocks/lik": "^6.0.2",
|
"@pushrocks/lik": "^6.0.2",
|
||||||
"@pushrocks/npmextra": "^3.0.9",
|
"@pushrocks/npmextra": "^3.0.9",
|
||||||
"@pushrocks/projectinfo": "^5.0.1",
|
"@pushrocks/projectinfo": "^5.0.1",
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
"@pushrocks/smartshell": "^3.0.3",
|
"@pushrocks/smartshell": "^3.0.3",
|
||||||
"@pushrocks/smartsocket": "^2.0.19",
|
"@pushrocks/smartsocket": "^2.0.19",
|
||||||
"@pushrocks/smartssh": "^2.0.0",
|
"@pushrocks/smartssh": "^2.0.0",
|
||||||
"@pushrocks/smartstring": "^4.0.5",
|
"@pushrocks/smartstring": "^4.0.7",
|
||||||
"@servezone/interfaces": "^1.0.3",
|
"@servezone/interfaces": "^1.0.3",
|
||||||
"@tsclass/tsclass": "^4.0.42",
|
"@tsclass/tsclass": "^4.0.42",
|
||||||
"@types/through2": "^2.0.38",
|
"@types/through2": "^2.0.38",
|
||||||
|
|||||||
53
pnpm-lock.yaml
generated
53
pnpm-lock.yaml
generated
@@ -6,8 +6,8 @@ settings:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@apiglobal/typedrequest':
|
'@apiglobal/typedrequest':
|
||||||
specifier: ^2.0.10
|
specifier: ^2.0.12
|
||||||
version: 2.0.10
|
version: 2.0.12
|
||||||
'@pushrocks/lik':
|
'@pushrocks/lik':
|
||||||
specifier: ^6.0.2
|
specifier: ^6.0.2
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
@@ -66,8 +66,8 @@ dependencies:
|
|||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
'@pushrocks/smartstring':
|
'@pushrocks/smartstring':
|
||||||
specifier: ^4.0.5
|
specifier: ^4.0.7
|
||||||
version: 4.0.5
|
version: 4.0.7
|
||||||
'@servezone/interfaces':
|
'@servezone/interfaces':
|
||||||
specifier: ^1.0.3
|
specifier: ^1.0.3
|
||||||
version: 1.0.3
|
version: 1.0.3
|
||||||
@@ -116,8 +116,8 @@ packages:
|
|||||||
/@apiglobal/typedrequest-interfaces@2.0.1:
|
/@apiglobal/typedrequest-interfaces@2.0.1:
|
||||||
resolution: {integrity: sha512-Oi7pNU4vKo5UvcCJmqkH43Us237Ws/Pp/WDYnwnonRnTmIMd+6QjNfN/gXcPnP6tbamk8r8Xzcz9mgnSDM2ysw==}
|
resolution: {integrity: sha512-Oi7pNU4vKo5UvcCJmqkH43Us237Ws/Pp/WDYnwnonRnTmIMd+6QjNfN/gXcPnP6tbamk8r8Xzcz9mgnSDM2ysw==}
|
||||||
|
|
||||||
/@apiglobal/typedrequest@2.0.10:
|
/@apiglobal/typedrequest@2.0.12:
|
||||||
resolution: {integrity: sha512-5Tayp+QVkRpQQa11eb/9eFZjR+Q7uzd0fFygoKPjrZ9IevHchuFX0TbDvf6PXVpfW3C7hAc2gjAmUHKrlWO7oA==}
|
resolution: {integrity: sha512-oCxcdKEzihzPDf0jrqG4obFFSgDszvO5LO+0Fk/hH/0bZm0AQ1LssYVwaY8OHjT0ujmkTcC5JFCjaS7LgjKSgQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@apiglobal/typedrequest-interfaces': 1.0.20
|
'@apiglobal/typedrequest-interfaces': 1.0.20
|
||||||
'@pushrocks/isounique': 1.0.5
|
'@pushrocks/isounique': 1.0.5
|
||||||
@@ -131,12 +131,12 @@ packages:
|
|||||||
/@apiglobal/typedsocket@2.0.24:
|
/@apiglobal/typedsocket@2.0.24:
|
||||||
resolution: {integrity: sha512-8Ol5E3AvqdUTjEhiNkEKnbGpst9iXBtD5zDudeQDcajzjSdstUGe+GExQRc+D7hiOkktfuF8FArQ3HQ4RyZwow==}
|
resolution: {integrity: sha512-8Ol5E3AvqdUTjEhiNkEKnbGpst9iXBtD5zDudeQDcajzjSdstUGe+GExQRc+D7hiOkktfuF8FArQ3HQ4RyZwow==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@apiglobal/typedrequest': 2.0.10
|
'@apiglobal/typedrequest': 2.0.12
|
||||||
'@apiglobal/typedrequest-interfaces': 2.0.1
|
'@apiglobal/typedrequest-interfaces': 2.0.1
|
||||||
'@pushrocks/isohash': 2.0.1
|
'@pushrocks/isohash': 2.0.1
|
||||||
'@pushrocks/smartjson': 5.0.6
|
'@pushrocks/smartjson': 5.0.6
|
||||||
'@pushrocks/smartsocket': 2.0.19
|
'@pushrocks/smartsocket': 2.0.19
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
'@pushrocks/smarturl': 3.0.6
|
'@pushrocks/smarturl': 3.0.6
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
@@ -651,7 +651,7 @@ packages:
|
|||||||
'@pushrocks/smartfile': 9.0.6
|
'@pushrocks/smartfile': 9.0.6
|
||||||
'@pushrocks/smartpath': 5.0.5
|
'@pushrocks/smartpath': 5.0.5
|
||||||
'@pushrocks/smartpromise': 3.1.10
|
'@pushrocks/smartpromise': 3.1.10
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: false
|
dev: false
|
||||||
@@ -747,7 +747,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-/xuUshI4VtfM2Q8RJxsTjD/7sI2HZ4p4+CmKOZYK66nxgeyO+IkKM/qcxHdZLbuB2q/ekYNAfvce8VL0RxtTVQ==}
|
resolution: {integrity: sha512-/xuUshI4VtfM2Q8RJxsTjD/7sI2HZ4p4+CmKOZYK66nxgeyO+IkKM/qcxHdZLbuB2q/ekYNAfvce8VL0RxtTVQ==}
|
||||||
deprecated: This package has been replaced by @apiglobal/typedserver
|
deprecated: This package has been replaced by @apiglobal/typedserver
|
||||||
dependencies:
|
dependencies:
|
||||||
'@apiglobal/typedrequest': 2.0.10
|
'@apiglobal/typedrequest': 2.0.12
|
||||||
'@apiglobal/typedsocket': 2.0.24
|
'@apiglobal/typedsocket': 2.0.24
|
||||||
'@pushrocks/lik': 6.0.2
|
'@pushrocks/lik': 6.0.2
|
||||||
'@pushrocks/smartdelay': 2.0.13
|
'@pushrocks/smartdelay': 2.0.13
|
||||||
@@ -858,7 +858,7 @@ packages:
|
|||||||
'@pushrocks/smartpath': 5.0.5
|
'@pushrocks/smartpath': 5.0.5
|
||||||
'@pushrocks/smartpromise': 3.1.10
|
'@pushrocks/smartpromise': 3.1.10
|
||||||
'@pushrocks/smartshell': 2.0.30
|
'@pushrocks/smartshell': 2.0.30
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
'@types/minimatch': 3.0.5
|
'@types/minimatch': 3.0.5
|
||||||
isomorphic-git: 1.24.2
|
isomorphic-git: 1.24.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@@ -895,7 +895,7 @@ packages:
|
|||||||
/@pushrocks/smartjson@5.0.6:
|
/@pushrocks/smartjson@5.0.6:
|
||||||
resolution: {integrity: sha512-9OJbnRgLTaCRQz+pqu5tB3ZCqRs5Zh0hnBe7t7URE+TgwIZ8aiELUIbWRkgn4mSGVzHyL6pqTyIowP6AjUCG3w==}
|
resolution: {integrity: sha512-9OJbnRgLTaCRQz+pqu5tB3ZCqRs5Zh0hnBe7t7URE+TgwIZ8aiELUIbWRkgn4mSGVzHyL6pqTyIowP6AjUCG3w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
'@types/buffer-json': 2.0.1
|
'@types/buffer-json': 2.0.1
|
||||||
buffer-json: 2.0.0
|
buffer-json: 2.0.0
|
||||||
fast-json-stable-stringify: 2.1.0
|
fast-json-stable-stringify: 2.1.0
|
||||||
@@ -956,7 +956,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@pushrocks/smartping': 1.0.8
|
'@pushrocks/smartping': 1.0.8
|
||||||
'@pushrocks/smartpromise': 3.1.10
|
'@pushrocks/smartpromise': 3.1.10
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
'@types/default-gateway': 3.0.1
|
'@types/default-gateway': 3.0.1
|
||||||
isopen: 1.3.0
|
isopen: 1.3.0
|
||||||
public-ip: 6.0.1
|
public-ip: 6.0.1
|
||||||
@@ -1137,7 +1137,7 @@ packages:
|
|||||||
'@pushrocks/smartpath': 5.0.5
|
'@pushrocks/smartpath': 5.0.5
|
||||||
'@pushrocks/smartpromise': 3.1.10
|
'@pushrocks/smartpromise': 3.1.10
|
||||||
'@pushrocks/smartshell': 2.0.30
|
'@pushrocks/smartshell': 2.0.30
|
||||||
'@pushrocks/smartstring': 4.0.5
|
'@pushrocks/smartstring': 4.0.7
|
||||||
'@types/fs-extra': 9.0.13
|
'@types/fs-extra': 9.0.13
|
||||||
'@types/minimatch': 5.1.2
|
'@types/minimatch': 5.1.2
|
||||||
fs-extra: 10.1.0
|
fs-extra: 10.1.0
|
||||||
@@ -1156,14 +1156,14 @@ packages:
|
|||||||
from2: 2.3.0
|
from2: 2.3.0
|
||||||
through2: 4.0.2
|
through2: 4.0.2
|
||||||
|
|
||||||
/@pushrocks/smartstring@4.0.5:
|
/@pushrocks/smartstring@4.0.7:
|
||||||
resolution: {integrity: sha512-g9a/Mfj+eJAUrTDQoH3oaYegjI98WlVoSLAI8lpExQ/STlEJGO5ZdWDqgZ0HvHe+5UeWvxzCFpHifqRhMUJ+dQ==}
|
resolution: {integrity: sha512-TxHSar7Cj29E+GOcIj4DeZKWCNVzHKdqnrBRqcBqLqmeYZvzFosLXpFKoaCJDq7MSxuPoCvu5woSdp9YmPXyog==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@pushrocks/isounique': 1.0.5
|
'@pushrocks/isounique': 1.0.5
|
||||||
'@pushrocks/smartenv': 5.0.5
|
'@pushrocks/smartenv': 5.0.5
|
||||||
'@types/randomatic': 3.1.3
|
'@types/randomatic': 3.1.3
|
||||||
buffer: 6.0.3
|
buffer: 6.0.3
|
||||||
crypto-random-string: 4.0.0
|
crypto-random-string: 5.0.0
|
||||||
js-base64: 3.7.5
|
js-base64: 3.7.5
|
||||||
normalize-newline: 4.1.0
|
normalize-newline: 4.1.0
|
||||||
randomatic: 3.1.1
|
randomatic: 3.1.1
|
||||||
@@ -1762,6 +1762,11 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@xmldom/xmldom@0.8.8:
|
||||||
|
resolution: {integrity: sha512-0LNz4EY8B/8xXY86wMrQ4tz6zEHZv9ehFMJPm8u2gq5lQ71cfRKdaKyxfJAx5aUoyzx0qzgURblTisPGgz3d+Q==}
|
||||||
|
engines: {node: '>=10.0.0'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/accepts@1.3.8:
|
/accepts@1.3.8:
|
||||||
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
|
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
|
||||||
engines: {node: '>= 0.6'}
|
engines: {node: '>= 0.6'}
|
||||||
@@ -2229,11 +2234,11 @@ packages:
|
|||||||
shebang-command: 2.0.0
|
shebang-command: 2.0.0
|
||||||
which: 2.0.2
|
which: 2.0.2
|
||||||
|
|
||||||
/crypto-random-string@4.0.0:
|
/crypto-random-string@5.0.0:
|
||||||
resolution: {integrity: sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==}
|
resolution: {integrity: sha512-KWjTXWwxFd6a94m5CdRGW/t82Tr8DoBc9dNnPCAbFI1EBweN6v1tv8y4Y1m7ndkp/nkIBRxUxAzpaBnR2k3bcQ==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=14.16'}
|
||||||
dependencies:
|
dependencies:
|
||||||
type-fest: 1.4.0
|
type-fest: 2.19.0
|
||||||
|
|
||||||
/dayjs@1.11.8:
|
/dayjs@1.11.8:
|
||||||
resolution: {integrity: sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==}
|
resolution: {integrity: sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==}
|
||||||
@@ -3719,6 +3724,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-mXF9AIgnvq1DP/ZM2R28tAfxP2wKZHYa2DjV0R1KCwcqSzm5Iqh1XQq9rdfAt6dp2DuPP0VHZIaCALc2v1cL5A==}
|
resolution: {integrity: sha512-mXF9AIgnvq1DP/ZM2R28tAfxP2wKZHYa2DjV0R1KCwcqSzm5Iqh1XQq9rdfAt6dp2DuPP0VHZIaCALc2v1cL5A==}
|
||||||
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
|
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
'@xmldom/xmldom': 0.8.8
|
||||||
dev: true
|
dev: true
|
||||||
bundledDependencies:
|
bundledDependencies:
|
||||||
- '@xmldom/xmldom'
|
- '@xmldom/xmldom'
|
||||||
@@ -4379,10 +4386,6 @@ packages:
|
|||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/type-fest@1.4.0:
|
|
||||||
resolution: {integrity: sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
|
|
||||||
/type-fest@2.19.0:
|
/type-fest@2.19.0:
|
||||||
resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}
|
resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}
|
||||||
engines: {node: '>=12.20'}
|
engines: {node: '>=12.20'}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@shipzone/npmci',
|
name: '@shipzone/npmci',
|
||||||
version: '4.1.12',
|
version: '4.1.20',
|
||||||
description: 'node and docker in gitlab ci on steroids'
|
description: 'node and docker in gitlab ci on steroids'
|
||||||
}
|
}
|
||||||
|
|||||||
67
ts/manager.cloudron/index.ts
Normal file
67
ts/manager.cloudron/index.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import { logger } from '../npmci.logging.js';
|
||||||
|
import * as plugins from './mod.plugins.js';
|
||||||
|
import * as paths from '../npmci.paths.js';
|
||||||
|
import { bash } from '../npmci.bash.js';
|
||||||
|
import { Npmci } from '../npmci.classes.npmci.js';
|
||||||
|
|
||||||
|
export class NpmciCloudronManager {
|
||||||
|
public npmciRef: Npmci;
|
||||||
|
|
||||||
|
constructor(npmciArg: Npmci) {
|
||||||
|
this.npmciRef = npmciArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* handle cli input
|
||||||
|
* @param argvArg
|
||||||
|
*/
|
||||||
|
public handleCli = async (argvArg: any) => {
|
||||||
|
if (argvArg._.length >= 2) {
|
||||||
|
const action: string = argvArg._[1];
|
||||||
|
switch (action) {
|
||||||
|
case 'deploy':
|
||||||
|
await this.deploy();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.log('error', `>>npmci cloudron ...<< action >>${action}<< not supported`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.log(
|
||||||
|
'info',
|
||||||
|
`>>npmci cloudron ...<< cli arguments invalid... Please read the documentation.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces the version string in CloudronManifest file
|
||||||
|
* @param versionArg
|
||||||
|
*/
|
||||||
|
public deploy = async () => {
|
||||||
|
logger.log('info', 'now deploying to cloudron...');
|
||||||
|
logger.log('info', 'installing cloudron cli...');
|
||||||
|
await bash(`pnpm install -g cloudron`);
|
||||||
|
logger.log('ok', 'cloudron cli installed');
|
||||||
|
|
||||||
|
// lets set the version in the CloudronManifest file
|
||||||
|
await this.prepareCloudronManifest(this.npmciRef.npmciConfig.getConfig().projectInfo.npm.version);
|
||||||
|
logger.log('ok', 'CloudronManifest prepared');
|
||||||
|
|
||||||
|
// lets figure out the docker image tag
|
||||||
|
const dockerImageTag = await this.npmciRef.npmciConfig.kvStorage.readKey('latestPushedDockerTag');
|
||||||
|
const appName = this.npmciRef.npmciConfig.getConfig().cloudronAppName;
|
||||||
|
|
||||||
|
const cloudronEnvVar = process.env.NPMCI_LOGIN_CLOUDRON;
|
||||||
|
const cloudronServer = cloudronEnvVar.split('|')[0];
|
||||||
|
const cloudronToken = cloudronEnvVar.split('|')[1];
|
||||||
|
await bash(`cloudron update --server ${cloudronServer} --token ${cloudronToken} --image ${dockerImageTag} --app ${appName}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
private prepareCloudronManifest = async (versionArg: string) => {
|
||||||
|
const manifestPath = plugins.path.join(paths.cwd, 'CloudronManifest.json');
|
||||||
|
let manifestFile = plugins.smartfile.fs.toStringSync(manifestPath);
|
||||||
|
manifestFile = manifestFile.replace(/##version##/g, versionArg);
|
||||||
|
plugins.smartfile.memory.toFsSync(manifestFile, manifestPath);
|
||||||
|
logger.log('info', 'Version replaced in CloudronManifest file');
|
||||||
|
}
|
||||||
|
}
|
||||||
1
ts/manager.cloudron/mod.plugins.ts
Normal file
1
ts/manager.cloudron/mod.plugins.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from '../npmci.plugins.js';
|
||||||
@@ -179,4 +179,12 @@ export class NpmciDockerManager {
|
|||||||
await this.prepare();
|
await this.prepare();
|
||||||
return await Dockerfile.readDockerfiles(this).then(Dockerfile.testDockerfiles);
|
return await Dockerfile.readDockerfiles(this).then(Dockerfile.testDockerfiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* can be used to get the Dockerfiles in the directory
|
||||||
|
*/
|
||||||
|
getDockerfiles = async () => {
|
||||||
|
const dockerfiles = await Dockerfile.readDockerfiles(this);
|
||||||
|
return dockerfiles;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,15 +120,19 @@ export class Dockerfile {
|
|||||||
* returns a version for a docker file
|
* returns a version for a docker file
|
||||||
* @execution SYNC
|
* @execution SYNC
|
||||||
*/
|
*/
|
||||||
public static dockerFileVersion(dockerfileNameArg: string): string {
|
public static dockerFileVersion(dockerfileInstanceArg: Dockerfile, dockerfileNameArg: string): string {
|
||||||
let versionString: string;
|
let versionString: string;
|
||||||
const versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/;
|
const versionRegex = /Dockerfile_([^:_]*)$/;
|
||||||
const regexResultArray = versionRegex.exec(dockerfileNameArg);
|
const regexResultArray = versionRegex.exec(dockerfileNameArg);
|
||||||
if (regexResultArray && regexResultArray.length === 2) {
|
if (regexResultArray && regexResultArray.length === 2) {
|
||||||
versionString = regexResultArray[1];
|
versionString = regexResultArray[1];
|
||||||
} else {
|
} else {
|
||||||
versionString = 'latest';
|
versionString = 'latest';
|
||||||
}
|
}
|
||||||
|
versionString = versionString.replace(
|
||||||
|
'##version##',
|
||||||
|
dockerfileInstanceArg.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version
|
||||||
|
);
|
||||||
return versionString;
|
return versionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +237,7 @@ export class Dockerfile {
|
|||||||
this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.user +
|
this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.user +
|
||||||
'/' +
|
'/' +
|
||||||
this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.repo;
|
this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.repo;
|
||||||
this.version = Dockerfile.dockerFileVersion(plugins.path.parse(options.filePath).base);
|
this.version = Dockerfile.dockerFileVersion(this, plugins.path.parse(options.filePath).base);
|
||||||
this.cleanTag = this.repo + ':' + this.version;
|
this.cleanTag = this.repo + ':' + this.version;
|
||||||
this.buildTag = this.cleanTag;
|
this.buildTag = this.cleanTag;
|
||||||
|
|
||||||
@@ -281,6 +285,7 @@ export class Dockerfile {
|
|||||||
labels: [],
|
labels: [],
|
||||||
version: this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version,
|
version: this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version,
|
||||||
});
|
});
|
||||||
|
await this.npmciDockerManagerRef.npmciRef.npmciConfig.kvStorage.writeKey('latestPushedDockerTag', this.pushTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class DockerRegistry {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const registryUrl = dockerRegexResultArray[0];
|
const registryUrl = dockerRegexResultArray[0].replace('https://', '').replace('http://', '');
|
||||||
const username = dockerRegexResultArray[1];
|
const username = dockerRegexResultArray[1];
|
||||||
const password = dockerRegexResultArray[2];
|
const password = dockerRegexResultArray[2];
|
||||||
return new DockerRegistry({
|
return new DockerRegistry({
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
import * as plugins from './npmci.plugins.js';
|
import * as plugins from './npmci.plugins.js';
|
||||||
|
|
||||||
import { CloudlyConnector } from './connector.cloudly/cloudlyconnector.js';
|
|
||||||
|
|
||||||
|
// env
|
||||||
|
import { NpmciEnv } from './npmci.classes.npmcienv.js';
|
||||||
import { NpmciInfo } from './npmci.classes.npmciinfo.js';
|
import { NpmciInfo } from './npmci.classes.npmciinfo.js';
|
||||||
import { NpmciCli } from './npmci.classes.npmcicli.js';
|
import { NpmciCli } from './npmci.classes.npmcicli.js';
|
||||||
import { NpmciConfig } from './npmci.classes.npmciconfig.js';
|
import { NpmciConfig } from './npmci.classes.npmciconfig.js';
|
||||||
|
|
||||||
// mods
|
// connectors
|
||||||
|
import { CloudlyConnector } from './connector.cloudly/cloudlyconnector.js';
|
||||||
|
|
||||||
|
// managers
|
||||||
|
import { NpmciCloudronManager } from './manager.cloudron/index.js';
|
||||||
import { NpmciDockerManager } from './manager.docker/index.js';
|
import { NpmciDockerManager } from './manager.docker/index.js';
|
||||||
import { NpmciGitManager } from './manager.git/index.js';
|
import { NpmciGitManager } from './manager.git/index.js';
|
||||||
import { NpmciNodeJsManager } from './manager.nodejs/index.js';
|
import { NpmciNodeJsManager } from './manager.nodejs/index.js';
|
||||||
import { NpmciNpmManager } from './manager.npm/index.js';
|
import { NpmciNpmManager } from './manager.npm/index.js';
|
||||||
import { NpmciEnv } from './npmci.classes.npmcienv.js';
|
|
||||||
|
|
||||||
export class Npmci {
|
export class Npmci {
|
||||||
public analytics: plugins.smartanalytics.Analytics;
|
public analytics: plugins.smartanalytics.Analytics;
|
||||||
@@ -23,6 +27,7 @@ export class Npmci {
|
|||||||
public npmciCli: NpmciCli;
|
public npmciCli: NpmciCli;
|
||||||
|
|
||||||
// managers
|
// managers
|
||||||
|
public cloudronManager: NpmciCloudronManager;
|
||||||
public dockerManager: NpmciDockerManager;
|
public dockerManager: NpmciDockerManager;
|
||||||
public gitManager: NpmciGitManager;
|
public gitManager: NpmciGitManager;
|
||||||
public nodejsManager: NpmciNodeJsManager;
|
public nodejsManager: NpmciNodeJsManager;
|
||||||
@@ -41,6 +46,7 @@ export class Npmci {
|
|||||||
this.npmciConfig = new NpmciConfig(this);
|
this.npmciConfig = new NpmciConfig(this);
|
||||||
|
|
||||||
// managers
|
// managers
|
||||||
|
this.cloudronManager = new NpmciCloudronManager(this);
|
||||||
this.dockerManager = new NpmciDockerManager(this);
|
this.dockerManager = new NpmciDockerManager(this);
|
||||||
this.gitManager = new NpmciGitManager(this);
|
this.gitManager = new NpmciGitManager(this);
|
||||||
this.nodejsManager = new NpmciNodeJsManager(this);
|
this.nodejsManager = new NpmciNodeJsManager(this);
|
||||||
|
|||||||
@@ -24,6 +24,17 @@ export class NpmciCli {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// cloudron
|
||||||
|
this.smartcli.addCommand('cloudron').subscribe(
|
||||||
|
async (argv) => {
|
||||||
|
await this.npmciRef.cloudronManager.handleCli(argv);
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.log(err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// command
|
// command
|
||||||
this.smartcli.addCommand('command').subscribe(
|
this.smartcli.addCommand('command').subscribe(
|
||||||
async (argv) => {
|
async (argv) => {
|
||||||
@@ -36,7 +47,7 @@ export class NpmciCli {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// command
|
// git
|
||||||
this.smartcli.addCommand('git').subscribe(
|
this.smartcli.addCommand('git').subscribe(
|
||||||
async (argvArg) => {
|
async (argvArg) => {
|
||||||
await this.npmciRef.gitManager.handleCli(argvArg);
|
await this.npmciRef.gitManager.handleCli(argvArg);
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ export interface INpmciOptions {
|
|||||||
|
|
||||||
// urls
|
// urls
|
||||||
urlCloudly: string;
|
urlCloudly: string;
|
||||||
|
|
||||||
|
// cloudron
|
||||||
|
cloudronAppName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ export class NpmciEnv {
|
|||||||
|
|
||||||
constructor(npmciRefArg: Npmci) {
|
constructor(npmciRefArg: Npmci) {
|
||||||
this.npmciRef = npmciRefArg;
|
this.npmciRef = npmciRefArg;
|
||||||
this.repoString = process.env.CI_REPOSITORY_URL;
|
if (process.env.GITLAB_CI) {
|
||||||
|
this.repoString = process.env.CI_REPOSITORY_URL;
|
||||||
|
}
|
||||||
|
if (process.env.NPMCI_COMPUTED_REPOURL) {
|
||||||
|
this.repoString = process.env.NPMCI_COMPUTED_REPOURL;
|
||||||
|
}
|
||||||
if (!this.repoString) {
|
if (!this.repoString) {
|
||||||
this.repoString = 'https://undefined:undefined@github.com/undefined/undefined.git';
|
this.repoString = 'https://undefined:undefined@github.com/undefined/undefined.git';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user