docs icon indicating copy to clipboard operation
docs copied to clipboard

Issue with `put step` tutorial

Open ismail-temiz opened this issue 1 year ago • 1 comments

Describe the bug

As I was going through the tutorial, I discovered a bug or more like an unnecessary key which could confuse new-learners. In lit/docs/getting-started/resources.lit There is a tutorial config that teaches about put step

  resources:
  - name: repo
    type: git
    source:
      uri: [email protected]:concourse/examples.git
      branch: master
      private_key: |
        -----BEGIN OPENSSH PRIVATE KEY-----
        ...
        -----END OPENSSH PRIVATE KEY-----

  jobs:
  - name: hello-world-job
    plan:
    - get: repo
      trigger: true
    - task: create-commit
      config:
        platform: linux
        image_resource:
          type: registry-image
          source:
            repository: gitea/gitea
        inputs:
        - name: repo
        outputs:
        - name: repo
        params:
          EMAIL: [email protected]
          GIT_AUTHOR_NAME: Person Doe
        run:
          path: sh
          args:
          - -cx
          - |
            cd repo
            date +%Y-%m-%d > todays-date
            git add ./todays-date
            git config --global user.email $EMAIL
            git config --global user.name $GIT_AUTHOR_NAME
            git commit -m "Update todays date"
    - put: repo
      params:
        repository: repo

the get step has trigger set true which is why this pipeline would normally trigger and run indefinitely but because it is trying to add something that it has already done in the first run, it fails with nothing to commit, working tree clean in the second run.

I don't think trigger is required here.

Reproduction steps

  1. Create a concourse pipeline definition with above code
  2. Set the pipeline
  3. Trigger the pipeline. ...

Expected behavior

trigger removed or set to false

Additional context

No response

ismail-temiz avatar Mar 12 '24 17:03 ismail-temiz

Good point! Probably causes more confusion than anything else.

taylorsilva avatar Apr 04 '24 16:04 taylorsilva