June Chung
1 min readNov 25, 2020

Cache vs Artifacts

  • Cache are globally defined
    if you cache .m2/respository → all the later stages/jobs will have that repo by default
  • Artifacts are defined within a “stage”
    if you make .m2/repository artifact → all the jobs in the SAME STAGE will start with that repo
    — but if different stage, will not pass through
  • stage vs job
    stage is what you define in beginning (test, deploy, build)
    and jobs make up the stage (job is the granular definition for gitlab)
    **** Jobs are run concurrently in the same stage
  • Stage, Job best practices :
  • if you want to use artifacts from different stages use dependencies

Ci/Cd deploy stage (push to gitlab repository- pom.xml or package.json)
→ This one need a “registry URL with a token” (no prompt for user id and password — API kind of access)
→ Deploy token will not work — cannot push to repository, but can to image registry
personal Access token is needed