我想将关系工件发布到不同的服务器中。为此,我使用了Active choices参数插件来制作界面。
if (Select_Environment.equals("QA"))
{
return["x","x"]
}
else if (Select_Environment.equals("Dev"))
{
return["192.168.94.137","x"]
}
else if (Select_Environment.equals("Prod"))
{
return["x","x"]
}
else if (Select_Environment.equals("Stress"))
{
return["x", "x"]
}
现在,我想编写一个Shell脚本,以将部署工件复制到选定的服务器中。有人可以帮我做到这一点吗?我使用了Maven元数据插件来列出工件。
以下命令用于在部署服务器中复制和提取工件。
#!/bin/bash
version="$Select_Release_Version_ARTIFACT_URL"
source=(/var/lib/jenkins/workspace/Test_Frontend_Parameterized_Deployment/*.tgz)
destination=(test@192.168.94.137:/usr/share/nginx/TESTFRONTEND/test.com/)
untar=$(ssh test@192.168.94.137 "cd /usr/share/nginx/TESTFRONTEND/test.com/ ; tar xzvf *.tgz")
#get the selected release artifact
selectRel(){
wget "$version"
}
#copy to deployment server selected artifacts
copytoDeploy(){
sudo scp $source $destination
}
extractArtifact(){
echo $untar
}
selectRel
copytoDeploy
extractArtifact