小编jsm*_*key的帖子

如果跑步,则新贵停止

我有一个Jenkins工作来停止节点应用程序,部署代码并启动应用程序.

使用Upstart脚本完成启动/停止.

我用 initctl stop node-App

如果作业正在运行,这很有效.但是如果应用程序已经死亡或处于停止状态,则输出为initctl: Unknown instance:

这会导致Jenkins作业失败,而不会继续执行后续步骤.

有没有办法在发出启动命令之前检查作业是否已启动?或者詹金斯有没有办法不考虑错误并且失败了?

linux bash upstart jenkins

8
推荐指数
1
解决办法
2015
查看次数

Chef:从文件中读取变量并在一个汇聚中使用它

我有以下代码下载文件,然后将文件的内容读入变量.使用该变量,它执行一个命令.此配方不会收敛,因为在编译阶段/ 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)

ruby chef-infra chef-recipe

5
推荐指数
2
解决办法
6963
查看次数

使用 Powershell 添加 IIS 8.5 自定义日志记录字段

带有 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)

iis powershell

4
推荐指数
1
解决办法
2860
查看次数

使用 Groovy 配置 Jenkins EC2-Plugin

我正在尝试通过 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)

groovy amazon-ec2 jenkins

4
推荐指数
1
解决办法
3352
查看次数

ant - 输入 sshexec 的密码

我在多个用户可用的公共服务器上有一个 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)

ant ssh input

3
推荐指数
1
解决办法
4996
查看次数

标签 统计

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