etranz
etranz

Reputation: 1253

argo workflow error: from input-artifact-git-: cannot use generate name with apply

I pushed my argo workflow code to my github repo that is connected to my argo cd

I tried to sync so that the argo workflow will run

but I am getting this error

from input-artifact-git-: cannot use generate name with apply

Below is my argo workflow code.

apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: input-artifact-git-
      namespace: workflows
    spec:
      entrypoint: git-clone
      templates:
        - name: git-clone
          inputs:
            artifacts:
              - name: argo-source
                path: /src
                git:
                  repo: https://github.com/*******/react-app.git
          container:
            image: node:16-alpine3.17
            command: [sh, -c]
            args: ["npm install && npm run build"]
            workingDir: /src
          outputs:
            artifacts:
              - name: message
                path: /src/build
                archive:
                  none: {}
                s3:
                  endpoint: s3.amazonaws.com
                  bucket: my-bucket-name
                  region: eu-west-2
                  key: "."
                  accessKeySecret:
                    name: mysecret
                    key: accessKey
                  secretKeySecret:
                    name: mysecret
                    key: secretKey

Upvotes: 0

Views: 1371

Answers (2)

InJung Hwang
InJung Hwang

Reputation: 31

  • Argo Workflow is an one-off run, which does not run multiple times like WorkflowTemplate.
  • That's why it contains a field generateName rather than name (Everytime it runs, name is set with generateName+hashValue in Workflow, and name is used in WorkflowTemplate)
  • So when you run Workflow w/ kubectl you need to create by kubectl create -f workflow.yaml unlike WorkflowTemplate by kubectl apply -f workflowtemplate.yaml
  • kubectl apply -f workflow.yaml, it does not work
  • Therefore, as Argo CD applies argo yaml changes on a specific period, it would not work in Argo CD as well

Upvotes: 0

crenshaw-dev
crenshaw-dev

Reputation: 8392

generateName is a feature of the Argo Workflows CLI, which automatically translates that field into a name before submitting the Workflow to the Kubernetes API.

If you want to run the Workflow once each time you sync Argo CD, check out resource hooks: https://argo-cd.readthedocs.io/en/latest/user-guide/resource_hooks/

Upvotes: 0

Related Questions