我有一个Jenkins工作来停止节点应用程序,部署代码并启动应用程序.
使用Upstart脚本完成启动/停止.
我用 initctl stop node-App
如果作业正在运行,这很有效.但是如果应用程序已经死亡或处于停止状态,则输出为initctl: Unknown instance:
这会导致Jenkins作业失败,而不会继续执行后续步骤.
有没有办法在发出启动命令之前检查作业是否已启动?或者詹金斯有没有办法不考虑错误并且失败了?
我有以下代码下载文件,然后将文件的内容读入变量.使用该变量,它执行一个命令.此配方不会收敛,因为在编译阶段/ root/foo不存在.
我可以解决多个收敛和if File.exist的问题,但我想用一个收敛来做.关于如何做的任何想法?
execute 'download_joiner' do
command "aws s3 cp s3://bucket/foo /root/foo"
not_if { ::File.exist?('/root/foo') }
end
password = ::File.read('/root/foo').chomp
execute 'join_domain' do
command "net ads join -U joiner%#{password}"
end
Run Code Online (Sandbox Code Playgroud) 带有 IIS 8.5 的 Windows Server 2012 R2 允许使用增强日志记录自定义日志字段
http://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85
我想用 Powershell 添加字段
以下工作:
Set-ItemProperty IIS:\Sites\siteName -name logfile.customFields.collection -value
@{logFieldName='foo';sourceType='RequestHeader';sourceName='c-ip'}
Run Code Online (Sandbox Code Playgroud)
但我无法向 logfile.customFields.collection 添加第二个条目 它请求 -Force 并覆盖现有条目
我通过 GUI 添加了 2 来说明问题
Get-ItemProperty IIS:\Sites\siteName -name logfile.customFields.collection
logFieldName : foo
sourceName : c-ip
sourceType : RequestHeader
Attributes : {logFieldName, sourceName, sourceType}
ChildElements : {}
ElementTagName : add
Methods :
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
logFieldName : foo2
sourceName : c-servername
sourceType : RequestHeader
Attributes : {logFieldName, sourceName, sourceType}
ChildElements : {}
ElementTagName : add …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过 Groovy 配置 Jenkins EC2-Plugin。插件代码:https : //github.com/jenkinsci/ec2-plugin
我正在尝试使用名称设置云以开始使用
import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.*
SlaveTemplate awsTemplate = new SlaveTemplate(
'ami-1234567',
'',
'',
'sg-1234567',
't2.micro',
true,
'foo',
'',
'stuff',
'run code',
'/var/tmp',
'more code',
'4',
'',
'',
'',
false,
'subnet-1234567',
'',
'60',
false,
'',
'iam-profile',
false,
false,
'',
false,
'',
true,
false
)
def slaveTemplates = [awsTemplate]
def ec2Cloud = new AmazonEC2Cloud(
'foo',
true,
'',
'us-west-2',
'',
'10',
slaveTemplates
)
def cloudList = Jenkins.instance.clouds
cloudList.add(ec2Cloud)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
这些是错误信息
Error: …Run Code Online (Sandbox Code Playgroud) 我在多个用户可用的公共服务器上有一个 ant 脚本。我想安全地将密码输入脚本并将其用于多个目标。以下代码通过输入获取密码,但未将变量传递给 sshexec 任务。
这会起作用还是有更好的方法来做到这一点?
<target name="get_password">
<input message="Enter Your Password:>" addproperty="password">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
</target>
<target name="create_tmp_dir">
<sshexec host="${host}"
username="${username}"
password="${password}"
command="mkdir ${tmp_dir}" />
</target>
Run Code Online (Sandbox Code Playgroud) jenkins ×2
amazon-ec2 ×1
ant ×1
bash ×1
chef-infra ×1
chef-recipe ×1
groovy ×1
iis ×1
input ×1
linux ×1
powershell ×1
ruby ×1
ssh ×1
upstart ×1