소스 플러그인 작성

소스 유형 플러그인은 plugin.xml 파일을 약간 수정한다는 점을 제외하고는 자동화 유형 플러그인이 정의되는 방식과 동일하게 정의됩니다.

자동화 플러그인과 마찬가지로 소스 플러그인은 다음 세 개의 파일로 정의됩니다. upgrade.xml, info.xmlplugin.xml. 처음 두 파일의 구조는 두 플러그인 유형 모두 동일합니다. plugin.xml 파일의 구조는 플러그인 유형에 따라 다릅니다. 소스 플러그인의 plugin.xml 파일 구조는 이 주제에서 설명합니다. 자동화 플러그인의 plugin.xml 파일에 대한 정보는 자동화 플러그인용 plugin.xml 파일의 내용을 참조하십시오.

<server:plugin-type>Source</server:plugin-type> 태그는 플러그인 유형을 식별합니다. 소스 플러그인의 경우 유형은 다음과 같이 Source여야 합니다.

<?xml version="1.0" encoding="UTF-8"?>
<!-- the xmlns:server argument is necessary to parse the tags with the server prefix -->
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1" 
    xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <identifier id="com.urbancode.air.plugin.source.Name" name="Plugin Name" version="1"/>
    <description>Short description</description>
    <tag>SCM/Name</tag>
    
    <server:plugin-type>Source</server:plugin-type>
  </header>

   

소스 플러그인에는 Import Version으로 이름을 지정해야 하는 하나의 단계가 있습니다.

     <step-type name="Import Version">
      <description>Creates a new component version and imports artifacts</description>
      <properties>
      </properties>
      <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
     
      <command program="${JAVA_HOME}/bin/java">
        <arg value="${JAVA_OPTS}"/>
        <arg value="-jar"/>
        <arg file="FileSystemSourceConfig.jar"/>
        <arg value="ImportVersion"/>
        <arg file="${PLUGIN_INPUT_PROPS}"/>
        <arg file="${PLUGIN_OUTPUT_PROPS}"/>
      </command>
      
    </step-type>
    
   

다음 코드 부분에 표시된 대로 소스 플러그인에는 두 개의 특성 그룹이 있습니다. Component 유형 특성은 새 컴포넌트 작성 창으로 구성합니다. Import 유형 특성은 컴포넌트 가져오기 창으로 구성합니다.

       
    <!-- ==================================== -->
    <!--   Properties                         -->
    <!-- ==================================== -->
   
    <server:property-group type="Component" name="FileSystemComponentProperties">
      <server:property name="property-name" required="true">
        <server:property-ui type="textBox"
                            label="property-label"
                            description="property-description" />
      </server:property>
    </server:property-group>
    
       <!-- If left empty or omitted then no dialog will appear -->
    <server:property-group type="Import" name="FileSystemImportProperties">
      <server:property name="property-name" required="true">
        <server:property-ui type="textBox"
                            label="property-label"
                            description="property-description" />
      </server:property>
    </server:property-group>
</plugin>

피드백