I was thinking about a pipeline with the following steps:
- Install image dependencies (such as java, node, yarn and openssl)
- Install node packages needed for the build
- Install PMD
- Do a code Analysis
- Run tests on the server
- Clean up
But the issue here is that I require the tools installed on steps 1 and 2 for the rest of the build. There's a package that is used to run steps 5 to 7, for example, and OpenSSL is required to decrypt a server key in the repository (so GitLab can connect to the server).
I can't seem to find a way to persist Yarn's install through different stages. When the pipeline moves from stage 1 to stage 2, it will use yarn commands and will fail with the 127 error code (command not found), like this:
$ yarn global add sfdx-cli /bin/sh: eval: line 81: yarn: not found ERROR: Job failed: exit code 127
Is it possible to persist the "environment setup" through all the stages? Can
artifacts be used for this? If so, will I need to setup the commands for every stage? For example: Yarn might be installed in a folder which will be cached, but I need to point the 'yarn' command to the correct binary, right?