Creation of ansible roles with molecule tests doesn't work due to checkout directory name

Issue #17948 new
Gerwin van de Steeg
created an issue

When building ansible roles in an ansible-galaxy compatible manner (or forking them from github) the root of the ansible role definition is the root of the repository.

Let's say we have a repo with a name of myname.ansible-role-name, which will result in an root file structure of:

bitbucket-pipelines.yml
defaults/
files/
handlers/
meta/
molecule/
README.md
requirements.txt
tasks/
templates/
vars/

When using molecule to test these locally you can just run "molecule test" in the root of this directory structure as long as the name of the directory you are in matches the name of the role specified in molecule/default/playbook.yml

ie.

---
- name: Converge
  hosts: all
  roles:
    - role: myname.ansible-role-name

Then when you execute the pipeline to run your molecule tests the system is unable to find the role you have defined because it is checked out into the path defined by the BITBUCKET_CLONE_DIR of /opt/atlassian/pipelines/agent/build

The proposed change would be that the code is checked out into /opt/atlassian/pipelines/agent/$BITBUCKET_REPO_SLUG instead to solve the problem (and creating a build symlink to this $BITBUCKET_REPO_SLUG would probably help for backwards compatibility). This will likely help other path aware/dependent code builds and automation pipelines.

Comments (2)

  1. Log in to comment