Git resource configurations specifying "url" instead of "uri" do not throw a validation error.
Bug Report
@zgagnon on slack had a resource configuration that looked like this:
---
resources:
- name: bitbucket-repo
type: git
source:
url: https://[email protected]/valid/path/to/respository.git #<--- NEEDS TO BE URI NOT URL
branch: master
username: {{username}
password: {{bitbucket key}}
jobs:
- name: a-job
plan:
- get: bitbucket-repo
trigger: true
- task: wdn-build
file: tasks/wdn-build.yml
The problem was that they needed to specify uri instead of url, however because we do not do any validation, they never got an error telling them what was wrong. Instead, they saw this seemingly unrelated error during their check step:
error: check failed with exit status '128':
fatal: repository '/tmp/git-resource-repo-cache' does not exist
This error was thrown by the git clone in the git-resource check script. The bash script was expecting $uri to have a value, but it was empty, so git thought $destination (the destination directory for the clone) was the repository they were trying to clone.
A Modest Proposal
We should do a simple validation step to ensure this field is called uri and that it exists.
OR
We should add a more useful error message to the check script.
OR
We should just allow url and uri to be used interchangeably.