2013-11-15 6 views
22

iOS 애플리케이션 용 CI 설치 작업 중 일부 문제가 있습니다.Bot (Xcode 5 CI)에 대한 맞춤 트리거 스크립트

  • 봇에서 문서를 찾을 수있는 좋은 곳은 어디입니까? 나는 Xcode를 보았습니다 도움이되었지만 좋은 예제를 찾지 못했습니다. 또한 CI 비디오를 보았습니다 2013 컨퍼런스
  • 어떻게 개발자가 코드를 커밋 할 때마다 사용자 정의 트리거 스크립트를 작성하여 자동으로 봇을 트리거합니다 .
  • 테스트가 성공적으로 로봇에 전달 된 경우에만 코드를 마스터에 병합 하시겠습니까? 내가 https://help.apple.com/xcode/mac/1.0/#apdE6540C63-ADB5-4B07-89B7-6223EC40B59C

    예 값이 각 설정으로 표시됩니다 트리거 스크립트에 대한 정보를 찾을 경우 여기

이다. 일정 : 을 수동으로, 주기적으로, 새 커밋에서 실행하거나 트리거 스크립트에서 실행하도록 선택합니다.

고맙습니다!

답변

0

봇의 구성표에서 테스트 결과를 구문 분석하는 게시 빌드 스크립트를 만듭니다.

테스트 결과는 여기에있는 것입니다 : 당신이 테스트가 PLIST 전달되었는지 확인 후에는 마스터로 병합 할 수 있습니다

/Library/Server/Xcode/Data/BotRuns/Latest/output/xcodebuild_result.bundle/Info.plist 

.

그런 다음 누군가가 마스터로 푸시 할 때만 통합되는 봇을 만듭니다. 나는 봇의 스케줄을 편집하는 것이 repo에 대한 폴링 옵션을 가지고 있다고 생각한다. 봇이 현재 마스터에있는 Xcode 프로젝트에 의해 생성되었는지 확인하십시오.

Xcode가 생성 할 테스트 분기에 첫 번째 봇을 만들어야합니다.

2

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으로 repositorybranch 양식 필드가 저장소의 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