Child-Pipelines latest artifact

Hi,

I have a repo which has a nightly build configured. So I create new artifacts at least once a day which are a few 100MB per run. I now noticed that my disk space started running low.

While checking the Jobs I noticed that quite many of them have the text “These artifacts are the latest. They will not be deleted (even if expired) until newer artifacts are available.” attached to it.
The nightly build ran for some weeks on the same commit, so I suspected that this might be the issue considering all builds “latest”. But now I added a new commit and the old artifacts are still not removed.

I’m using child-pipelines for the build. Might this cause an issue with deciding which artifacts are “latest”? What is the logic to decide which child-pipeline was “latest” considering each job could run multiple times in a pipeline using different Variables?

Boiled down example:

.gitlab-ci.yaml:

build_product_a:
  stage: build
  needs: []
  variables:
    BUILD_TARGET: "product_a"
  trigger:
    include: ci/buildroot_build.yml
    strategy: depend

ci/buildroot_build.yml:

build_release:
  stage: build
  variables:
    BUILD_VARIANT: release
  script:
    - ./scripts/build.sh    
  artifacts:
    name: "${CI_PROJECT_NAME}-${BUILD_VARIANT}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}"
    paths:
      - rootfs.ext2.bz2
    expire_in: 10 days

I know I can disable the “keep latest artifact” feature for the repo. But I find this very handy.