jtarchie / github-pullrequest-resource

Provides a Github pull request resource for concourse CI.
MIT License
141 stars 102 forks source link

Need help configuring the resource to iterate each PR #129

Closed leshik closed 6 years ago

leshik commented 6 years ago

Hi, Could you please help me to configure github-pullrequest-resource? Apparently, I miss some point. I want the job to iterate over all open PRs and as per documentation

To ensure that check can iterate over all PRs, you must explicitly define an out for the PR.

I configured on_success and on_failure outputs. Here is my config:

resource_types:
  - name: pull-request
    type: docker-image
    source:
      repository: jtarchie/pr

resources:
  - name: l21-pull-request
    type: pull-request
    source:
      uri: git@github.com:Learn21/l21
      access_token: ((github-access-token))
      private_key: ((github-private-key))
      repo: Learn21/l21
      base: master

  - name: postgres
    type: docker-image
    source:
      repository: postgres

  - name: selenium
    type: docker-image
    source:
      repository: selenium/standalone-chrome

  - name: ruby-node
    type: docker-image
    source:
      repository: starefossen/ruby-node

jobs:
  - name: test-pull-requests
    plan:
      - aggregate:
        - get: l21-pull-request
          version: every
          trigger: true

        - get: postgres
          params: {save: true}

        - get: selenium
          params: {save: true}

        - get: ruby-node
          params: {save: true}

      - task: Test pull request
        privileged: true
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: leshik/concourse-dcind
          inputs:
            - name: postgres
            - name: selenium
            - name: ruby-node
            - name: l21-pull-request
          run:
            path: sh
            args:
              - -ec
              - |
                source /common.sh
                start_docker 3 5

                docker load -i postgres/image
                docker tag "$(cat postgres/image-id)" "$(cat postgres/repository):$(cat postgres/tag)"

                docker load -i selenium/image
                docker tag "$(cat selenium/image-id)" "$(cat selenium/repository):$(cat selenium/tag)"

                docker load -i ruby-node/image
                docker tag "$(cat ruby-node/image-id)" "$(cat ruby-node/repository):$(cat ruby-node/tag)"

                cd l21-pull-request
                docker build -f Dockerfile.tests -t learn21:tests .
                docker-compose -f docker-compose-tests.yml run tests

                docker-compose -f docker-compose-tests.yml down
                docker volume prune -f
        on_success:
          put: l21-pull-request
          params:
            path: l21-pull-request
            status: success
        on_failure:
          put: l21-pull-request
          params:
            path: l21-pull-request
            status: failure

But the job stops after the first broken PR (the status of PR gets updated, however):

screenshot 2017-12-29 20 54 47

There are two PRs in the repo. I can see the second one as pending but never executed:

screenshot 2017-12-29 20 55 46

jtarchie commented 6 years ago

Concourse does not work with version: every on an initially loaded pipeline. It will only do it from now on. Meaning every subsequent PR that you open.

leshik commented 6 years ago

@jtarchie Thank you! Do new commits to existing PRs matter, or these should be absolutely new pull requests?

jtarchie commented 6 years ago

New commits on PRs matter, so they'll trigger.

leshik commented 6 years ago

Thank you!