akuity / kargo

Application lifecycle orchestration
https://kargo.akuity.io/
Apache License 2.0
1.6k stars 137 forks source link

Stage sourced by multiple warehouses always result in error when promoting first time #2757

Open kejne opened 6 days ago

kejne commented 6 days ago

Checklist

Description

When setting up multiple warehouses and promoting to a stage which needs to update multiple images, it is not possible to promote to the stage the first time, since it fails when running the update image step. However, it will work to promote if promoting all of the required images - but there should be some kind of indication that the promotion didn't completely fail.

Screenshots

image

Steps to Reproduce

  1. Create multiple warehouses that pull in different images
  2. Setup a promotionTemplate like so:
    promotionTemplate:
    spec:
      steps:
        - config:
            checkout:
              - branch: main
                path: ./src
              - branch: deploy/prod
                create: true
                path: ./out
            repoURL: https://github.com/myowner/myrepo.git
          uses: git-clone
        - config:
            path: ./out
          uses: git-clear
        - as: update-image
          config:
            images:
              - fromOrigin:
                  kind: Warehouse
                  name: canary
                image: mycanaryrepo
              - fromOrigin:
                  kind: Warehouse
                  name: tester
                image: mytesterimage
            path: ./src/infrastructure/overlays/prod
          uses: kustomize-set-image
        - config:
            outPath: ./out
            path: ./src/infrastructure/overlays/prod
          uses: kustomize-build
        - as: commit
          config:
            messageFromSteps:
              - update-image
            path: ./out
          uses: git-commit
        - config:
            path: ./out
          uses: git-push
        - config:
            apps:
              - name: drive-canary-prod
                sources:
                  - desiredCommitFromStep: commit
                    repoURL: https://github.com/myowner/myrepo.git
          uses: argocd-update
    requestedFreight:
    - origin:
        kind: Warehouse
        name: canary
      sources:
        stages:
          - stg
    - origin:
        kind: Warehouse
        name: tester
      sources:
        stages:
          - stg

Version

0.9.1
krancour commented 5 days ago

We've been aware of this since "multi-pipelines" was introduced.

We tried hard to come up with some way to avoid this, but as long as Promotions promote a single piece of Freight at a time, this is unavoidable. We did weigh the possibility of Promotions being able to promote multiple pieces of Freight simultaneously, but found that the UX around that was pretty terrible.

Suffice it to say we're open to ideas.

but there should be some kind of indication that the promotion didn't completely fail.

I gather you're still using legacy promotion mechanisms and not the promotion steps introduced in v0.9.0? Promotion steps should be very clear about where in the process your error occurred.

In v1.0.0, failure to find an artifact among the Stage's (possibly many) Freight is a much more explicit error, which should improve the situation even further.

hiddeco commented 5 days ago

I think for certain promotion steps, we could theoretically make the presence of Freight which matches the selector optional via opt-in. I.e., "update everything you can for all I have, and if nothing matches — that's fine as well".

kejne commented 5 days ago

I'm using the new promotion steps so it was quite clear that the "other freight" would be needed as well to get things working properly. This is why I figured out to just try the other freight as well - however, it was a bit hard to convey this to the application teams trying it out as they would have to understand the promotion steps.

If it could be visualized somehow that the freight is still "under promotion" to the stage it would be cleared that the second freight also needs to be promoted in order for a successful promotion. Maybe a simple trailing hint in the error message when not finding an image for the steps that take arrays as input? Like: "have you promoted all required freights?"

krancour commented 4 days ago

however, it was a bit hard to convey this to the application teams trying it out as they would have to understand the promotion steps.

fwiw, we regard multi-pipelines as a bit of an advanced feature and perhaps take it for granted that someone going down this road understands Kargo quite well.

Maybe a simple trailing hint in the error message when not finding an image for the steps that take arrays as input? Like: "have you promoted all required freights?"

This is quite a good suggestion.