Skip to content

Shallow clones can lead to less precise SHA commit digests #2

@wabrit

Description

@wabrit

The default behaviour on some CI/CD systems (e.g. Atlassian bitbucket) when cloning a Git repo is to use a specific clone "depth" rather than a full clone.

This appears to lead to less precision in the SHA digest associated with a commit (e.g. from 8 digits with a full clone to just 7 with a shallow clone).

This can cause issues with Pact Brokers if the cloning behaviour is different for e.g. pipelines that publish/verify contracts and those that use can-i-deploy to gate deployment decisions, because the pacticipant versions will not match due to the absolute version in one case picking up a 7 digit SHA digest, and in the other picking up an 8-digit SHA digest.

In the case of Atlassian Bitbucket, use of the specific step parameter

- step:
    ...
    clone:
      depth: full

prevents shallow cloning and ensures a consistent digest length, but its possible the shallow clone effect upon digest length is a specific bug in bitbucket

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions