plugin-workflow-portainer 0.0.0-stage → 0.2.0
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/LICENSE +176 -0
- package/README.md +31 -3
- package/client-v2.js +1 -0
- package/client.js +1 -0
- package/dist/client/127.09e6675863ac8138.js +10 -0
- package/dist/client/57.67f04a547ead06b8.js +10 -0
- package/dist/client/660.546c702d1ddf7eff.js +10 -0
- package/dist/client/981.e38099c59bf992f0.js +10 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/127.9f65dc2e3d0df10a.js +10 -0
- package/dist/client-v2/57.a60e16e4b4e4fa28.js +10 -0
- package/dist/client-v2/660.29ae3c3b4040039d.js +10 -0
- package/dist/client-v2/981.8627062881ad83d1.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +20 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +193 -0
- package/dist/locale/vi-VN.json +193 -0
- package/dist/locale/zh-CN.json +193 -0
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +207 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1084 -0
- package/dist/node_modules/joi/lib/types/link.js +184 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/server/actions/portainer.js +317 -0
- package/dist/server/collections/portainer-instances.js +54 -0
- package/dist/server/index.js +54 -0
- package/dist/server/instructions/PortainerStackControlInstruction.js +156 -0
- package/dist/server/instructions/PortainerStackRedeployInstruction.js +254 -0
- package/dist/server/instructions/helpers.js +211 -0
- package/dist/server/plugin.js +177 -0
- package/dist/server/services/PortainerClient.js +669 -0
- package/dist/shared/collection.js +57 -0
- package/dist/shared/constants.js +66 -0
- package/dist/shared/env.js +238 -0
- package/dist/shared/types.js +24 -0
- package/package.json +50 -4
- package/server.js +1 -0
- package/src/client/index.tsx +50 -0
- package/src/client/instructions.tsx +76 -0
- package/src/client-v2/__tests__/workflow-registration.test.tsx +242 -0
- package/src/client-v2/components/ControlFieldset.tsx +46 -0
- package/src/client-v2/components/PortainerEnvEditor.tsx +223 -0
- package/src/client-v2/components/PortainerSettingsPage.tsx +707 -0
- package/src/client-v2/components/PortainerTargetFields.tsx +309 -0
- package/src/client-v2/components/RedeployFieldset.tsx +124 -0
- package/src/client-v2/components/StackDetailDrawer.tsx +790 -0
- package/src/client-v2/index.tsx +50 -0
- package/src/client-v2/instructions.tsx +162 -0
- package/src/client-v2/locale.ts +24 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +193 -0
- package/src/locale/vi-VN.json +193 -0
- package/src/locale/zh-CN.json +193 -0
- package/src/server/__tests__/portainer-workflow.test.ts +559 -0
- package/src/server/actions/portainer.ts +361 -0
- package/src/server/collections/portainer-instances.ts +34 -0
- package/src/server/index.ts +13 -0
- package/src/server/instructions/PortainerStackControlInstruction.ts +139 -0
- package/src/server/instructions/PortainerStackRedeployInstruction.ts +255 -0
- package/src/server/instructions/helpers.ts +237 -0
- package/src/server/plugin.ts +174 -0
- package/src/server/services/PortainerClient.ts +846 -0
- package/src/shared/collection.ts +32 -0
- package/src/shared/constants.ts +25 -0
- package/src/shared/env.ts +243 -0
- package/src/shared/types.ts +164 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { DEFAULT_TIMEOUT_MS, PORTAINER_INSTANCES_COLLECTION } from './constants';
|
|
11
|
+
|
|
12
|
+
export const portainerInstancesCollection = {
|
|
13
|
+
name: PORTAINER_INSTANCES_COLLECTION,
|
|
14
|
+
title: 'Portainer Instances',
|
|
15
|
+
hidden: true,
|
|
16
|
+
fields: [
|
|
17
|
+
{ name: 'id', type: 'bigInt', autoIncrement: true, primaryKey: true },
|
|
18
|
+
{ name: 'name', type: 'string' },
|
|
19
|
+
{ name: 'baseUrl', type: 'string' },
|
|
20
|
+
{ name: 'apiKey', type: 'text' },
|
|
21
|
+
{ name: 'gitUsername', type: 'string' },
|
|
22
|
+
{ name: 'gitAccessToken', type: 'text' },
|
|
23
|
+
{ name: 'gitCredentialId', type: 'integer' },
|
|
24
|
+
{ name: 'allowInsecureTls', type: 'boolean', defaultValue: false },
|
|
25
|
+
{ name: 'defaultTimeoutMs', type: 'integer', defaultValue: DEFAULT_TIMEOUT_MS },
|
|
26
|
+
{ name: 'isDefault', type: 'boolean', defaultValue: false },
|
|
27
|
+
{ name: 'enabled', type: 'boolean', defaultValue: true },
|
|
28
|
+
{ name: 'lastHealthStatus', type: 'string' },
|
|
29
|
+
{ name: 'lastVersion', type: 'string' },
|
|
30
|
+
{ name: 'lastCheckedAt', type: 'date' },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const PLUGIN_NAMESPACE = 'plugin-workflow-portainer';
|
|
11
|
+
export const PORTAINER_INSTANCES_COLLECTION = 'portainerInstances';
|
|
12
|
+
export const PORTAINER_RESOURCE = 'portainerWorkflow';
|
|
13
|
+
export const PORTAINER_ACL_SNIPPET = 'pm.plugin-workflow-portainer';
|
|
14
|
+
|
|
15
|
+
export const INSTRUCTION_GROUP_KEY = 'portainer';
|
|
16
|
+
|
|
17
|
+
export const INSTRUCTION_TYPES = {
|
|
18
|
+
redeploy: 'portainer-stack-redeploy',
|
|
19
|
+
control: 'portainer-stack-control',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export const SECRET_MASK = '••••••••';
|
|
23
|
+
export const DEFAULT_TIMEOUT_MS = 600_000;
|
|
24
|
+
export const MIN_TIMEOUT_MS = 1_000;
|
|
25
|
+
export const MAX_TIMEOUT_MS = 3_600_000;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { SECRET_MASK } from './constants';
|
|
11
|
+
import type { ConfigurableEnvItem, EnvMergeStrategy, PortainerEnvPair } from './types';
|
|
12
|
+
|
|
13
|
+
const ENV_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
14
|
+
const SENSITIVE_ENV_KEY_PATTERN = /(password|passwd|secret|token|api[_-]?key|private[_-]?key|access[_-]?key)/i;
|
|
15
|
+
|
|
16
|
+
export function isValidEnvKey(key: string): boolean {
|
|
17
|
+
return ENV_KEY_PATTERN.test(key.trim());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isLikelySensitiveKey(key: string): boolean {
|
|
21
|
+
return SENSITIVE_ENV_KEY_PATTERN.test(key);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function isWorkflowVariableValue(value: unknown): value is string {
|
|
25
|
+
return typeof value === 'string' && /^\{\{\s*[\s\S]+?\s*\}\}$/.test(value.trim());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function toFiniteNumber(value: unknown): number | undefined {
|
|
29
|
+
if (typeof value === 'number') {
|
|
30
|
+
return Number.isFinite(value) ? value : undefined;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'string' && value.trim() !== '' && !isWorkflowVariableValue(value)) {
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function stripMatchingQuotes(raw: string): string {
|
|
40
|
+
if (raw.length >= 2) {
|
|
41
|
+
const first = raw[0];
|
|
42
|
+
const last = raw[raw.length - 1];
|
|
43
|
+
if ((first === '"' && last === '"') || (first === "'" && last === "'")) {
|
|
44
|
+
return raw.slice(1, -1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return raw;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function stringifyEnvValue(value: unknown): string {
|
|
51
|
+
if (value === null || typeof value === 'undefined') {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === 'string') {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
58
|
+
return String(value);
|
|
59
|
+
}
|
|
60
|
+
return JSON.stringify(value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Parse multi-line `.env` content (`KEY=VALUE` or `export KEY=VALUE`) into ordered pairs.
|
|
65
|
+
*/
|
|
66
|
+
export function parseDotEnvText(text?: string | null): PortainerEnvPair[] {
|
|
67
|
+
if (!text || typeof text !== 'string') {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const result: PortainerEnvPair[] = [];
|
|
71
|
+
const lines = text.split(/\r?\n/);
|
|
72
|
+
for (const rawLine of lines) {
|
|
73
|
+
const trimmed = rawLine.trim();
|
|
74
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const normalized = trimmed.startsWith('export ') ? trimmed.slice(7).trim() : trimmed;
|
|
78
|
+
const eqIndex = normalized.indexOf('=');
|
|
79
|
+
if (eqIndex <= 0) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const name = normalized.slice(0, eqIndex).trim();
|
|
83
|
+
if (!isValidEnvKey(name)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const rawVal = normalized.slice(eqIndex + 1).trim();
|
|
87
|
+
result.push({
|
|
88
|
+
name,
|
|
89
|
+
value: stripMatchingQuotes(rawVal),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function isPlainRecord(value: unknown): value is Record<string, unknown> {
|
|
96
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Normalize dynamic workflow env input from an array (`[{ name, value }]`), record (`{ KEY: val }`),
|
|
101
|
+
* JSON string, or `.env` text fallback.
|
|
102
|
+
*/
|
|
103
|
+
export function parseDynamicEnvInput(input: unknown): PortainerEnvPair[] {
|
|
104
|
+
if (input === null || typeof input === 'undefined' || input === '') {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let resolved: unknown = input;
|
|
109
|
+
if (typeof input === 'string') {
|
|
110
|
+
const trimmed = input.trim();
|
|
111
|
+
if (!trimmed) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
|
|
115
|
+
try {
|
|
116
|
+
resolved = JSON.parse(trimmed);
|
|
117
|
+
} catch {
|
|
118
|
+
throw new Error('Dynamic environment JSON is invalid');
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
return parseDotEnvText(trimmed);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (Array.isArray(resolved)) {
|
|
126
|
+
const pairs: PortainerEnvPair[] = [];
|
|
127
|
+
for (const item of resolved) {
|
|
128
|
+
if (!isPlainRecord(item)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const rawName = typeof item.name === 'string' ? item.name : typeof item.key === 'string' ? item.key : '';
|
|
132
|
+
const name = rawName.trim();
|
|
133
|
+
if (!name || !isValidEnvKey(name)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
pairs.push({
|
|
137
|
+
name,
|
|
138
|
+
value: stringifyEnvValue(item.value),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return pairs;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (isPlainRecord(resolved)) {
|
|
145
|
+
const pairs: PortainerEnvPair[] = [];
|
|
146
|
+
for (const [rawKey, val] of Object.entries(resolved)) {
|
|
147
|
+
const name = rawKey.trim();
|
|
148
|
+
if (!name || !isValidEnvKey(name)) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
pairs.push({
|
|
152
|
+
name,
|
|
153
|
+
value: stringifyEnvValue(val),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return pairs;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface MergedEnvResult {
|
|
163
|
+
env: PortainerEnvPair[];
|
|
164
|
+
maskedEnv: Record<string, string>;
|
|
165
|
+
secretKeys: string[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Deterministically build the final Portainer Stack `env` array and a redacted view for logs/job outputs.
|
|
170
|
+
* Precedence: existing Stack.Env (when strategy === 'merge') -> dynamicEnv -> envText -> envPairs.
|
|
171
|
+
*/
|
|
172
|
+
export function buildEffectiveStackEnv(options: {
|
|
173
|
+
existingEnv?: PortainerEnvPair[];
|
|
174
|
+
strategy?: EnvMergeStrategy;
|
|
175
|
+
dynamicEnv?: unknown;
|
|
176
|
+
envText?: string | null;
|
|
177
|
+
envPairs?: ConfigurableEnvItem[];
|
|
178
|
+
}): MergedEnvResult {
|
|
179
|
+
const map = new Map<string, string>();
|
|
180
|
+
const explicitSecrets = new Set<string>();
|
|
181
|
+
|
|
182
|
+
if ((options.strategy ?? 'merge') === 'merge' && Array.isArray(options.existingEnv)) {
|
|
183
|
+
for (const item of options.existingEnv) {
|
|
184
|
+
const name = String(item?.name ?? '').trim();
|
|
185
|
+
if (name) {
|
|
186
|
+
map.set(name, stringifyEnvValue(item.value));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (const item of parseDynamicEnvInput(options.dynamicEnv)) {
|
|
192
|
+
map.set(item.name, item.value);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
for (const item of parseDotEnvText(options.envText)) {
|
|
196
|
+
map.set(item.name, item.value);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (Array.isArray(options.envPairs)) {
|
|
200
|
+
for (const item of options.envPairs) {
|
|
201
|
+
const name = String(item?.name ?? '').trim();
|
|
202
|
+
if (!name) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (!isValidEnvKey(name)) {
|
|
206
|
+
throw new Error(`Invalid environment variable name "${name}"`);
|
|
207
|
+
}
|
|
208
|
+
map.set(name, stringifyEnvValue(item.value));
|
|
209
|
+
if (item.secret) {
|
|
210
|
+
explicitSecrets.add(name);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const env: PortainerEnvPair[] = [];
|
|
216
|
+
const maskedEnv: Record<string, string> = {};
|
|
217
|
+
const secretKeys: string[] = [];
|
|
218
|
+
|
|
219
|
+
for (const [name, value] of map.entries()) {
|
|
220
|
+
env.push({ name, value });
|
|
221
|
+
const shouldMask = explicitSecrets.has(name) || isLikelySensitiveKey(name);
|
|
222
|
+
if (shouldMask) {
|
|
223
|
+
secretKeys.push(name);
|
|
224
|
+
maskedEnv[name] = SECRET_MASK;
|
|
225
|
+
} else {
|
|
226
|
+
maskedEnv[name] = value;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return { env, maskedEnv, secretKeys };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function normalizeGitReference(ref?: string | null, fallback?: string | null): string {
|
|
234
|
+
const raw = String(ref ?? '').trim();
|
|
235
|
+
if (!raw) {
|
|
236
|
+
const fb = String(fallback ?? '').trim();
|
|
237
|
+
return fb || 'refs/heads/main';
|
|
238
|
+
}
|
|
239
|
+
if (raw.startsWith('refs/')) {
|
|
240
|
+
return raw;
|
|
241
|
+
}
|
|
242
|
+
return `refs/heads/${raw}`;
|
|
243
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type ID = string | number;
|
|
11
|
+
|
|
12
|
+
export interface PortainerEnvPair {
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ConfigurableEnvItem {
|
|
18
|
+
name?: string;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
secret?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type RedeployTargetMode = 'stack' | 'webhook';
|
|
24
|
+
export type EnvMergeStrategy = 'merge' | 'replace';
|
|
25
|
+
export type StackControlAction = 'inspect' | 'start' | 'stop';
|
|
26
|
+
|
|
27
|
+
export interface PortainerStackRedeployConfig {
|
|
28
|
+
instanceId?: ID | string | null;
|
|
29
|
+
mode?: RedeployTargetMode;
|
|
30
|
+
endpointId?: ID | string | null;
|
|
31
|
+
stackId?: ID | string | null;
|
|
32
|
+
webhookId?: string | null;
|
|
33
|
+
webhookTag?: string | null;
|
|
34
|
+
gitReference?: string | null;
|
|
35
|
+
repullImage?: boolean;
|
|
36
|
+
prune?: boolean;
|
|
37
|
+
envStrategy?: EnvMergeStrategy;
|
|
38
|
+
dynamicEnv?: unknown;
|
|
39
|
+
envText?: string | null;
|
|
40
|
+
envPairs?: ConfigurableEnvItem[];
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
ignoreFail?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface PortainerStackControlConfig {
|
|
46
|
+
instanceId?: ID | string | null;
|
|
47
|
+
endpointId?: ID | string | null;
|
|
48
|
+
stackId?: ID | string | null;
|
|
49
|
+
action?: StackControlAction;
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
ignoreFail?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface PortainerEndpointSummary {
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
type: number;
|
|
58
|
+
status: number;
|
|
59
|
+
url?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PortainerStackSummary {
|
|
63
|
+
id: number;
|
|
64
|
+
name: string;
|
|
65
|
+
endpointId: number;
|
|
66
|
+
type: number;
|
|
67
|
+
status: number;
|
|
68
|
+
isGitStack: boolean;
|
|
69
|
+
gitRepoUrl?: string;
|
|
70
|
+
gitReference?: string;
|
|
71
|
+
envCount: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PortainerDeploymentRecord {
|
|
75
|
+
status: number;
|
|
76
|
+
time?: number;
|
|
77
|
+
message?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PortainerStackDetail extends PortainerStackSummary {
|
|
81
|
+
env: PortainerEnvPair[];
|
|
82
|
+
hasSavedGitCredential: boolean;
|
|
83
|
+
gitCredentialId: number;
|
|
84
|
+
gitUsername?: string;
|
|
85
|
+
entryPoint?: string;
|
|
86
|
+
projectPath?: string;
|
|
87
|
+
createdAt?: number;
|
|
88
|
+
createdBy?: string;
|
|
89
|
+
updatedAt?: number;
|
|
90
|
+
updatedBy?: string;
|
|
91
|
+
gitConfigFilePath?: string;
|
|
92
|
+
gitCommitHash?: string;
|
|
93
|
+
deployments?: PortainerDeploymentRecord[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface PortainerContainerStats {
|
|
97
|
+
cpuPercent: number;
|
|
98
|
+
memUsageBytes: number;
|
|
99
|
+
memLimitBytes: number;
|
|
100
|
+
memPercent: number;
|
|
101
|
+
netRxBytes: number;
|
|
102
|
+
netTxBytes: number;
|
|
103
|
+
blockReadBytes: number;
|
|
104
|
+
blockWriteBytes: number;
|
|
105
|
+
pids: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface PortainerContainerSummary {
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
service?: string;
|
|
112
|
+
image: string;
|
|
113
|
+
state: string;
|
|
114
|
+
status: string;
|
|
115
|
+
healthy: boolean;
|
|
116
|
+
created?: number;
|
|
117
|
+
ports?: string[];
|
|
118
|
+
ipAddresses?: string[];
|
|
119
|
+
stats?: PortainerContainerStats | null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface PortainerStackOverviewSummary {
|
|
123
|
+
totalCount: number;
|
|
124
|
+
runningCount: number;
|
|
125
|
+
healthy: boolean;
|
|
126
|
+
totalCpuPercent: number;
|
|
127
|
+
totalMemUsageBytes: number;
|
|
128
|
+
memLimitBytes: number;
|
|
129
|
+
totalMemPercent: number;
|
|
130
|
+
totalNetRxBytes: number;
|
|
131
|
+
totalNetTxBytes: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface PortainerMaskedEnvItem {
|
|
135
|
+
name: string;
|
|
136
|
+
value: string;
|
|
137
|
+
hasExistingValue: boolean;
|
|
138
|
+
sensitive: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface PortainerStackOverview {
|
|
142
|
+
detail: Omit<PortainerStackDetail, 'env'> & { env: PortainerMaskedEnvItem[] };
|
|
143
|
+
stackFileContent: string;
|
|
144
|
+
containers: PortainerContainerSummary[];
|
|
145
|
+
summary: PortainerStackOverviewSummary;
|
|
146
|
+
sampledAt: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface PortainerInstanceSummary {
|
|
150
|
+
id: number;
|
|
151
|
+
name: string;
|
|
152
|
+
baseUrl: string;
|
|
153
|
+
apiKey?: string;
|
|
154
|
+
gitUsername?: string;
|
|
155
|
+
gitAccessToken?: string;
|
|
156
|
+
gitCredentialId?: number | null;
|
|
157
|
+
allowInsecureTls?: boolean;
|
|
158
|
+
defaultTimeoutMs?: number;
|
|
159
|
+
isDefault?: boolean;
|
|
160
|
+
enabled?: boolean;
|
|
161
|
+
lastHealthStatus?: string | null;
|
|
162
|
+
lastVersion?: string | null;
|
|
163
|
+
lastCheckedAt?: string | null;
|
|
164
|
+
}
|