@goldstack/utils-docker 0.3.17 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/utilsDocker.d.ts +4 -4
- package/dist/src/utilsDocker.js +144 -144
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const hasDocker: () => boolean;
|
|
2
|
-
export declare const assertDocker: () => void;
|
|
3
|
-
export declare const renderHostEnvironmentVariables: () => string;
|
|
4
|
-
export declare const imageGoldstackBuild: () => string;
|
|
1
|
+
export declare const hasDocker: () => boolean;
|
|
2
|
+
export declare const assertDocker: () => void;
|
|
3
|
+
export declare const renderHostEnvironmentVariables: () => string;
|
|
4
|
+
export declare const imageGoldstackBuild: () => string;
|
|
5
5
|
//# sourceMappingURL=utilsDocker.d.ts.map
|
package/dist/src/utilsDocker.js
CHANGED
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.imageGoldstackBuild = exports.renderHostEnvironmentVariables = exports.assertDocker = exports.hasDocker = void 0;
|
|
4
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
5
|
-
const hasDocker = () => {
|
|
6
|
-
if (!(0, utils_sh_1.commandExists)('docker')) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
exports.hasDocker = hasDocker;
|
|
14
|
-
const assertDocker = () => {
|
|
15
|
-
if (!(0, utils_sh_1.commandExists)('docker')) {
|
|
16
|
-
throw new Error('Docker must be installed. Please install Docker and ensure the "docker" command is available in your terminal.');
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
(0, utils_sh_1.exec)('docker version', { silent: true });
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
throw new Error('Docker must be running. Please start the docker service.');
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.assertDocker = assertDocker;
|
|
26
|
-
const cleanEnvVariableValue = (value) => {
|
|
27
|
-
if (value && value.indexOf('"') > -1) {
|
|
28
|
-
return '';
|
|
29
|
-
}
|
|
30
|
-
if (value && value.indexOf('\\') > -1) {
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
return value;
|
|
34
|
-
};
|
|
35
|
-
const GITHUB_ACTIONS_ENV_VARIABLES = [
|
|
36
|
-
'DEPLOYMENT_BASEPATH',
|
|
37
|
-
'USER',
|
|
38
|
-
'npm_config_user_agent'.toLocaleUpperCase(),
|
|
39
|
-
'CI',
|
|
40
|
-
'JAVA_HOME_7_X64',
|
|
41
|
-
'npm_node_execpath'.toLocaleUpperCase(),
|
|
42
|
-
'NODE_AUTH_TOKEN',
|
|
43
|
-
'JAVA_HOME_8_X64',
|
|
44
|
-
'SHLVL',
|
|
45
|
-
'HOME',
|
|
46
|
-
'RUNNER_TEMP',
|
|
47
|
-
'GITHUB_EVENT_PATH',
|
|
48
|
-
'JAVA_HOME_11_X64',
|
|
49
|
-
'GITHUB_REPOSITORY_OWNER',
|
|
50
|
-
'JAVA_HOME_12_X64',
|
|
51
|
-
'GRADLE_HOME',
|
|
52
|
-
'NODE_OPTIONS',
|
|
53
|
-
'AZURE_EXTENSION_DIR',
|
|
54
|
-
'POWERSHELL_DISTRIBUTION_CHANNEL',
|
|
55
|
-
'GOROOT',
|
|
56
|
-
'GOROOT_1_11_X64',
|
|
57
|
-
'BOOST_ROOT_1_72_0',
|
|
58
|
-
'ImageVersion'.toLocaleUpperCase(),
|
|
59
|
-
'GOROOT_1_12_X64',
|
|
60
|
-
'GITHUB_API_URL',
|
|
61
|
-
'SWIFT_PATH',
|
|
62
|
-
'GOROOT_1_13_X64',
|
|
63
|
-
'RUNNER_OS',
|
|
64
|
-
'JOURNAL_STREAM',
|
|
65
|
-
'GOROOT_1_14_X64',
|
|
66
|
-
'CHROMEWEBDRIVER',
|
|
67
|
-
'RUNNER_USER',
|
|
68
|
-
'GITHUB_WORKFLOW',
|
|
69
|
-
'GITHUB_RUN_ID',
|
|
70
|
-
'ImageOS'.toLocaleUpperCase(),
|
|
71
|
-
'BOOST_ROOT_1_69_0',
|
|
72
|
-
'PERFLOG_LOCATION_SETTING',
|
|
73
|
-
'INVOCATION_ID',
|
|
74
|
-
'RUNNER_TOOL_CACHE',
|
|
75
|
-
'RUNNER_TRACKING_ID',
|
|
76
|
-
'NPM_CONFIG_USERCONFIG',
|
|
77
|
-
'ANT_HOME',
|
|
78
|
-
'AGENT_TOOLSDIRECTORY',
|
|
79
|
-
'GITHUB_ACTION',
|
|
80
|
-
'GITHUB_RUN_NUMBER',
|
|
81
|
-
'LANG',
|
|
82
|
-
'VCPKG_INSTALLATION_ROOT',
|
|
83
|
-
'CONDA',
|
|
84
|
-
'GITHUB_REPOSITORY',
|
|
85
|
-
'DEBIAN_FRONTEND',
|
|
86
|
-
'GITHUB_ACTIONS',
|
|
87
|
-
'npm_lifecycle_event'.toLocaleUpperCase(),
|
|
88
|
-
'YARN_IGNORE_CWD',
|
|
89
|
-
'GITHUB_JOB',
|
|
90
|
-
'RUNNER_PERFLOG',
|
|
91
|
-
'GITHUB_WORKSPACE',
|
|
92
|
-
'GITHUB_SHA',
|
|
93
|
-
'ANDROID_SDK_ROOT',
|
|
94
|
-
'GITHUB_ACTOR',
|
|
95
|
-
'GITHUB_REF',
|
|
96
|
-
'LEIN_HOME',
|
|
97
|
-
'JAVA_HOME',
|
|
98
|
-
'PWD',
|
|
99
|
-
'RUNNER_WORKSPACE',
|
|
100
|
-
'BERRY_BIN_FOLDER',
|
|
101
|
-
'ANDROID_HOME',
|
|
102
|
-
'GECKOWEBDRIVER',
|
|
103
|
-
'GITHUB_EVENT_NAME',
|
|
104
|
-
'LEIN_JAR',
|
|
105
|
-
'M2_HOME',
|
|
106
|
-
'CHROME_BIN',
|
|
107
|
-
'SELENIUM_JAR_PATH',
|
|
108
|
-
'INIT_CWD',
|
|
109
|
-
'NODE_ENV',
|
|
110
|
-
'JEST_WORKER_ID',
|
|
111
|
-
];
|
|
112
|
-
const renderHostEnvironmentVariables = () => {
|
|
113
|
-
return Object.keys(process.env)
|
|
114
|
-
.map((key) => {
|
|
115
|
-
const normKey = key.toLocaleUpperCase();
|
|
116
|
-
if (normKey === 'PATH' ||
|
|
117
|
-
normKey === 'PATHEXT' ||
|
|
118
|
-
normKey === 'OS' ||
|
|
119
|
-
normKey === 'NVM_HOME' ||
|
|
120
|
-
normKey === 'NPM_EXECPATH' ||
|
|
121
|
-
normKey === 'NVM_SYMLINK' ||
|
|
122
|
-
normKey === 'HOME' ||
|
|
123
|
-
normKey === 'npm_config_user_agent'.toLocaleUpperCase() ||
|
|
124
|
-
normKey === 'JAVA_HOME_7_X64' ||
|
|
125
|
-
normKey === 'npm_node_execpath'.toLocaleUpperCase() ||
|
|
126
|
-
normKey === 'NODE_OPTIONS' ||
|
|
127
|
-
normKey === 'GOROOT' ||
|
|
128
|
-
GITHUB_ACTIONS_ENV_VARIABLES.indexOf(normKey) > -1) {
|
|
129
|
-
return '';
|
|
130
|
-
}
|
|
131
|
-
const value = process.env[key];
|
|
132
|
-
if (value) {
|
|
133
|
-
const cleanedValue = cleanEnvVariableValue(value);
|
|
134
|
-
if (cleanedValue) {
|
|
135
|
-
return `-e "${key}"="${cleanedValue}" `;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return '';
|
|
139
|
-
})
|
|
140
|
-
.join('');
|
|
141
|
-
};
|
|
142
|
-
exports.renderHostEnvironmentVariables = renderHostEnvironmentVariables;
|
|
143
|
-
const imageGoldstackBuild = () => 'goldstack/goldstack-docker-build:0.1.3';
|
|
144
|
-
exports.imageGoldstackBuild = imageGoldstackBuild;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.imageGoldstackBuild = exports.renderHostEnvironmentVariables = exports.assertDocker = exports.hasDocker = void 0;
|
|
4
|
+
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
5
|
+
const hasDocker = () => {
|
|
6
|
+
if (!(0, utils_sh_1.commandExists)('docker')) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.hasDocker = hasDocker;
|
|
14
|
+
const assertDocker = () => {
|
|
15
|
+
if (!(0, utils_sh_1.commandExists)('docker')) {
|
|
16
|
+
throw new Error('Docker must be installed. Please install Docker and ensure the "docker" command is available in your terminal.');
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
(0, utils_sh_1.exec)('docker version', { silent: true });
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
throw new Error('Docker must be running. Please start the docker service.');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.assertDocker = assertDocker;
|
|
26
|
+
const cleanEnvVariableValue = (value) => {
|
|
27
|
+
if (value && value.indexOf('"') > -1) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
if (value && value.indexOf('\\') > -1) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
};
|
|
35
|
+
const GITHUB_ACTIONS_ENV_VARIABLES = [
|
|
36
|
+
'DEPLOYMENT_BASEPATH',
|
|
37
|
+
'USER',
|
|
38
|
+
'npm_config_user_agent'.toLocaleUpperCase(),
|
|
39
|
+
'CI',
|
|
40
|
+
'JAVA_HOME_7_X64',
|
|
41
|
+
'npm_node_execpath'.toLocaleUpperCase(),
|
|
42
|
+
'NODE_AUTH_TOKEN',
|
|
43
|
+
'JAVA_HOME_8_X64',
|
|
44
|
+
'SHLVL',
|
|
45
|
+
'HOME',
|
|
46
|
+
'RUNNER_TEMP',
|
|
47
|
+
'GITHUB_EVENT_PATH',
|
|
48
|
+
'JAVA_HOME_11_X64',
|
|
49
|
+
'GITHUB_REPOSITORY_OWNER',
|
|
50
|
+
'JAVA_HOME_12_X64',
|
|
51
|
+
'GRADLE_HOME',
|
|
52
|
+
'NODE_OPTIONS',
|
|
53
|
+
'AZURE_EXTENSION_DIR',
|
|
54
|
+
'POWERSHELL_DISTRIBUTION_CHANNEL',
|
|
55
|
+
'GOROOT',
|
|
56
|
+
'GOROOT_1_11_X64',
|
|
57
|
+
'BOOST_ROOT_1_72_0',
|
|
58
|
+
'ImageVersion'.toLocaleUpperCase(),
|
|
59
|
+
'GOROOT_1_12_X64',
|
|
60
|
+
'GITHUB_API_URL',
|
|
61
|
+
'SWIFT_PATH',
|
|
62
|
+
'GOROOT_1_13_X64',
|
|
63
|
+
'RUNNER_OS',
|
|
64
|
+
'JOURNAL_STREAM',
|
|
65
|
+
'GOROOT_1_14_X64',
|
|
66
|
+
'CHROMEWEBDRIVER',
|
|
67
|
+
'RUNNER_USER',
|
|
68
|
+
'GITHUB_WORKFLOW',
|
|
69
|
+
'GITHUB_RUN_ID',
|
|
70
|
+
'ImageOS'.toLocaleUpperCase(),
|
|
71
|
+
'BOOST_ROOT_1_69_0',
|
|
72
|
+
'PERFLOG_LOCATION_SETTING',
|
|
73
|
+
'INVOCATION_ID',
|
|
74
|
+
'RUNNER_TOOL_CACHE',
|
|
75
|
+
'RUNNER_TRACKING_ID',
|
|
76
|
+
'NPM_CONFIG_USERCONFIG',
|
|
77
|
+
'ANT_HOME',
|
|
78
|
+
'AGENT_TOOLSDIRECTORY',
|
|
79
|
+
'GITHUB_ACTION',
|
|
80
|
+
'GITHUB_RUN_NUMBER',
|
|
81
|
+
'LANG',
|
|
82
|
+
'VCPKG_INSTALLATION_ROOT',
|
|
83
|
+
'CONDA',
|
|
84
|
+
'GITHUB_REPOSITORY',
|
|
85
|
+
'DEBIAN_FRONTEND',
|
|
86
|
+
'GITHUB_ACTIONS',
|
|
87
|
+
'npm_lifecycle_event'.toLocaleUpperCase(),
|
|
88
|
+
'YARN_IGNORE_CWD',
|
|
89
|
+
'GITHUB_JOB',
|
|
90
|
+
'RUNNER_PERFLOG',
|
|
91
|
+
'GITHUB_WORKSPACE',
|
|
92
|
+
'GITHUB_SHA',
|
|
93
|
+
'ANDROID_SDK_ROOT',
|
|
94
|
+
'GITHUB_ACTOR',
|
|
95
|
+
'GITHUB_REF',
|
|
96
|
+
'LEIN_HOME',
|
|
97
|
+
'JAVA_HOME',
|
|
98
|
+
'PWD',
|
|
99
|
+
'RUNNER_WORKSPACE',
|
|
100
|
+
'BERRY_BIN_FOLDER',
|
|
101
|
+
'ANDROID_HOME',
|
|
102
|
+
'GECKOWEBDRIVER',
|
|
103
|
+
'GITHUB_EVENT_NAME',
|
|
104
|
+
'LEIN_JAR',
|
|
105
|
+
'M2_HOME',
|
|
106
|
+
'CHROME_BIN',
|
|
107
|
+
'SELENIUM_JAR_PATH',
|
|
108
|
+
'INIT_CWD',
|
|
109
|
+
'NODE_ENV',
|
|
110
|
+
'JEST_WORKER_ID',
|
|
111
|
+
];
|
|
112
|
+
const renderHostEnvironmentVariables = () => {
|
|
113
|
+
return Object.keys(process.env)
|
|
114
|
+
.map((key) => {
|
|
115
|
+
const normKey = key.toLocaleUpperCase();
|
|
116
|
+
if (normKey === 'PATH' ||
|
|
117
|
+
normKey === 'PATHEXT' ||
|
|
118
|
+
normKey === 'OS' ||
|
|
119
|
+
normKey === 'NVM_HOME' ||
|
|
120
|
+
normKey === 'NPM_EXECPATH' ||
|
|
121
|
+
normKey === 'NVM_SYMLINK' ||
|
|
122
|
+
normKey === 'HOME' ||
|
|
123
|
+
normKey === 'npm_config_user_agent'.toLocaleUpperCase() ||
|
|
124
|
+
normKey === 'JAVA_HOME_7_X64' ||
|
|
125
|
+
normKey === 'npm_node_execpath'.toLocaleUpperCase() ||
|
|
126
|
+
normKey === 'NODE_OPTIONS' ||
|
|
127
|
+
normKey === 'GOROOT' ||
|
|
128
|
+
GITHUB_ACTIONS_ENV_VARIABLES.indexOf(normKey) > -1) {
|
|
129
|
+
return '';
|
|
130
|
+
}
|
|
131
|
+
const value = process.env[key];
|
|
132
|
+
if (value) {
|
|
133
|
+
const cleanedValue = cleanEnvVariableValue(value);
|
|
134
|
+
if (cleanedValue) {
|
|
135
|
+
return `-e "${key}"="${cleanedValue}" `;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return '';
|
|
139
|
+
})
|
|
140
|
+
.join('');
|
|
141
|
+
};
|
|
142
|
+
exports.renderHostEnvironmentVariables = renderHostEnvironmentVariables;
|
|
143
|
+
const imageGoldstackBuild = () => 'goldstack/goldstack-docker-build:0.1.3';
|
|
144
|
+
exports.imageGoldstackBuild = imageGoldstackBuild;
|
|
145
145
|
//# sourceMappingURL=utilsDocker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/utils-docker",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Utilities to run commands in local docker containers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@goldstack/utils-sh": "0.4.
|
|
37
|
+
"@goldstack/utils-sh": "0.4.16"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@goldstack/utils-git": "0.1.28",
|