我应该使用什么来控制 CI 构建失败指示灯?

发布于 2024-10-10 21:01:30 字数 73 浏览 2 评论 0原文

我想在我们的办公室安装一盏大灯,每当我们的 Hudson 持续集成服务器报告构建失败时,它就会亮起。我应该使用什么技术来实现这一点?

I'd like to set up a big light in our office that switches on whenever our Hudson Continuous Integration server reports a build failure. What technology should I use to make this happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

您的好友蓝忘机已上羡 2024-10-17 21:01:30

Github 使用红绿灯和他们自己开发的 CI Joe 构建工具(而不是 Hudson,但我认为这个过程非常相似)做了类似的事情。

https://github.com/blog/653-our-new-build -status-indicator

他们使用 Black Widow Arduino 并开源代码以使其正常工作: https://github.com/atduskgreg/GitHub-Stoplight

Github did something similar with a stop light and their home grown CI Joe build tool (instead of Hudson, but I'd imagine the process is fairly similar).

https://github.com/blog/653-our-new-build-status-indicator

They used an Black Widow Arduino and open-sourced the code to make it work: https://github.com/atduskgreg/GitHub-Stoplight

べ繥欢鉨o。 2024-10-17 21:01:30

步骤 1) 将旧 Thinkpad 拆开,直到看到键盘指示灯。

步骤 2) 找到一个合适的继电器,您可以将其连接到灯的位置(以运行更大的灯)。

步骤3)修改以下脚本以满足您的需求(或者让它从任何检查构建的内容中按原样运行):(

#!/usr/bin/ruby
light_filename = '/proc/acpi/ibm/light'
num_cycles = 1

# see if we have an argument telling how many times to flash
ARGV.each do |a| 
    if a =~ /-c=(\d+)/ 
        num_cycles = $1.to_i 
    else 
        puts 'Unknown argument: ' + a
        exit
    end 
end

# method that reverses the state
def reverse(state)
        return 'on' if state.include? 'off'
        return 'off'
end

# find starting state
state = 'off'
File.open(light_filename, 'r') do |inf| 
    state='on' if inf.gets.include? 'on'
end

# double the cycle num to get how many times we should flip
flips = num_cycles * 2
# do the cycles
flips.times do |i|
    # reverse state
    File.open(light_filename, 'w') do |out| 
        state = reverse(state)
        out.write(state) 
    end
    # wait 1/4 sec before looping again
    sleep 0.250
end

我可能从某个地方偷了该代码,但那是很久以前的事了,我不记得了)

Step 1) Rip your old Thinkpad apart until you get access to the keyboard light.

Step 2) Find an appropriate relay that you can wire in-place of the light (to run your bigger light).

Step 3) Modify the following script to meet your needs (or have it run as-is from whatever checks the builds):

#!/usr/bin/ruby
light_filename = '/proc/acpi/ibm/light'
num_cycles = 1

# see if we have an argument telling how many times to flash
ARGV.each do |a| 
    if a =~ /-c=(\d+)/ 
        num_cycles = $1.to_i 
    else 
        puts 'Unknown argument: ' + a
        exit
    end 
end

# method that reverses the state
def reverse(state)
        return 'on' if state.include? 'off'
        return 'off'
end

# find starting state
state = 'off'
File.open(light_filename, 'r') do |inf| 
    state='on' if inf.gets.include? 'on'
end

# double the cycle num to get how many times we should flip
flips = num_cycles * 2
# do the cycles
flips.times do |i|
    # reverse state
    File.open(light_filename, 'w') do |out| 
        state = reverse(state)
        out.write(state) 
    end
    # wait 1/4 sec before looping again
    sleep 0.250
end

(I probably stole that code from somewhere, but it was so long ago now that I can't recall)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文