Domanda

I am using Jenkins as my build environment for a .NET/C++ Windows product. Jenkins Project A compiles the primary source code into artifacts. Project B builds the installer. The artifacts from project A have a different directory structure than what is required to build the installer in Project B.

I tried using the Copy Artifact Plugin to copy from Project A to B, but there's a known limitation where I can't specify a different directory structure for the copy.

I'm using a NAnt script in Project B to build the installer. I think the next best thing would be to copy the Project A artifacts to where I need them from the NAnt script. Is it possible to reference a project's artifacts from within a NAnt script so that they can be copied?

È stato utile?

Soluzione

If your Project B expects artifacts in a certain structure, then Project A should provide them in that structure. As you mentioned, Archive Artifacts post-build action does not let you specify alternative location for artifacts, but it does preserve their relative structure at the time of archiving.

So, in Project A, after the building step (or within it, depending on how you call it), organize the artifacts before Archive Artifacts is executed.

You can write a simple script, that will take your build artifacts, and copy them under a discrete/unique folder, let's call it release folder. Then tell Archive Artifacts post-build action to archive only the release folder, like path\to\release\*.*

It is upto your script to organize the artifacts in the release folder in a structure that would be suitable for Project B.

BTW, nothing says you cannot move this logic to Project B, and have it Copy Artifacts from Project A as is, and then run a script on Project B that will move them into a, let's say, for_installer folder and then supply that folder to the packaging process for Project B

As for "referencing" the artifacts: The Copy Artifacts plugin will copy artifacts of a particular build (by number or label). It defaults to location of archived artifacts (on the "from" part), and to WORKSPACE (on the "to" part). In the example above, if your Project A organized the artifacts into release folder, and your archived that as path\to\release\*, then on the Copy Artifacts step, set "Artifacts to Copy" as *, and leave "Target Directory" blank to be placed directly in Workspace, or specify a directory

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top