CI 빌드를 설정하는 방법에 대한 자세한 설명을 제공하는 Apple 개발자 웹 사이트에서 사용할 수있는 Continuous Integration Guide이 있습니다. 그러나 트리거 스크립트에 대한 세부 정보는 부족합니다.
최상의 설명서는 OSX Server 스크립트 자체에서 찾을 수 있습니다. Apple에서 사용하는 "트리거 스크립트"라는 용어는 Git에서 수신 후크를 참조합니다. Git 이벤트 훅을 Git 저장소의 .git/hooks 하위 디렉토리에 추가하여 Git 저장소의 이벤트에 대한 응답으로 작업을 수행 할 수 있습니다.
CI 빌드를 실행하기 위해 Xcode 서비스를 특별히 "실행"하는 후속 수신 후크를 보려면 Xcode 빌드 서비스를 호스팅하는 서버에서 호스트 된 Git 리포지토리를 만드십시오. 기본적으로 Xcode 서버에 추가 된 Git 리포지토리에는 자동으로 생성 된 수신 후 후크가 있습니다. 이 경우 POST
에서 http://localhost/xcs/kick-commit-bots
으로 repository
및 branch
양식 필드가 저장소의 URL (Xcode 서비스에서 구성됨)로 설정되고 Ruby 스크립트가 각 풀을 가져 오는 루비 스크립트입니다.
따라서 Xcode Continuous Integration Guide에 설명 된 단계에 따라 호스트 된 리포지토리를 만든 다음 Xcode 서버에서 /Library/Server/Xcode/Repositories/git/<your project>.git/hooks/post-receive
의 내용을 봅니다. Git 프로젝트를 다른 곳에 호스팅하면 (예 :BitBucket, GitHub 또는 로컬 네트워크의 Linux 상자)를 사용하면 선택한 스크립트 언어로 자신 만의 수신 후크를 만들 때이 파일을 가이드로 사용할 수 있습니다.
자신의 빌드 서버에 호스팅의 repo를 만드는 옵션이없는 사람들을 위해 예 :
#!/usr/bin/env ruby
##
# Copyright (c) 2014 Apple Inc. All Rights Reserved.
#
# IMPORTANT NOTE: This file is licensed only for use on Apple-branded
# computers and is subject to the terms and conditions of the Apple Software
# License Agreement accompanying the package this file is a part of.
# You may not port this file to another platform without Apple's written consent.
#
# IMPORTANT NOTE: This file is licensed only for use with the Wiki Server feature
# of the Apple Software and is subject to the terms and conditions of the Apple
# Software License Agreement accompanying the package this file is part of.
##
# fill in the exact URL to your repository, as entered in your OS X Server configuration
$repository_url = "file:///git/python-lrparser.git"
$repository_mode = "git"
# fill in the hostname of your OS X Server machine; this must be accessible by the server
# on which your repository is hosted; you may use "localhost" for the local machine
#server_host = "server.example.com"
$server_host = "localhost"
##########################################
## DO NOT EDIT BELOW THIS LINE
##########################################
require 'net/http'
def kick(branch)
theURL = URI("http://#{$server_host}/xcs/kick-commit-bots")
if branch.nil?
Net::HTTP.post_form(theURL, 'repository' => $repository_url)
else
Net::HTTP.post_form(theURL, 'repository' => $repository_url, 'branch' => branch)
end
end
if __FILE__ == $0
# determine what branch this is a push to, if possible
branches = []
if $repository_mode == "git"
$stdin.each_line do |line|
oldrev, newrev, ref = line.strip.split
if ref =~ %r{^refs/heads/(.+)$}
branches.push($~[1])
end
end
elsif $repository_mode == "svn" and ARGV.length >= 2
repository = ARGV[0]
revision = ARGV[1]
modifiedDirs = `svnlook dirs-changed -r #{revision} #{repository}`.lines.map { |line| line.chomp }
modifiedDirs.each do |d|
if d =~ %r{branches/([^/]+)}
branches.push($~[1])
end
end
end
# if we have no branch information, just kick generically
puts "Notifying OS X Server..."
if branches.empty?
kick(nil)
else
# otherwise, do a targeted kick for each relevant branch
branches.each do |branch|
kick(branch)
end
end
end
을