0

HUDSON ci-serverは初めてです。Hudson リモート アクセス API を使用して hudson で新しいジョブを作成するか、既存のジョブの構成ファイルを編集して更新する必要があるという要件があります。

サンプルのconfig.xmlファイルがあります。

<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>Free style Basic sample Job for POC . will create this job with all the required fields . then will take this config.xml and will try to validate and study this schema .</description>
<project-properties class="java.util.concurrent.ConcurrentHashMap">
<entry>
  <string>hudson-plugins-disk_usage-DiskUsageProperty</string>
  <base-property>
    <originalValue class="hudson.plugins.disk_usage.DiskUsageProperty"/>
    <propertyOverridden>false</propertyOverridden>
  </base-property>
</entry>
<entry>
  <string>logRotator</string>
  <log-rotator-property>
    <originalValue class="hudson.tasks.LogRotator">
      <daysToKeep>5</daysToKeep>
      <numToKeep>-1</numToKeep>
      <artifactDaysToKeep>-1</artifactDaysToKeep>
      <artifactNumToKeep>-1</artifactNumToKeep>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
  </log-rotator-property>
</entry>
<entry>
  <string>scmCheckoutRetryCount</string>
  <integer-property>
    <originalValue class="int">5</originalValue>
    <propertyOverridden>false</propertyOverridden>
  </integer-property>
</entry>
<entry>
  <string>hudson-tasks-Mailer</string>
  <external-property>
    <originalValue class="hudson.tasks.Mailer">
      <recipients>abc@example.com</recipients>
      <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
      <sendToIndividuals>false</sendToIndividuals>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
    <modified>true</modified>
  </external-property>
</entry>
<entry>
  <string>hudson-plugins-build_timeout-BuildTimeoutWrapper</string>
  <external-property>
    <originalValue class="hudson.plugins.build_timeout.BuildTimeoutWrapper">
      <timeoutMinutes>5</timeoutMinutes>
      <failBuild>false</failBuild>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
    <modified>true</modified>
  </external-property>
</entry>
<entry>
  <string>builders</string>
  <describable-list-property>
    <originalValue class="hudson.util.DescribableList">
      <hudson.tasks.Ant>
        <targets></targets>
        <antName>org.apache.ant_1.7.1</antName>
      </hudson.tasks.Ant>
      <hudson.tasks.Shell>
        <command>HUDSON_USER</command>
      </hudson.tasks.Shell>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
  </describable-list-property>
</entry>
<entry>
  <string>hudson-triggers-SCMTrigger</string>
  <trigger-property>
    <originalValue class="hudson.triggers.SCMTrigger">
      <spec>@daily</spec>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
  </trigger-property>
</entry>
<entry>
  <string>jdk</string>
  <string-property>
    <originalValue class="string">(Inherit From Job)</originalValue>
    <propertyOverridden>false</propertyOverridden>
  </string-property>
</entry>
<entry>
  <string>hudson-tasks-ArtifactArchiver</string>
  <external-property>
    <originalValue class="hudson.tasks.ArtifactArchiver">
      <compressionType>GZIP</compressionType>
      <latestOnly>false</latestOnly>
      <autoValidateFileMask>false</autoValidateFileMask>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
    <modified>true</modified>
  </external-property>
</entry>
<entry>
  <string>scm</string>
  <scm-property>
    <originalValue class="hudson.scm.NullSCM"/>
    <propertyOverridden>false</propertyOverridden>
  </scm-property>
</entry>
<entry>
  <string>hudson-plugins-release-ReleaseWrapper</string>
  <external-property>
    <originalValue class="hudson.plugins.release.ReleaseWrapper">
      <releaseVersionTemplate></releaseVersionTemplate>
      <doNotKeepLog>false</doNotKeepLog>
      <overrideBuildParameters>false</overrideBuildParameters>
      <parameterDefinitions/>
      <preBuildSteps/>
      <postBuildSteps/>
      <postSuccessfulBuildSteps/>
      <postFailedBuildSteps/>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
    <modified>true</modified>
  </external-property>
</entry>
</project-properties>
 <keepDependencies>false</keepDependencies>
<creationTime>1403865219075</creationTime>
 <properties/>
     <cascadingChildrenNames class="java.util.concurrent.CopyOnWriteArraySet"/>
     <cascading-job-properties class="java.util.concurrent.CopyOnWriteArraySet">
    <string>hudson-plugins-batch_task-BatchTaskProperty</string>
  <string>hudson-plugins-disk_usage-DiskUsageProperty</string>
  <string>hudson-plugins-jira-JiraProjectProperty</string>
  <string>org-hudsonci-plugins-snapshotmonitor-WatchedDependenciesProperty</string>
  <string>hudson-plugins-promoted_builds-JobPropertyImpl</string>
   </cascading-job-properties>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <concurrentBuild>false</concurrentBuild>
  <cleanWorkspaceRequired>false</cleanWorkspaceRequired>
 </project>

これで、 project-properties というタグができました。その中には、複数のエントリタグがあります。各enrtyタグには、各エントリタグに共通の文字列であるサブ タグがいくつかあります。Hudosn リモート アクセス APIを使用して、Java を介してこれらすべての異なるタグにアクセスしたいと考えています。

例えば ​​:

<entry>
      <string>logRotator</string>
      <log-rotator-property>
      <originalValue class="hudson.tasks.LogRotator">
      <daysToKeep>5</daysToKeep>
      <numToKeep>-1</numToKeep>
      <artifactDaysToKeep>-1</artifactDaysToKeep>
      <artifactNumToKeep>-1</artifactNumToKeep>
    </originalValue>
    <propertyOverridden>false</propertyOverridden>
  </log-rotator-property>
</entry>

だから、 config.xmlにある残りのタグやその他のタグについて、daysToKeep numToKeep artifactDaysToKeepなどにアクセスしたい

どんな助けでも大歓迎です。前もって感謝します。

4

1 に答える 1