concourse / docs

concourse documentation and website
https://concourse-ci.org
56 stars 153 forks source link

Issue with `put step` tutorial #532

Open ismail-temiz opened 6 months ago

ismail-temiz commented 6 months ago

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: git@github.com: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: person@example.com
          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

taylorsilva commented 6 months ago

Good point! Probably causes more confusion than anything else.