Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run azure pipelines NPM deploy only for tagged commits #49

Closed
domoritz opened this issue Oct 2, 2018 · 25 comments
Closed

Run azure pipelines NPM deploy only for tagged commits #49

domoritz opened this issue Oct 2, 2018 · 25 comments

Comments

@domoritz
Copy link
Member

domoritz commented Oct 2, 2018

@chrisrpatterson could you suggest a solution for this? I can't find a condition that says whether a commit is tagged or not. Right now I get errors because I already have a version published on NPM.

@chrispat
Copy link

chrispat commented Oct 2, 2018

I not sure we have something in the environment that looks at the commit being built and determines if there is a tag on it. You can trigger on tags so it is possible you could use the fact that the branch is refs/tags instead of refs/heads in your condition.

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

Thank you, I'll try that. It would be sweet if there was tighter integration with git tags to make releases easier.

@chrispat
Copy link

chrispat commented Oct 2, 2018

You could probably use a contains function in this condition

https://github.com/vega/ts-json-schema-generator/blob/master/azure-pipelines.yml#L58
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=vsts#contains

I am trying to think about what options there might be to improve that. In your case it seems you would want to update the triggers section to include triggering on refs/tags and refs/heads

Today you can do this

trigger:
  branches:
    include:
      - refs/heads/master
      - refs/tags/*

This might be better

trigger:
  branches:
    include:
      - refs/heads/master
  tags:
    include:
      - refs/tags/v*

and then have a variable automatically set called TagName or something like that.

@domoritz domoritz changed the title Run azure pipelines NPM deploy only for tagges commits Run azure pipelines NPM deploy only for tagged commits Oct 2, 2018
@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

Hmm, https://github.com/vega/ts-json-schema-generator/blob/master/azure-pipelines.yml#L24 doesn't seem to trigger builds for tagged commits. Or at least I don't see anything at https://dev.azure.com/vega-vis/ts-json-schema-generator/_build?definitionId=3.

@chrispat
Copy link

chrispat commented Oct 2, 2018

If you edit that build pipeline in the UI check the triggers tab and make sure that UI configuration is not overriding the YAML config

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

screen shot 2018-10-02 at 09 17 37

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

Hmm, and now I ran into https://aka.ms/yamlauthz again although it worked before.

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

Builds not triggered on tagged commits seems to be a common problem with azure pipelines. See https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/13326927-trigger-build-when-pushing-tag-to-git. @chrisrpatterson is this a known issue?

@chrispat
Copy link

chrispat commented Oct 2, 2018

It shouldn't be but I will look into it

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

@chrispat
Copy link

chrispat commented Oct 2, 2018

I have found at least part of the issue. Pushing new tags to the head commit works fine if you are using the Oauth flow to auth to Github repos but not if you are using the GitHub App flow. This stems from the fact that the events are delivered differently to us from Github in each of those scenarios. We are currently working to address it.

@domoritz
Copy link
Member Author

domoritz commented Oct 2, 2018

Thank you for looking into this @chrisrpatterson! I'll have to remember to make manual releases until this is fixed. Is there a public issue I can follow or can you ping me when this is fixed?

@domoritz
Copy link
Member Author

@chrisrpatterson is there a timeline for fixing this in azure pipelines? Otherwise, I might have to revert to using Travis.

@chrispat
Copy link

@domoritz sorry for the delay. The fix will rollout on Monday of next week.

@domoritz
Copy link
Member Author

🎉 thank you!

@domoritz
Copy link
Member Author

domoritz commented Nov 8, 2018

@chrisrpatterson it still does not work. I don't see any builds for tags. Can you help me? Otherwise, I will return to Travis.

@chrispat
Copy link

@domoritz I apologize for this not working. Someone from our engineering team will comment here today and work with you to figure out what might be going on.

@lkillgore
Copy link

Hi @domoritz, I'm looking into this. Could you please clarify something? How are you authenticated w/ GitHub? Are you using the Azure Pipelines GitHub App? Or are you using OAuth or PAT? Thanks!

@lkillgore
Copy link

Hi @domoritz, if you are authenticated with the GitHub App, we made a change a few minutes ago. Tags were only working w/ OAuth and PAT, but now they're enabled with the Azure Pipelines GitHub App. If this is still not working for you, could you please tell me what your Azure DevOps account name is? (lukillgo at microsoft dot com if you'd prefer email) Thanks!

@domoritz
Copy link
Member Author

Thank you @chrisrpatterson and @lkillgore. I am using the GitHub integration. Let me make a tagged commit and see what happens.

@domoritz
Copy link
Member Author

@lkillgore
Copy link

Thanks for letting us know! Apologizes for the inconvenience.

@domoritz
Copy link
Member Author

@lkillgore @chrispat Has there been a change recently? My tagged commits are no longer being built.

@ashchan
Copy link

ashchan commented Jul 25, 2019

We're been seeing this issue too since two days ago.

Updated: Sorry I guess this is an Azure Pipelines issue, not necessarily related to this project directly.

@domoritz
Copy link
Member Author

I decided to switch to CircleCI, which also took some.wffort to get working but it works like a charm now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants