[ Agent ] [ Executor ] - 增加Pipeline部分的代码
This commit is contained in:
@@ -518,80 +518,66 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
|
||||
return false, l
|
||||
}
|
||||
|
||||
executor, resultLog := AllCompleteExecutor([][]string{
|
||||
{
|
||||
"rm",
|
||||
"-rf",
|
||||
"/etc/apt/keyrings/docker.gpg",
|
||||
},
|
||||
{
|
||||
"mkdir",
|
||||
"-p",
|
||||
"/etc/apt/keyrings",
|
||||
},
|
||||
})
|
||||
if !executor {
|
||||
return false, append(resultLog, "创建docker-key gpg文件失败!")
|
||||
}
|
||||
|
||||
dockerGPGFilePath := "/etc/apt/keyrings/docker.gpg"
|
||||
dockerGPGSource := "https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg"
|
||||
dockerAPTSource := "https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu"
|
||||
|
||||
// 安装镜像的证书
|
||||
if op.IsAgentInnerWall {
|
||||
// 国内 使用 UTSC 的源
|
||||
ok, l2 := AllCommandExecutor([]string{
|
||||
"curl",
|
||||
"-o",
|
||||
dockerGPGFilePath,
|
||||
"https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg",
|
||||
})
|
||||
if !ok {
|
||||
return false, l2
|
||||
}
|
||||
if !BasicFileExistAndNotNull(dockerGPGFilePath) {
|
||||
return false, []string{"添加gpg失败!"}
|
||||
}
|
||||
|
||||
resultOk, log2 := AllCompleteExecutor([][]string{
|
||||
{
|
||||
"gpg",
|
||||
"--dearmor",
|
||||
"-o",
|
||||
dockerGPGFilePath,
|
||||
},
|
||||
{
|
||||
"chmod",
|
||||
"a+r",
|
||||
dockerGPGFilePath,
|
||||
},
|
||||
{
|
||||
"add-apt-repository",
|
||||
"deb [arch=" + op.AgentArch + "] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu " + op.AgentOSReleaseCode + " stable",
|
||||
},
|
||||
})
|
||||
if !resultOk {
|
||||
return false, log2
|
||||
}
|
||||
} else {
|
||||
if !op.IsAgentInnerWall {
|
||||
// outside world
|
||||
// 国内 使用 UTSC 的源
|
||||
ok, l2 := AllCommandExecutor([]string{
|
||||
"curl",
|
||||
dockerGPGSource = "https://download.docker.com/linux/ubuntu/gpg"
|
||||
dockerAPTSource = "https://download.docker.com/linux/ubuntu"
|
||||
}
|
||||
|
||||
ok, l2 := AllCommandExecutor([]string{
|
||||
"curl",
|
||||
"-fsSL",
|
||||
dockerGPGSource,
|
||||
"-o",
|
||||
dockerGPGFilePath,
|
||||
})
|
||||
if !ok {
|
||||
return false, append(l2, "下载docker gpg文件失败", dockerGPGSource, dockerAPTSource)
|
||||
}
|
||||
if !BasicFileExistAndNotNull(dockerGPGFilePath) {
|
||||
return false, []string{"添加gpg失败!"}
|
||||
}
|
||||
|
||||
resultOk, log2 := AllCompleteExecutor([][]string{
|
||||
{
|
||||
"gpg",
|
||||
"--dearmor",
|
||||
"-o",
|
||||
dockerGPGFilePath,
|
||||
"https://download.docker.com/linux/ubuntu/gpg",
|
||||
})
|
||||
if !ok {
|
||||
return false, l2
|
||||
}
|
||||
if !BasicFileExistAndNotNull(dockerGPGFilePath) {
|
||||
return false, []string{"添加gpg失败!"}
|
||||
}
|
||||
|
||||
resultOk, log2 := AllCompleteExecutor([][]string{
|
||||
{
|
||||
"gpg",
|
||||
"--dearmor",
|
||||
"-o",
|
||||
dockerGPGFilePath,
|
||||
},
|
||||
{
|
||||
"chmod",
|
||||
"a+r",
|
||||
dockerGPGFilePath,
|
||||
},
|
||||
{
|
||||
"add-apt-repository",
|
||||
"deb [arch=" + op.AgentArch + "] https://download.docker.com/linux/ubuntu " + op.AgentOSReleaseCode + " stable",
|
||||
},
|
||||
})
|
||||
if !resultOk {
|
||||
return false, log2
|
||||
}
|
||||
},
|
||||
{
|
||||
"chmod",
|
||||
"a+r",
|
||||
dockerGPGFilePath,
|
||||
},
|
||||
{
|
||||
"add-apt-repository",
|
||||
"deb [arch=" + op.AgentArch + "] " + dockerAPTSource + " " + op.AgentOSReleaseCode + " stable",
|
||||
},
|
||||
})
|
||||
if !resultOk {
|
||||
return false, append(log2, "添加APT源失败!")
|
||||
}
|
||||
|
||||
// look for specific docker-version to install
|
||||
@@ -607,7 +593,7 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
|
||||
specificDockerVersion = "5:20.10.10~3-0~ubuntu-" + op.AgentOSReleaseCode
|
||||
}
|
||||
|
||||
resultOk, log2 := AllCommandExecutor([]string{
|
||||
resultOk, log2 = AllCommandExecutor([]string{
|
||||
"docker-ce=" + specificDockerVersion,
|
||||
"docker-ce-cli=" + specificDockerVersion,
|
||||
"containerd.io",
|
||||
@@ -1177,7 +1163,7 @@ func (op *AgentOsOperator) installZSHExec() (bool, []string) {
|
||||
|
||||
executor, log2 := AllCompleteExecutor([][]string{
|
||||
{
|
||||
"chomd",
|
||||
"chmod",
|
||||
"+x",
|
||||
"/root/wdd/zsh-install.sh",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user