Improve build jobs and make them suitable for multi-pipeline
Description
Prior to this MR, the build
jobs perform three tasks: build the image, test it, and push it after the tests pass. This is not efficient since building and testing the image is repeated multiple times in the same pipeline.
Also, prior to this MR, it's difficult to predict the path/tag of the Docker image being tested with test projects, in the downstream
stage.
To solve these two issues, this MR introduces a new build
stage that builds a temporary image, later to be tested, and eventually tagged if all tests pass. The image tag is specific to the commit and is prefixed with /tmp
, making clear that this is not an official image.
The integration tests are moved to a dedicated integration test
job, part of the test
stage.
The new pipeline is similar to klar's pipeline but has an extra go
stage where the Go code is tested, checked, and compiled.
Related issue
gitlab-org/gitlab#10658 (closed)
Testing
- https://gitlab.com/caneldem/gemnasium-python/blob/master/.gitlab-ci.yml ===> project .yml
- https://gitlab.com/caneldem/gemnasium-python/pipelines/85012269 ===> tag pipeline
- https://gitlab.com/caneldem/gemnasium-python/pipelines/85003842 ==> master pipeline
- https://gitlab.com/caneldem/gemnasium-python/pipelines/85014083 ==> branch pipeline