에서 여러 작업 항목을 커밋에 연결 DevOps
커밋에 대한 여러 작업 항목은 for Azure DevOps, , , GitHub및 GitLab에서 지원됩니다 DevOpsBitbucket.
시스템 정의 > 스크립트 포함 모듈의 DevopsCommitMessageParserSNC 스크립트 포함을 사용하여 조직의 프로세스를 반영하도록 커밋 메시지의 작업 항목 구문을 사용자 지정할 수 있습니다.
커밋을 작업 항목과 연결하기 위해 작업 항목 네이티브 ID가 커밋 메시지에서 추출됩니다. 기본 시스템에서 DevOps는 다음과 같은 커밋 메시지 형식을 지원합니다.
/**
* Supported patterns
* Colon pattern
* Sample supported formats:
* 1. STRY1,STRY2: Additional bug fixes
* 2. STRY1 , STRY2 : Additional bug fixes
* 3. STRY1, STRY2 : Additional bug fixes
* Hash pattern
* Sample supported formats:
* 1. Fixes for #STRY1, #STRY2, #STRY3
* 2. Fixes @$#3 and #1 work item
* 3. Fixes for #STRY1 #STRY2 #STRY3
* 4. Fixes for AB#123
* Jira pattern
* Sample supported formats:
* 1. JRA-123 fixed
* 2. JRA-123 JRA-234 JRA-345 resolved
*/조직의 프로세스를 충족하기 위해 추가 메시지 형식에 대한 지원을 추가하려면 시스템 정의 > 스크립트 포함 모듈로 이동하여 DevopsCommitMessageParser 스크립트 포함에 사용자 지정 논리를 추가할 수 있습니다. DevopsCommitMessageParser 스크립트 포함은 DevopsCommitMessageParserSNC에서 확장됩니다. DevopsCommitMessageParserSNC에는 기본 시스템에서 지원되는 메시지 형식에 대한 작업 항목 네이티브 ID를 식별하기 위해 정의된 세 가지 정규식이 있습니다. 대괄호 안에 작업 항목 네이티브 ID가 있는 새 사용자 지정 메시지 형식을 포함하려면 다음 예제를 참조하세요.
var DevopsCommitMessageParser = Class.create();
DevopsCommitMessageParser.prototype = Object.extendsObject(DevopsCommitMessageParserSNC, {
initialize: function() {
DevopsCommitMessageParserSNC.prototype.initialize.call(this);
this._customPattern = /\[(.*?)\]/g; // The regex pattern to match the words written inside square brackets.
// Example commits message to match this custom pattern is : "[STRY1], [STRY2] Additional bug fixes"
},
getWorkitemsFromCommitMessage: function(message, branchName) {
var workitems = [];
// We first call the getWorkitemsFromCommitMessage method from the parent class to get the matching workitems ids for OOB formats
var defaultWI = DevopsCommitMessageParserSNC.prototype.getWorkitemsFromCommitMessage.call(this, message, branchName);
if (!gs.nil(defaultWI) && defaultWI.length > 0) {
workitems = workitems.concat(defaultWI);
}
// Now call your custom method that returns an array of workitem native IDs matching custom pattern
var customWI = this.getWIFromCustomPattern(message);
if (!gs.nil(customWI) && customWI.length > 0) {
workitems = workitems.concat(customWI);
}
// getUniqueWorkItems method from parent class removes duplicates from the workitems array
workitems = this.getUniqueWorkItems(workitems);
// return the final list
return workitems;
},
getWIFromCustomPattern: function(message) {
var wi = [];
var l;
var match;
var matches = message.match(this._customPattern);
if (gs.nil(matches))
return wi;
for (var i = 0; i < matches.length; i++) {
l = matches[i].length;
match = matches[i].substring(1, l - 1); // trim the brackets
wi.push(match);
}
return wi;
},
type: 'DevopsCommitMessageParser'
});Azure DevOps 사용자 인터페이스를 사용하여 작업 항목을 커밋에 연결하는 것도 DevOps에서 지원됩니다.
DevOps 커밋 기록 및 파이프라인 UI에서 연결된 작업 항목 목록을 볼 수 있습니다.