Alex
Alex

Reputation: 44385

How to use a local gitlab-runner to test two jobs?

I have installed a local gitlab runner to test the .gitlab-ci.yml configuration. The pipeline I want to test consists of two jobs

job1 -> job2

job2 uses data that job1 generates. job1 runs for about 10 minutes.

How can I use this local gitlab runner to just test job2 with the output from job1, without running job1 each time and to wait for its output?

Can I somehow "save" the "state/image" of the gitlab-runner after I have run job1 once?

Upvotes: 0

Views: 432

Answers (1)

Daniel Campos Olivares
Daniel Campos Olivares

Reputation: 2594

What you are looking for is the combination of artifacts with dependencies.

For example, let's say that your job1 has an output under the target directory, then you could define it like:

job1:
  stage: build
  script: ...
  artifacts:
    paths:
      - target/

and use it in job2 as:

job2:
  stage: test
  script: ...
  dependencies:
    - job1

Also, in case that you'd like to refer to artifacts from a Job from a totally different project or even to download them manually, you can always download them using the REST API.

The following URI would download the latest artifacts generated from a successfull job execution:

https://gitlab.com/<namespace>/<project>/-/jobs/artifacts/master/download?job=job1

You can find more information about artifacts and dependencies on the official documentation:

Upvotes: 0

Related Questions