Deploy on tag not running - please help

codedeploy
npm
circle.yml

#1

Hi

I’m trying to run a deployment on a new tag. Alas, it’s not triggering.

My circleci.yml is identical to that in the docs

deployment:
  release:
    tag: /v[0-9]+(\.[0-9]+)*/
    owner: circleci
    commands:
        - mycommand

The tag is v0.0.1 which should match the regex.

Does anyone have any bright ideas?

Thanks


#2

I got this working by removing the owner:circleci line from the config.

Also, not sure it’s relevant, but I pushed my tags before my branch now - ie, git push --tags && git push


#3

This does not work for me, even after removing owner at all and pushing tags in order.
The builds always end up as “not run”. The tags match the regex and even the commit message for the tagged commit does… This seems to be broken!


#4

Can you show me your config and what you’re calling your tags? @mediafreakch


#5

@riggerthegeek Thanks for the reply! Configuration is as follows:

general:
  branches:
    only:
      - master
deployment:
  beta:
    tag: /v[0-9]+(\.[0-9]+)*/
    owner: mediafreakch
    commands:
      - deploy.sh 

Where as I create the tags using npm version. It produces tagged commits with tags as v1.0.1 and a commit message like 1.0.1.

In circleCI this triggers 2 builds (1 for git push --tags and the other for git push I assume).
The one with the tag is always labeled as “not run”…

By the way, if I manually re-run the not run build, the deploy gets triggered…


#6

@mediafreakch the deployment stuff seems ok. The two suggestions I have are:

  1. see what happens when you get rid of the general element. This may be conflicting - I know when running tags on Travis, you have to select all_branches and this may be the same
  2. see what happens when you get rid of the deployment.beta.owner element. In order to get mine to work, I had to get rid of the owner all together. I think this is because my project is run under a Github repo rather than my account.

I can’t explain the “not run” thing at all. I’ve never seen that

Sorry I have no answers, just more suggestions.


#7

This is possibly a bug in the handling, but the issue appears to be the general restrictions.

Based on tests, it seems that tags don’t get pushed as ANY branch, so CircleCI will not run them if there are any branch restrictions in place (even regex)

Try removing the general section and see if that works.

Ref: https://circleci.com/gh/drazisil/circleci-testing/241 (error unrelated)


#8

Thank you guys for helping me debug this! I tried without the general branch element and indeed it worked.
However I really need CircleCI to build only on master. What I did and worked too is using the ignore key instead of only:

general:
  branches:
    ignore:
      - /^(?!master).*$/
deployment:
  beta:
    tag: /v[0-9]+(\.[0-9]+)*/
    owner: mediafreakch
    commands:
      - deploy.sh

The regex ignores everything but the master branch. If I tag a commit on the master, it gets deployed too.


#9

Good show @mediafreakch. Happy to help


#10

Just passing by…

You can use something like this to only deploy on even numbered semvers.

/\d+\.\d+\.\d*[02468]/


#11

Put the general section in the last and it will work okay. This is iOS deployment so please configure as per your system.

deployment:
  crashlytics:
    tag: /v[0-9]+(\.[0-9]+)*/
    owner: your-github-org
    commands:
      - bundle exec fastlane deploy_to_crashlytics
      - sh save_artifacts
  testflight:
    tag: /[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]/
    owner: your-github-org
    commands:
      - bundle exec fastlane deploy_to_testflight
      - sh save_artifacts

general:
  branches:
    only:
      - develop
      - master
      - /.*[a-z_]*/

If you are deleting the tag and recreating then it could also be a problem. Please ask support to clear your source cache.
Let me know if it works okay for you guys.


#12