mirror of https://github.com/portainer/portainer
fix(edge): fix formatting of scripts for release [EE-2987] (#6794)
* fix(edge) fix formatting for release [EE-2987] * fix(edge) EE-2987 fix edge agent command formatting Co-authored-by: Simon Meng <simon.meng@portainer.io>pull/6862/head
parent
8a6024ce9b
commit
b1b0a76465
|
@ -5,7 +5,7 @@ import { r2a } from '@/react-tools/react2angular';
|
||||||
import { useSettings } from '@/portainer/settings/settings.service';
|
import { useSettings } from '@/portainer/settings/settings.service';
|
||||||
|
|
||||||
import { EdgePropertiesForm } from './EdgePropertiesForm';
|
import { EdgePropertiesForm } from './EdgePropertiesForm';
|
||||||
import { Scripts } from './Scripts';
|
import { ScriptTabs } from './ScriptTabs';
|
||||||
import { EdgeProperties } from './types';
|
import { EdgeProperties } from './types';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -43,7 +43,7 @@ export function EdgeScriptForm({ edgeKey, edgeId }: Props) {
|
||||||
hideIdGetter={edgeId !== undefined}
|
hideIdGetter={edgeId !== undefined}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Scripts
|
<ScriptTabs
|
||||||
values={edgeProperties}
|
values={edgeProperties}
|
||||||
agentVersion={agentVersion}
|
agentVersion={agentVersion}
|
||||||
edgeKey={edgeKey}
|
edgeKey={edgeKey}
|
||||||
|
|
|
@ -49,7 +49,7 @@ interface Props {
|
||||||
onPlatformChange(platform: Platform): void;
|
onPlatformChange(platform: Platform): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Scripts({
|
export function ScriptTabs({
|
||||||
agentVersion,
|
agentVersion,
|
||||||
values,
|
values,
|
||||||
edgeKey,
|
edgeKey,
|
||||||
|
@ -134,7 +134,7 @@ function buildLinuxStandaloneCommand(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return `${edgeIdScript ? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n` : ''}
|
return `${edgeIdScript ? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n` : ''}\
|
||||||
docker run -d \\
|
docker run -d \\
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \\
|
-v /var/run/docker.sock:/var/run/docker.sock \\
|
||||||
-v /var/lib/docker/volumes:/var/lib/docker/volumes \\
|
-v /var/lib/docker/volumes:/var/lib/docker/volumes \\
|
||||||
|
@ -168,7 +168,7 @@ function buildWindowsStandaloneCommand(
|
||||||
|
|
||||||
return `${
|
return `${
|
||||||
edgeIdScript ? `$Env:PORTAINER_EDGE_ID = "@(${edgeIdScript})" \n\n` : ''
|
edgeIdScript ? `$Env:PORTAINER_EDGE_ID = "@(${edgeIdScript})" \n\n` : ''
|
||||||
}
|
}\
|
||||||
docker run -d \\
|
docker run -d \\
|
||||||
--mount type=npipe,src=\\\\.\\pipe\\docker_engine,dst=\\\\.\\pipe\\docker_engine \\
|
--mount type=npipe,src=\\\\.\\pipe\\docker_engine,dst=\\\\.\\pipe\\docker_engine \\
|
||||||
--mount type=bind,src=C:\\ProgramData\\docker\\volumes,dst=C:\\ProgramData\\docker\\volumes \\
|
--mount type=bind,src=C:\\ProgramData\\docker\\volumes,dst=C:\\ProgramData\\docker\\volumes \\
|
||||||
|
@ -199,7 +199,7 @@ function buildLinuxSwarmCommand(
|
||||||
'AGENT_CLUSTER_ADDR=tasks.portainer_edge_agent',
|
'AGENT_CLUSTER_ADDR=tasks.portainer_edge_agent',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return `${edgeIdScript ? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n` : ''}
|
return `${edgeIdScript ? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n` : ''}\
|
||||||
docker network create \\
|
docker network create \\
|
||||||
--driver overlay \\
|
--driver overlay \\
|
||||||
portainer_agent_network;
|
portainer_agent_network;
|
||||||
|
@ -270,13 +270,11 @@ function buildKubernetesCommand(
|
||||||
const idEnvVar = edgeIdScript
|
const idEnvVar = edgeIdScript
|
||||||
? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n`
|
? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n`
|
||||||
: '';
|
: '';
|
||||||
|
const envVarsTrimmed = envVars.trim();
|
||||||
const edgeIdVar = !edgeIdScript && edgeId ? edgeId : '$PORTAINER_EDGE_ID';
|
const edgeIdVar = !edgeIdScript && edgeId ? edgeId : '$PORTAINER_EDGE_ID';
|
||||||
const selfSigned = allowSelfSignedCerts ? '1' : '0';
|
const selfSigned = allowSelfSignedCerts ? '1' : '0';
|
||||||
|
|
||||||
return `${idEnvVar}curl https://downloads.portainer.io/ce${agentShortVersion}/portainer-edge-agent-setup.sh |
|
return `${idEnvVar}curl https://downloads.portainer.io/ce${agentShortVersion}/portainer-edge-agent-setup.sh | bash -s -- "${edgeIdVar}" "${edgeKey}" "${selfSigned}" "${agentSecret}" "${envVarsTrimmed}"`;
|
||||||
bash -s -- "${edgeIdVar}" \\
|
|
||||||
"${edgeKey}" \\
|
|
||||||
"${selfSigned}" "${agentSecret}" "${envVars}"`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildDefaultEnvVars(
|
function buildDefaultEnvVars(
|
|
@ -21,13 +21,12 @@ export function useCopy(copyText: string, fadeDelay = 1000) {
|
||||||
navigator.clipboard.writeText(copyText);
|
navigator.clipboard.writeText(copyText);
|
||||||
} else {
|
} else {
|
||||||
// https://stackoverflow.com/a/57192718
|
// https://stackoverflow.com/a/57192718
|
||||||
const inputEl = document.createElement('input');
|
const inputEl = document.createElement('textarea');
|
||||||
inputEl.value = copyText;
|
inputEl.value = copyText;
|
||||||
inputEl.type = 'text';
|
|
||||||
document.body.appendChild(inputEl);
|
document.body.appendChild(inputEl);
|
||||||
inputEl.select();
|
inputEl.select();
|
||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
inputEl.type = 'hidden';
|
inputEl.hidden = true;
|
||||||
document.body.removeChild(inputEl);
|
document.body.removeChild(inputEl);
|
||||||
}
|
}
|
||||||
setCopiedSuccessfully(true);
|
setCopiedSuccessfully(true);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
.code {
|
.code {
|
||||||
display: block;
|
display: block;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
padding: 16px 90px;
|
word-break: break-word;
|
||||||
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root {
|
.root {
|
||||||
|
|
Loading…
Reference in New Issue