0
votes

I have a CI pipeline in Bitbucket which is used to build and test a shared Node.js library. If we create tag (eg. npm version patch -m "Upgrade to 0.1.2 for bug fix") the new version must be published to the npm repository.

Therefore I have the following pipeline configuration:

pipelines:
  default:
    - step: *build-test-sonarcloud
  tags:
    '*':
      - step: *build-test-sonarcloud
      - step: *build-deploy-npm

However, if I push all changes after 'npm version patch' two pipelines are started. I suppose that this is because the file 'package.json' is also committed and not only a tag.

My idea is that only the 'tags'-pipeline should be started in case of a commit of a tag (with or without any files). Is there a way to only trigger that pipeline and prevent the default pipeline to run?

1

1 Answers

0
votes

When you mention '*' after tags step, this means, the pipeline will be running twice every time. You need to mention tag name, something like below code

pipelines:
  default:
    - step: *build-test-sonarcloud
  tags:
    'yourCustomTagName':
      - step: *build-test-sonarcloud
      - step: *build-deploy-npm

Now whenever you push your code with yourCustomTagName, then both the steps will run in the pipeline, if not only one will run.