Claudio Merli
Claudio Merli

Reputation: 101

Gitlab CI/CD stages doesn't use same workspace

I'm new to Gitlab pipelines. Coming from Jenkins, where all stages share the same folder workspace, here I noticed that at every news stage the workspace was resetted.

I simply want to do a build and a publish in two different stages, but the second stage doesn't find artifact built.

Is there a way to share the entire workspace across all pipeline?

Upvotes: 1

Views: 1415

Answers (1)

DaveS
DaveS

Reputation: 3294

Jobs can use artifacts from previous stages, if any of the jobs in the previous stage declare artifacts. Later stages automatically import artifacts from previous stages. What you need to do is declare the files/folders you want to include in later stages.

The documentation for artifacts is here. Basically, you'll want to set your build folder as an artifact in your build job. Then, your publish job will have access to that folder (assuming it's in a later stage).

Upvotes: 1

Related Questions