Can pages deploy jobs receive artifacts from previous stages

I have a GitLab CI config that looks something like this:

build:
    stage: build
    script:
        - build site ...
    artifacts:
        paths:
            - _site
    except:
        - master

test:
    stage: test
    dependencies:
        - build
    script:
        - test site ...
    artifacts:
        paths:
            - _site
    except:
        - master

pages:
    stage: deploy
    dependencies:
        - build
        - test
    only:
        - master
    script:
        - mkdir public
        - cp _site/* public/
    artifacts:
        paths:
            - public

stages:
    - build
    - test
    - deploy

The artifacts from the build stage are available in test, but deploy always fails because it can’t find any files in _site.

Is this expected behaviour?

Thanks,

Sarah

I don’t know why Discourse sent me a digest that included this year-old question, but since it was never answered, this seems like the problem to me:

build:
    except:
        - master

test:
    except:
        - master

pages:
    only:
        - master

I’m not sure whether the issue here was my YAML config or a bug, but this problem doesn’t seem to crop up anymore.

1 Like