If I have a GitLab project, which contains several sub-folders:
Every of sub-projects has a Dockerfile, deployment.yml, and gitlab-ci.yml.
deployment.yml is similar for every of sub-folders in the project, as all the sub-projects results to a single multi-container kubernetes pod.
How can I set up this project to build and deploy to kubernetes only the container, which I edited by the last commit?
I used a dirty hack like setting several build blocks in .gitlab-ci.yml for every sub-project and setting for every on them only
parameter:
maven-build-akka:
image: maven:3-jdk-8
stage: build
only:
- /^akka-.*$/
script:
- cd akka
- mvn package -B --settings ../settings.xml
artifacts:
paths:
- akka/target/*.jar
And so for docker build stage
.
After that, if I push a tag like akka-1.0.3
, appropriate pipeline jobs would be launched.
But, there's an issue with only one name for images in GitLab CI registry for a single project, so you should push images somewhere else (GCR, etc.)