Sharing build artifacts between jobs in Hudson

前端 未结 8 1132
陌清茗
陌清茗 2020-12-13 13:48

I\'m trying to set up our build process in hudson.

Job 1 will be a super fast (hopefully) continuous integration build job that will be built frequently.

Job

相关标签:
8条回答
  • 2020-12-13 14:17

    Have you looked at the Hudson wiki? Specifically: Splitting a big job into smaller jobs

    0 讨论(0)
  • 2020-12-13 14:18

    I had the same issue, and what I ended up going with is separate projects for the long-running tasks. The first step in these projects was to copy all the files from the workspace of Job 1 (i.e. last build) to the Job 2/3/etc workspaces. This usually worked unless Job 1 was building at the time Job 2/3 started, since it would get an incomplete workspace. You could work around this by detecting "end of build" in Job 1 with a sentinel file, or use the Hudson locks plugin (I haven't tried).

    You don't have to use a custom workspace if you make assumptions about the placement of the other jobs relative to %WORKSPACE%.

    0 讨论(0)
  • 2020-12-13 14:24

    I'm doing something like that now. I'd recommend avoiding any attempt to run many jobs in the same shared workspace. I've only had problems with that.

    I'm using maven and the free-form projects type. One set of jobs runs when the files in the version control system trigger it. They create local snapshot artifacts. A second set of jobs run nightly and set up a integration test environment then run tests on it.

    If you aren't using maven; one option it to set up an area on disk and have the final steps in job one copy the artifacts to that spot. The first steps of job two should be to move those files over. The run whatever you need to run.

    As for job three, there are findbugs/checkstyle/pmd et all plugins for Hudson now. I'd recommend just creating a version of job 1 that does a clean nightly checkout and runs those on you code base.

    0 讨论(0)
  • 2020-12-13 14:31

    You might want to try the Copy Artifact plugin:

    http://wiki.hudson-ci.org/display/HUDSON/Copy+Artifact+Plugin

    Your continuous job can build the necessary artifacts, and your other two jobs can pull them in to do analysis.

    0 讨论(0)
  • 2020-12-13 14:31

    Hudson doesn't appear to have a built in repository for build artifacts. Our solution was to create one.

    We are in a Windosw environment so I created a share that could be accessed by all Hudson servers (we give the relevant services a common account as the system account cannot access resources across a network).

    Within our build scripts (ant), we have tasks that copy resources build from other jobs to the local workspace and jobs that generate artifacts copy them into the common repository.

    In other environments, you could publish and fetch via FTP or any other mechanism for moving files.

    Simplistic examples of publish and get tasks:

    <!-- ==================== Publish ==================================== -->
    <target name="Publish" description="Publish files">
      <mkdir dir="${publish.dir}/lib" />
      <copy todir="${publish.dir}/lib" file="${project.jar}"/>
    </target>
    

    and

    <!-- ==================== Get ==================================== -->
    <target name="getdependencies" description="Get necessary results from published directory">
      <copy todir="${support.dir}">
        <fileset dir="${publish.dir}/lib">
          <include name="*.jar"/>
        </fileset>
      </copy>
    </target>
    
    0 讨论(0)
  • 2020-12-13 14:34

    Hudson has a plugin for just this problem: http://wiki.hudson-ci.org/display/HUDSON/Clone+Workspace+SCM+Plugin (link currently broken)

    The corresponding Jenkins page is here: https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin

    0 讨论(0)
提交回复
热议问题