Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promotionsteps don't take current freight into account for generating commit messages #3097

Open
4 tasks done
Sebast1aan opened this issue Dec 9, 2024 · 1 comment
Open
4 tasks done

Comments

@Sebast1aan
Copy link
Contributor

Checklist

  • I've searched the issue queue to verify this is not a duplicate bug report.
  • I've included steps to reproduce the bug.
  • I've pasted the output of kargo version.
  • I've pasted logs, if applicable.

Description

When using the promotion step helm-update-image or yaml-update to update more than 1 image, the commit message will always indicate that all images were updated, even if some images remain identical between promotions.
Note that this has no impact on what is deployed, so I consider this as a minor issue. It rather improves the git logs to show only which images really changed between promotions.

Screenshots

yaml-update:
image

helm-update-image:
image

Steps to Reproduce

Create following Project:

apiVersion: kargo.akuity.io/v1alpha1
kind: Project
metadata:
  name: kargo-test

Create following Warehouse:

apiVersion: kargo.akuity.io/v1alpha1
kind: Warehouse
metadata:
  name: kargo-test
  namespace: kargo-test
spec:
  subscriptions:
  - image:
      repoURL: public.ecr.aws/nginx/nginx
      semverConstraint: ^1.26.0
      discoveryLimit: 5
  - image:
      repoURL: public.ecr.aws/docker/library/golang

Create following Stage:

apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
  name: test
  namespace: kargo-test
spec:
  requestedFreight:
  - origin:
      kind: Warehouse
      name: kargo-test
    sources:
      direct: true
  promotionTemplate:
    spec:
      steps:
      - uses: git-clone
        config:
          repoURL: $GITHUB_REPO_URL
          checkout:
          - branch: main
            path: ./src
      - uses: yaml-update
        as: update-value
        config:
          path: ./src/environments/dev/builds.yaml
          updates:
          - key: global.solution.buildnumber
            value: ${{ imageFrom("public.ecr.aws/nginx/nginx").Tag }}
          - key: global.project.buildnumber
            value: ${{ imageFrom("public.ecr.aws/docker/library/golang").Tag }}
      - uses: git-commit
        as: commit
        config:
          path: ./src
          messageFromSteps:
          - update-value
      - uses: git-push
        config:
          path: ./src

Wait for Freight to be generated containing the latest images of both containers. Then manually create new Freight, but change the image for only one of the 2 containers. When promoting this new piece of Freight, you will see that the commit message indicates that both images have been updated.

Version

Kargo main branch

@Sebast1aan
Copy link
Contributor Author

I'm interested to work on this issue, but might need some input.

Investigation

For helm-update-image this seems to be the relevant function:
func (h *helmImageUpdater) generateImageUpdates(..)

When an image of a promoted piece of Freight is identical to the image in the Freight that is currently being used, this probably shouldn't be part of the updates. I didn't immediately see a quick reference to the Freight that is currently being used for the Stage, so feel free to give some input.

For yaml-update the updates are generated directly within this function:
func (y *yamlUpdater) runPromotionStep(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant