Search code examples
gitlabbitbucketcicdbitbucket-pipelines

Bitbucket : Include file from other repository


need some help. I just want to include a .yaml file from another repository as a template in Bitbucket. I am more on GitLab but for now I want this for Bitbucket.

.gitlab-ci.yml

include:
  - project: 'testy/repo/template'
    ref: main
    file: '/.templates/template.yml'

how can I do this in Bitbucket?


Solution

  • Unlike GitLabCI, there is no way to do that in Bitbucket Pipelines.

    Such feature request has been filed multiple times but AFAIK it never recieved Atlassian's attention. Because Jira sucks I am uncapable of finding historical tickets with years of people ranting about this shortcoming but you get the idea: https://jira.atlassian.com/browse/BCLOUD-20922

    You can reuse some code with pipes but the workflow is much more cumbersome than including a yaml from a shared repository and definitely can't reuse pipelines as such, only script fragments.