Artifacts from previously successfully ran dependancies are not used when using only changes

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Summary

When using only changes in gitlab ci, some jobs can be skipped. However, if a job depends on one of the skipped jobs, there is no artifact available for this dependency, causing the job to fail

Steps to reproduce

Here is an example .gitlab-ci.yml file

stages:
    - build 
    - test
    
A:
    stage: build
    script:
        - 'echo test > subfolderA\testfile.txt'
    only:
        refs:
            - merge_requests
            - master
        changes:
            - subfolderA/**/*
            - .gitlab-ci.yml
    artifacts:
        name: "TEST_%CI_PIPELINE_ID%"
        when: on_success
        paths:
            - 'subfolderA/testfile.txt'
            
B:
    stage: test
    script:
        - 'type subfolderA\testfile.txt'
    dependencies:
        - A
    only:
        refs:
            - merge_requests
            - master

Change a file in subfolderA, this will trigger the full pipeline successfully When the pipeline end, change a file NOT in subfolderA this will trigger only the job B. The job B will fail because it won't receive an artifact from A

What is the current bug behavior?

The job B will fail because it won't receive an artifact from A

What is the expected correct behavior?

The job B should receive the artifact from the last successful run of the job A

gitlab-runner 11.9.1 (de08a4bb) on windows VM GitLab Community Edition 11.9.4

Edited Aug 29, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading