I'm designing a build & deploy pipeline for our project. We have two jobs:
build
-- builds a docker image with our app and pushes it to a container registry.deploy
-- communicates with an orchestrator, which deploys the new version.
There's one detail that I'm not sure about. Which choice is better:
- Get the full repository in the
deploy
job, while I need only one static config (deployment spec.). - Use artifacts to pass the required config file from
build
job todeploy
job, and setGIT_STRATEGY
tonone
.
These two options differ in the deploy
job environment:
The
deploy
has access to the same context asbuild
(full repository):Pros:
- The default behavior (requires no extra code and actions for this option to work).
Cons:
- The environment in
deploy
job is dirty. - The true context of the
deploy
job is implicit. - Someone could misuse it in the future.
The
build
job publishes an artifact with the required config for thedeploy
job:Pros:
- The
deploy
job explicitly has no access to anything unnecessary.
Cons:
- Need to configure the
deploy
job not to fetch the repository. - Need to configure the
build
job to publish the artifact. - Need to configure the
deploy
job to consume the artifact. - The artifact always contains an unchanged file from the repository (I'm afraid that I misuse artifacts in that case).
- The
Please, help me choose.