zarplata / concourse-git-bitbucket-pr-resource

:rocket: Concourse CI resource for tracking git branches of Bitbucket pull-requests
MIT License
34 stars 43 forks source link

Resource put not working #30

Closed alvaritez closed 5 years ago

alvaritez commented 5 years ago

I'm trying to use the resource to update the PR status, but I'm getting this error:

cat: can't open '/tmp/build/put/project/.git/pr': No such file or directory

This is my configuration:

Any clue on what I'm doing wrong? I've tried several versions of the resource with same (or similar) results. Resource works perfect for getting new PRs so I'd like to use to update them as well

idr0id commented 5 years ago

The repo directory /tmp/build/put/project was produced by that resource?

alvaritez commented 5 years ago

To be honest, I don't know who produced that directory... I'm using this resource get the code from git when a new PR is created, and I wanted to use it as well to update the build status in BitBucket. I followed the example but got that error. I'm using another resource in the meantime

idr0id commented 5 years ago

Could you post your pipeline here?

stijndehaes commented 5 years ago

You probably need to add repository to your out params. It should have the same name as the git-bitbucket-pr resource.

stijndehaes commented 5 years ago

So something like this for the example pipeline:

resources:
- name: my-repo-with-pull-requests
  type: git-bitbucket-pr
  source:
    base_url: http://bitbucket.local
    username: some-username
    password: some-password
    project: zarplata
    repository: concourse-git-bitbucket-pr-resource
    git:
      uri: https://github.com/zarplata/concourse-git-bitbucket-pr-resource
      private_key: {{git-repo-key}}

jobs:
  - name: my build
    plan:    
      - get: my-repo-with-pull-requests
        trigger: true
        version: every
      - task: unit test
          ...
          inputs:          
            - name: my-repo-with-pull-requests
          run:
          ...
        on_failure:
          put: my-repo-with-pull-requests
          params:
            state: FAILED
            name: "unit test"
            url: "http://acme.com/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME"
          repository: my-repo-with-pull-requests
        on_success:
          put: my-repo-with-pull-requests
          params:
            state: SUCCESSFUL
            name: "unit test"
            url: "http://acme.com/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME"
            repository: my-repo-with-pull-requests
alvaritez commented 5 years ago

Thanks for your answers! Unfortunately, we're using a different resource now, but I'll check this again if we ever consider using this one again

ZaxR commented 4 years ago

I can confirm that the git-bitbucket-pr resource name must exactly match the resource.source.repository value to avoid this error. It would be a nice add to allow these to be different, but at the very least this should be added to the readme/documentation, since it's not apparent. Thanks @stijndehaes for the answer!