If you have Go project with multiple helm charts representing microservices in skaffold, there might be cases where you want to update specific pods depending on the affected files. Based on skaffold.yaml reference, we can create artifacts with dependencies that skaffold will watch for rebuilding. It uses ko to build images. It’s perfect because it’s container builder for Go apps.
In the example below, we have artifacts: api and job. They will be rebuilt depending on which paths were changed. Once images are rebuilt, skaffold detects changes to the image references, so it will kick a rollout.
build:
artifacts:
- image: skaffoldapp-api
ko:
main: ./cmd/api/
dependencies:
paths:
- ./cmd/api/**
- ./internal/api/**
- ./internal/shared/**
- image: skaffoldapp-job
ko:
main: ./cmd/job/
dependencies:
paths:
- ./cmd/job/**
- ./internal/job/**
- ./internal/shared/**