I have 2 types of materials:
A static git repo
Artifacts from an upstream pipeline
Down stream i have an AnalysisBuilders that requires both to function. When the task executes, i only seem to have access to the git repository and not the 'web' artifacts.
xml:
<pipeline name="FishAnalysis">
<materials>
<git url="https://fish:XXXXXXX@redacted.com/fish/analysis.git" />
</materials>
<stage name="CommitHandler" cleanWorkingDir="true">
<jobs>
<job name="builder">
<tasks>
<exec command="yarn" workingdir="web">
<arg>install</arg>
<runif status="passed" />
</exec>
<exec command="npm" workingdir="web">
<arg>run</arg>
<arg>build</arg>
</exec>
</tasks>
<artifacts>
<artifact src="web/dist" dest="web" />
<artifact src="web/package.json" dest="web" />
<artifact src="web/node_modules" dest="web" />
<artifact src="web/nginx.conf" dest="web" />
</artifacts>
</job>
</jobs>
</stage>
</pipeline>
.....
<pipeline name="AnalysisBuilders">
<materials>
<pipeline pipelineName="FishAnalysis" stageName="CommitHandler" materialName="FishAnalysis" />
<git url="https://fish:XXXXX@redacted.com/fish/docker.git" dest="docker" materialName="Docker">
</git>
</materials>
<stage name="Builders">
<jobs>
<job name="shellScripts">
<tasks>
<exec command="ls">
<arg>-R</arg>
<arg>.</arg>
<runif status="passed" />
</exec>
</tasks>
</job>
</jobs>
</stage>
</pipeline>
I would expect the ls -R output to have a 'web' & 'docker' folder. It does not. It only has the contents of the docker repo. How do i make both materials available?
Artifacts are not automatically propagated to downstream pipelines. You need to add a fetch artifact task, as shown here:
<tasks>
<fetchartifact pipeline="FishAnalysis" stage="CommitHandler" job="builder" srcdir="web" dest="web">
<runif status="passed" />
</fetchartifact>
<exec command="ls">
...
</exec>
</tasks>
This is because artifacts can be published in multiple upstream jobs and each upstream job can publish different artifacts. Notice that in your upstream material definition in AnalysisBuilders pipeline, you didn't specify a job.
GoCD will ensure that the version of the artifact is correct. That is, it corresponds to the upstream pipeline instance that caused this pipeline to run. Even if you re-run the pipeline sometime later.