Concourse pool-resource lock pipeline

894 Views Asked by At

I am trying to look a concourse pool resource, I have followed the online documentation (https://github.com/concourse/pool-resource/) in the concourse/pool-resource git hub repo.

My confiugration is as below:

resources:

- name: locks
  type: pool
  source:
    uri: https://<git-path>/<repo>.git
    branch: locks
    username: {{github-username}}
    password: {{github-password}}
    pool: locks


jobs:

- name: job1
  serial: true
  plan:
  - aggregate:
    - get: locks
 - put: locks
   params: {claim: pipeline}

- name: job2
  serial: true
  plan:
  - aggregate:
    - get: locks
 - put: locks
   params: {claim: pipeline}    

- name: release
  serial: true
  plan:
  - aggregate:
    - get: locks
 - put: locks
   params: {release: locks}

When I do a get on the locks in either job1 or job2, I see this in the jobs and then the claim of lock runs a long time, doesn't show me anything:

sh: locks/unclaimed/.gitkeep: unknown operand

I am not sure what I am doing wrong, I even hijacked into the concourse worker and tried checking /var/logs, I see everything is fine in pool-resource-request.* file.

What am I doing wrong?

The folder structure is exactly as mentioned in the documentation, the only difference is, instead of creating a new repository, we just created a separate branch for the locks in our main repository.

Folder structure

.
├── README.md
    └── locks
        ├── claimed
            ├── .gitkeep
        └── unclaimed
            ├── .gitkeep

What could be wrong?

I even tried the one below, where I am not doing a get of locks whenever I claim it.

resources:

- name: locks
  type: pool
  source:
    uri: https://<git-path>/<repo>.git
    branch: locks
    username: {{github-username}}
    password: {{github-password}}
    pool: locks


jobs:

- name: job1
  serial: true
  plan:
 - put: locks
   params: {claim: pipeline}

- name: job2
  serial: true
  plan:
 - put: locks
   params: {claim: pipeline}    

- name: release
  serial: true
  plan:
  - aggregate:
    - get: locks
 - put: locks
   params: {release: locks}

When I trigger job1, I see it goes to put locks and does nothing. When I hijack into the worker, I see it has created a folder in tmp, everything is as expected. Not sure what's wrong now.

1

There are 1 best solutions below

0
On BEST ANSWER

I had forgotten a critical part of the step, the documentation had a mention that, we create an empty file in unclaimed, I didn't do that and hence it was throwing up!

I added that, it works.

The pipeline code has no problems. I stuck with option 2