How to use cached files as workspace relative path

Hi All,

I have two jobs as below:
1.build_libs: build project in ${workspace_loc/libs/libxx/} and will output lib file ${workspace_loc/libs/libxx/bin/libxx.a}
2. build_apps: build project in ${workspace_loc:/apps/appmain/} with dependency library is libxx above (${workspace_loc/libs/libxx/bin/libxx.a})

If I define artifacts attribute in build_libs job, output lib will be keep in ${workspace_loc/libs/libxx/bin/libxx.a}

However, If I don’t define artifacts attribute but define only cached attribute in build_libs job, output lib will be clean after the job is done. Then, build_apps job will fail with error "can not resolve simple libbrary ${workspace_loc:/libs/libxx/bin/libxx.a}

My ci as below:

stages:

  • init
  • build
  • package

.common
tags:
- glr-my-pc
cache:
key: “$CI_COMMIT_REF_SLUG-$CI_JOB_NAME”

init:
extends: .common
stage: init
script:
- [do something]

build_libs:
extends: .common
stage: build
cache:
paths:
- "libs/*/bin/*.a"
script:
- [build command]

build_apps:
extends: .common
stage: build
dependecies:
- build_libs
script:
- [build command]

package:
extends: .common
stage: package
script:
- [upload build files]