2016-10-05 13 views
1

저는 CI와 관련하여 새로운 기능을 제공합니다.VSTS 또는 Bitrise를 사용하는 빌드에 대한 리시버 커밋 메시지 가져 오기 Ant를 사용하여 VSTS 또는 Bitrise를 사용하는 빌드에 대한 베타 릴리스 정보

다른 Android 응용 프로그램 용으로 두 개의 빌드 서버를 구성하고 하나는 Bitrise와 다른 VSTS (Visual Studio Team Services)를 사용하고 있으며, APK를 자동으로 배포 할 수있는 Crashlytics/Beta 키트가있는 Fabric 계정을 구성했습니다. 각 빌드에서. 리포지토리에있는 커밋의 메시지를 사용하여 테스트 목적으로 Fabric에 업로드 된 각 빌드의 릴리스 노트를 업데이트하려면 빌드 단계 또는 일부 구성 (예 : Ant 또는 기타)을 추가해야합니다.

미리 감사드립니다. enter image description here

Ant 스크립트 : enter image description here

그리고 모두의 build.xml의 스크린 샷 (개미)와 script_release_notes 여기


파워 쉘 스크립트 내 VSTS 구성의 스크린 샷입니다 .txt (Powershell), 루트 폴더에 있습니다 : enter image description here

+0

마이크. 빌드 흐름 중에 커밋을 .txt 파일에 저장할 수 있다면 Ant Beta 릴리스 명령을 통해 커밋을 업로드 할 수 있습니다. -DbetaDistributionReleaseNotesFilePath = release_notes.txt –

+0

Thanks Mike. 사실 그건 내가 수동으로하는 한 부분입니다. 내가 필요한 것은 커밋에서 데이터를 자동으로 가져와 어떻게 든 파일을 만들고 업로드 할 수 있도록하는 것입니다. –

+0

아, 알았어요! 미안하지만 나는 사물의 측면에 익숙하지 않다. –

답변

2

Bitrise의 경우 다른 변수와 마찬가지로 원하는대로 사용할 수있는 환경 변수로 커밋 정보를 제공하는 Git Clone 단계를 사용하는 경우. https://github.com/bitrise-io/steps-git-clone/blob/master/step.yml#L80

편집 :

여기 망할 놈의 복제 단계 (환경 변수) 수출 "출력"의 전체 목록을 찾을 수 있습니다 당신은 할 수 있습니다 단순히 echo "$the_env_var" >> release_notes.txt, 예를 들면 release_notes.txt 파일에 다음을 저장하려면 Script 단계.

릴리즈 노트에 전체 커밋 메시지를 저장하려면 : VSTS 구축

#!/bin/bash 
# fail if any commands fails 
set -e 
# debug log 
set -x 

echo "$GIT_CLONE_COMMIT_MESSAGE_SUBJECT" > release_notes.txt 
echo "$GIT_CLONE_COMMIT_MESSAGE_BODY" >> release_notes.txt 
+0

안녕하세요 빅토르 덕분에 실제로 답변이 부분적으로 작동했습니다. 이제 릴리스 노트의 일부로 마지막 커밋에 대한 정보 만 있습니다. 이전 커밋에서 정보를 얻으려면 어떻게해야합니까? 이상적으로는 마지막 빌드 이후 모든 커밋을 제공합니까? –

+0

@AlejandroCasanovaMutis 지금 당장은 env var이 없습니다. 관련 기능 요청은 여기 왜 사소한 일인지에 대한 설명과 함께 확인할 수 있습니다. https://bitrise.uservoice.com/forums/235233-general/suggestions/6901955 -expose-previous-build-information-eg-git-commit –

0

를 들어,이 VSTS Rest API를 통해 현재 빌드의 커밋 메시지를받을 수있는 PowerShell 스크립트 작업을 추가 할 수 있습니다.

다음은 이것을 얻는 샘플 powershell 스크립트입니다.이 스크립트를 사용하려면 빌드 정의에서 "스크립트에서 OAuth 토큰에 액세스 허용"옵션을 사용해야합니다.

$collectionuri = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI 
$buildid = $env:BUILD_BUILDID 
$project = $env:SYSTEM_TEAMPROJECT 
$token = $env:SYSTEM_ACCESSTOKEN 

$basicAuth= ("{0}:{1}"-f "anys",$token) 
$basicAuth=[System.Text.Encoding]::UTF8.GetBytes($basicAuth) 
$basicAuth=[System.Convert]::ToBase64String($basicAuth) 
$headers= @{Authorization=("Basic {0}"-f $basicAuth)} 

$url= $collectionuri + $project + "/_apis/build/builds/" + $buildID + "/changes?api-version=2.0" 

$getbuildchanges = Invoke-RestMethod -Uri $url -headers $headers -Method Get | select value 

foreach ($commit in $getbuildchanges.value) 
{ 
    Write-Host $commit.id; 
    $commit.id | Out-File -filepath commitmessages.txt -Append; 
    Write-Host $commit.message; 
    $commit.message | Out-File -filepath commitmessages.txt -Append; 
} 

업데이트 : 다음 스크립트를 시도하십시오 : 여기 직물에서

$collectionuri = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI 
$buildid = $env:BUILD_BUILDID 
$project = $env:SYSTEM_TEAMPROJECT 
$token = $env:SYSTEM_ACCESSTOKEN 

$basicAuth= ("{0}:{1}"-f "anys",$token) 
$basicAuth=[System.Text.Encoding]::UTF8.GetBytes($basicAuth) 
$basicAuth=[System.Convert]::ToBase64String($basicAuth) 
$headers= @{Authorization=("Basic {0}"-f $basicAuth)} 

$url= $collectionuri + $project + "/_apis/build/builds/" + $buildID + "/changes?api-version=2.0" 

$getbuildchanges = Invoke-RestMethod -Uri $url -headers $headers -Method Get; 

if($getbuildchanges.count -ne 0) 
{ 
foreach ($commit in $getbuildchanges.value) 
{ 
    Write-Host $commit.id; 
    $commit.id | Out-File -filepath release_notes.txt -Append; 
    Write-Host $commit.message; 
    $commit.message | Out-File -filepath release_notes.txt -Append; 
} 
} 
else 
{ 
    $nocommitfound = "There is no commit related to current build."; 
    Write-Host $nocommitfound; 
    $nocommitfound | Out-File -filepath release_notes.txt -Append; 
} 
+0

감사합니다. @Eddie - MSFT. (지정한 파일을 찾을 수 없습니다) 이는 PowerShell 스크립트의 출력입니다 release_notes.txt : 2016-10-12T15 : 59 : 이제 빌드이 오류 FileNotFoundException이와 함께 실패 48.0606069Z ## [섹션] 시작 : 릴리스 노트에 커밋 요약을 생성하십시오. ## [command]. 'C : \ a \ 1 \ s \ script_release_notes.txt' ## [section] Finishing : 릴리스 정보 커밋 요약 생성 파일에 사용하는 매개 변수는 -DfilePath = release_notes.txt입니다. 이 파일 이름으로 스크립트를 업데이트했습니다. 아이디어가 있으십니까? –

+0

@AlejandroCasanovaMutis 업데이트 된 스크립트를 공유 할 수 있습니까? "release_notes.txt"로 바뀐 파일 이름으로 내 편에서 문제를 재현 할 수 없습니다. –

+0

스크립트는 정확히 동일한 두 줄로 변경되었습니다. .... $ commit.id | 외부 파일 -filepath release_notes.txt -Append; ... $ commit.message | 외부 파일 -filepath release_notes.txt -Append; 출력 파일 이름/경로를 출력하는 방법이 있습니까? –