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

Pass dynamic information to AnalysisRun #2482

Open
jessesuen opened this issue Aug 30, 2024 · 2 comments
Open

Pass dynamic information to AnalysisRun #2482

jessesuen opened this issue Aug 30, 2024 · 2 comments

Comments

@jessesuen
Copy link
Contributor

jessesuen commented Aug 30, 2024

Proposed Feature

Today, we support hardwired arguments to an AnalysisRun:

  verification:
    analysisTemplates:
    - name: cat-fact
    args:
    - name: foo
      value: bar

This is useful but somewhat limited. It would be more useful to be able to supply runtime information to the AnalysisRun, for example, information about the freight that it is running verification against.

Motivation

The analysis may want to use the freight information for its query or test.

Suggested Implementation

One approach is to introduce some variable feature, e.g.:

  verification:
    analysisTemplates:
    - name: cat-fact
    args:
    - name: foo
      value: "${freight.image}"  

We are already thinking of variables as part of promotion directives, and this would likely need to come after that.

@krancour
Copy link
Member

Our promotion directives will require some sort of EL as they continue to mature, so I think this is something we could deal with in tandem with that.

@lknite
Copy link
Contributor

lknite commented Sep 20, 2024

upvote

i was looking for this today; created a work around to pull the freight version information but my work around creates a race condition, better if the values could be passed in ... as a default environment variable maybe? or volume with a json file?

maybe something like this:

within job via analysistemplate:

$ cat /data/c100fc2fca4e8e9e38bb27b4be57da05f0c7428c.json
alias: idolized-lionfish
apiVersion: kargo.akuity.io/v1alpha1
commits:
- author: Prafull Ladha <[email protected]>
  committer: GitHub <[email protected]>
  id: ab42b16aef53f1a13873d8a2d5c2bfaaf32179ed
  message: Bump version to 2.14.0 (#1031)
  repoURL: https://github.com/cockroachdb/cockroach-operator.git
  tag: v2.14.0
kind: Freight
metadata:
  creationTimestamp: "2024-09-20T18:35:12Z"
  generation: 1
  labels:
    kargo.akuity.io/alias: idolized-lionfish
  name: c100fc2fca4e8e9e38bb27b4be57da05f0c7428c
  namespace: kargo-addons-cockroachdb-operator
  resourceVersion: "25429045"
  uid: f73fe1ce-ff87-4aab-bfbc-4e851b541258
origin:
  kind: Warehouse
  name: github
status:
  verifiedIn:
    vf-uxo: {}
warehouse: github

though so far i really only need the freight version ... however i recognize there could be more than one version if a couple warehouses are in use, if using env vars maybe:
FREIGHT_COUNT=2
FREIGHT0_TAG=v2.14.0
FREIGHT0_REPOURL=https://github.com/cockroachdb/cockroach-operator.git
FREIGHT1_TAG=0.0.1-84
FREIGHT1_REPOURL=...

If we could at least get the freight id then we could grant role access to freight and get the correct resource:
FREIGHT_NAME=c100fc2fca4e8e9e38bb27b4be57da05f0c7428c

two chart example:

$ k --context root-admin -n kargo-lido-managers get freight 121051eb4b4a12fa302b113b49088b6814916691 -o yaml
alias: full-seal
apiVersion: kargo.akuity.io/v1alpha1
charts:
- repoURL: oci://harbor.vc-prod.k.home.net/lido-charts/brokermanager
  version: 0.0.1-317
- repoURL: oci://harbor.vc-prod.k.home.net/lido-charts/tradermanager
  version: 0.0.1-262
kind: Freight
metadata:
  creationTimestamp: "2024-09-14T22:06:33Z"
  generation: 1
  labels:
    kargo.akuity.io/alias: full-seal
  name: 121051eb4b4a12fa302b113b49088b6814916691
  namespace: kargo-lido-managers
  resourceVersion: "163337487"
  uid: 5e096d19-2327-4a1b-b48b-b8bcb436b8b9
origin:
  kind: Warehouse
  name: warehouse
status:
  verifiedIn:
    vc-non: {}
warehouse: warehouse

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

3 participants