tag:help.appveyor.com,2012-11-13:/discussions/questions/1050-can-you-skip-a-build-if-there-is-a-tagAppVeyor: Discussion 2018-10-19T08:17:03Ztag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T20:25:15Z2015-02-28T20:25:17ZCan you skip a build if there is a tag?<div><p>I love the ability to build on tags, and to create special
deployment rules for tags vs commits, but generally when I push a
tag it is accompanied by a commit (which probably just increments a
nuget version and has a commit message the same as the tag name).
This means two builds are always queued, but I only care about one
of them (the tag build), so I manually cancel the other so I don't
have to wait on it.</p>
<p>Is there any way to automatically cancel or skip a build for a
commit when there is a tag for the same commit also queued? If not,
is this a feature you would consider?</p>
<p>I tried using skip_commits with a pattern to match commits like
"v1.2.3" but that also seems to cause tags with that pattern to be
skipped, so it's not a viable workaround.</p></div>Bret Copelandtag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T20:58:05Z2015-02-28T20:58:05ZCan you skip a build if there is a tag?<div><p>So you there are two "similar" builds started when you push a
tag? How do you push a tag? What source control/provider is
that?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:11:07Z2015-02-28T21:11:07ZCan you skip a build if there is a tag?<div><p>I generally use SourceTree on Windows for .NET projects. It runs
this command when it pushes:</p>
<pre>
<code>git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master</code>
</pre>
<p>You can <a href=
"https://ci.appveyor.com/project/bretcope/appveyortest/history">see
here</a> the sample app I've been playing with to figure out
AppVeyor, and how every time I do a combination commit/tag push, I
get two builds (one for the tag, and one for the commit it
references).</p>
<p>I would expect for some people, that behavior is desirable, but
for me it serves no purpose, and it would be my preference to
disable it. I would think it could be a feature similar to rolling
builds where a tag for a commit takes precedence over another build
for the same commit.</p></div>Bret Copelandtag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:19:38Z2015-02-28T21:20:01ZCan you skip a build if there is a tag?<div><p>OK, this is GitHub which is great. Could you check "Recent
deliveries" in webhook settings on GitHub? There are probably two
calls for each push with tag you do from SourceTree.</p>
<p>Could you drop here their requests to AV please?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:28:25Z2015-02-28T21:28:25ZCan you skip a build if there is a tag?<div><p>Correct, there are two for each example like that. I did a diff
on the JSON payload and they are largely the same, but one is
definitely for the tag while the other is for the commit.</p>
<p>Basically</p>
<pre>
<code> "ref": "refs/heads/master",
"before": "3d3474943f2495329d1c2bfe5144af1132d72a4a",
"after": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/bretcope/AppVeyorTest/compare/3d3474943f24...4833a781474f",
"commits": [
{
"id": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"distinct": true,
"message": "v1.0.6 - Remove skip_commits.",
"timestamp": "2015-02-28T16:03:48-05:00",
"url": "https://github.com/bretcope/AppVeyorTest/commit/4833a781474f1b88dc56b2dc0444c84ad674bb36",
"author": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"committer": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"added": [
],
"removed": [
],
"modified": [
"appveyor.yml"
]
}
]</code>
</pre>
<p>vs</p>
<pre>
<code> "ref": "refs/tags/v1.0.6",
"before": "0000000000000000000000000000000000000000",
"after": "72d9ce57483d8fc45c2952e67a9607c45209f5b0",
"created": true,
"deleted": false,
"forced": true,
"base_ref": null,
"compare": "https://github.com/bretcope/AppVeyorTest/compare/v1.0.6",
"commits": [
]</code>
</pre>
<p>The rest is the same.</p></div>Bret Copelandtag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:31:53Z2015-02-28T21:31:53ZCan you skip a build if there is a tag?<div><p>I don't see any sensitive data in the post bodies, so here are
the complete bodies, which I think you were asking for:</p>
<p>For the tag:</p>
<pre>
<code>{
"ref": "refs/tags/v1.0.6",
"before": "0000000000000000000000000000000000000000",
"after": "72d9ce57483d8fc45c2952e67a9607c45209f5b0",
"created": true,
"deleted": false,
"forced": true,
"base_ref": null,
"compare": "https://github.com/bretcope/AppVeyorTest/compare/v1.0.6",
"commits": [
],
"head_commit": {
"id": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"distinct": true,
"message": "v1.0.6 - Remove skip_commits.",
"timestamp": "2015-02-28T16:03:48-05:00",
"url": "https://github.com/bretcope/AppVeyorTest/commit/4833a781474f1b88dc56b2dc0444c84ad674bb36",
"author": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"committer": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"added": [
],
"removed": [
],
"modified": [
"appveyor.yml"
]
},
"repository": {
"id": 31470551,
"name": "AppVeyorTest",
"full_name": "bretcope/AppVeyorTest",
"owner": {
"name": "bretcope",
"email": "bret@atlantisflight.org"
},
"private": false,
"html_url": "https://github.com/bretcope/AppVeyorTest",
"description": "",
"fork": false,
"url": "https://github.com/bretcope/AppVeyorTest",
"forks_url": "https://api.github.com/repos/bretcope/AppVeyorTest/forks",
"keys_url": "https://api.github.com/repos/bretcope/AppVeyorTest/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/bretcope/AppVeyorTest/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/bretcope/AppVeyorTest/teams",
"hooks_url": "https://api.github.com/repos/bretcope/AppVeyorTest/hooks",
"issue_events_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues/events{/number}",
"events_url": "https://api.github.com/repos/bretcope/AppVeyorTest/events",
"assignees_url": "https://api.github.com/repos/bretcope/AppVeyorTest/assignees{/user}",
"branches_url": "https://api.github.com/repos/bretcope/AppVeyorTest/branches{/branch}",
"tags_url": "https://api.github.com/repos/bretcope/AppVeyorTest/tags",
"blobs_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/bretcope/AppVeyorTest/statuses/{sha}",
"languages_url": "https://api.github.com/repos/bretcope/AppVeyorTest/languages",
"stargazers_url": "https://api.github.com/repos/bretcope/AppVeyorTest/stargazers",
"contributors_url": "https://api.github.com/repos/bretcope/AppVeyorTest/contributors",
"subscribers_url": "https://api.github.com/repos/bretcope/AppVeyorTest/subscribers",
"subscription_url": "https://api.github.com/repos/bretcope/AppVeyorTest/subscription",
"commits_url": "https://api.github.com/repos/bretcope/AppVeyorTest/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/bretcope/AppVeyorTest/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/bretcope/AppVeyorTest/contents/{+path}",
"compare_url": "https://api.github.com/repos/bretcope/AppVeyorTest/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/bretcope/AppVeyorTest/merges",
"archive_url": "https://api.github.com/repos/bretcope/AppVeyorTest/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/bretcope/AppVeyorTest/downloads",
"issues_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues{/number}",
"pulls_url": "https://api.github.com/repos/bretcope/AppVeyorTest/pulls{/number}",
"milestones_url": "https://api.github.com/repos/bretcope/AppVeyorTest/milestones{/number}",
"notifications_url": "https://api.github.com/repos/bretcope/AppVeyorTest/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/bretcope/AppVeyorTest/labels{/name}",
"releases_url": "https://api.github.com/repos/bretcope/AppVeyorTest/releases{/id}",
"created_at": 1425145511,
"updated_at": "2015-02-28T21:03:57Z",
"pushed_at": 1425157437,
"git_url": "git://github.com/bretcope/AppVeyorTest.git",
"ssh_url": "git@github.com:bretcope/AppVeyorTest.git",
"clone_url": "https://github.com/bretcope/AppVeyorTest.git",
"svn_url": "https://github.com/bretcope/AppVeyorTest",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": "C#",
"has_issues": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 0,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"stargazers": 0,
"master_branch": "master"
},
"pusher": {
"name": "bretcope",
"email": "bret@atlantisflight.org"
},
"sender": {
"login": "bretcope",
"id": 3608260,
"avatar_url": "https://avatars.githubusercontent.com/u/3608260?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/bretcope",
"html_url": "https://github.com/bretcope",
"followers_url": "https://api.github.com/users/bretcope/followers",
"following_url": "https://api.github.com/users/bretcope/following{/other_user}",
"gists_url": "https://api.github.com/users/bretcope/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bretcope/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bretcope/subscriptions",
"organizations_url": "https://api.github.com/users/bretcope/orgs",
"repos_url": "https://api.github.com/users/bretcope/repos",
"events_url": "https://api.github.com/users/bretcope/events{/privacy}",
"received_events_url": "https://api.github.com/users/bretcope/received_events",
"type": "User",
"site_admin": false
}
}</code>
</pre>
<p>For the commit:</p>
<pre>
<code>{
"ref": "refs/heads/master",
"before": "3d3474943f2495329d1c2bfe5144af1132d72a4a",
"after": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/bretcope/AppVeyorTest/compare/3d3474943f24...4833a781474f",
"commits": [
{
"id": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"distinct": true,
"message": "v1.0.6 - Remove skip_commits.",
"timestamp": "2015-02-28T16:03:48-05:00",
"url": "https://github.com/bretcope/AppVeyorTest/commit/4833a781474f1b88dc56b2dc0444c84ad674bb36",
"author": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"committer": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"added": [
],
"removed": [
],
"modified": [
"appveyor.yml"
]
}
],
"head_commit": {
"id": "4833a781474f1b88dc56b2dc0444c84ad674bb36",
"distinct": true,
"message": "v1.0.6 - Remove skip_commits.",
"timestamp": "2015-02-28T16:03:48-05:00",
"url": "https://github.com/bretcope/AppVeyorTest/commit/4833a781474f1b88dc56b2dc0444c84ad674bb36",
"author": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"committer": {
"name": "Bret Copeland",
"email": "bret@atlantisflight.org",
"username": "bretcope"
},
"added": [
],
"removed": [
],
"modified": [
"appveyor.yml"
]
},
"repository": {
"id": 31470551,
"name": "AppVeyorTest",
"full_name": "bretcope/AppVeyorTest",
"owner": {
"name": "bretcope",
"email": "bret@atlantisflight.org"
},
"private": false,
"html_url": "https://github.com/bretcope/AppVeyorTest",
"description": "",
"fork": false,
"url": "https://github.com/bretcope/AppVeyorTest",
"forks_url": "https://api.github.com/repos/bretcope/AppVeyorTest/forks",
"keys_url": "https://api.github.com/repos/bretcope/AppVeyorTest/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/bretcope/AppVeyorTest/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/bretcope/AppVeyorTest/teams",
"hooks_url": "https://api.github.com/repos/bretcope/AppVeyorTest/hooks",
"issue_events_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues/events{/number}",
"events_url": "https://api.github.com/repos/bretcope/AppVeyorTest/events",
"assignees_url": "https://api.github.com/repos/bretcope/AppVeyorTest/assignees{/user}",
"branches_url": "https://api.github.com/repos/bretcope/AppVeyorTest/branches{/branch}",
"tags_url": "https://api.github.com/repos/bretcope/AppVeyorTest/tags",
"blobs_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/bretcope/AppVeyorTest/statuses/{sha}",
"languages_url": "https://api.github.com/repos/bretcope/AppVeyorTest/languages",
"stargazers_url": "https://api.github.com/repos/bretcope/AppVeyorTest/stargazers",
"contributors_url": "https://api.github.com/repos/bretcope/AppVeyorTest/contributors",
"subscribers_url": "https://api.github.com/repos/bretcope/AppVeyorTest/subscribers",
"subscription_url": "https://api.github.com/repos/bretcope/AppVeyorTest/subscription",
"commits_url": "https://api.github.com/repos/bretcope/AppVeyorTest/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/bretcope/AppVeyorTest/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/bretcope/AppVeyorTest/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/bretcope/AppVeyorTest/contents/{+path}",
"compare_url": "https://api.github.com/repos/bretcope/AppVeyorTest/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/bretcope/AppVeyorTest/merges",
"archive_url": "https://api.github.com/repos/bretcope/AppVeyorTest/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/bretcope/AppVeyorTest/downloads",
"issues_url": "https://api.github.com/repos/bretcope/AppVeyorTest/issues{/number}",
"pulls_url": "https://api.github.com/repos/bretcope/AppVeyorTest/pulls{/number}",
"milestones_url": "https://api.github.com/repos/bretcope/AppVeyorTest/milestones{/number}",
"notifications_url": "https://api.github.com/repos/bretcope/AppVeyorTest/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/bretcope/AppVeyorTest/labels{/name}",
"releases_url": "https://api.github.com/repos/bretcope/AppVeyorTest/releases{/id}",
"created_at": 1425145511,
"updated_at": "2015-02-28T21:03:57Z",
"pushed_at": 1425157437,
"git_url": "git://github.com/bretcope/AppVeyorTest.git",
"ssh_url": "git@github.com:bretcope/AppVeyorTest.git",
"clone_url": "https://github.com/bretcope/AppVeyorTest.git",
"svn_url": "https://github.com/bretcope/AppVeyorTest",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": "C#",
"has_issues": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 0,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"stargazers": 0,
"master_branch": "master"
},
"pusher": {
"name": "bretcope",
"email": "bret@atlantisflight.org"
},
"sender": {
"login": "bretcope",
"id": 3608260,
"avatar_url": "https://avatars.githubusercontent.com/u/3608260?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/bretcope",
"html_url": "https://github.com/bretcope",
"followers_url": "https://api.github.com/users/bretcope/followers",
"following_url": "https://api.github.com/users/bretcope/following{/other_user}",
"gists_url": "https://api.github.com/users/bretcope/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bretcope/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bretcope/subscriptions",
"organizations_url": "https://api.github.com/users/bretcope/orgs",
"repos_url": "https://api.github.com/users/bretcope/repos",
"events_url": "https://api.github.com/users/bretcope/events{/privacy}",
"received_events_url": "https://api.github.com/users/bretcope/received_events",
"type": "User",
"site_admin": false
}
}</code>
</pre></div>Bret Copelandtag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:36:50Z2015-02-28T21:36:50ZCan you skip a build if there is a tag?<div><p>Yeah, the issue is in <code>git push --tags origin
master:master</code> command which pushes branch changes together
with all tags. GitHub in its turn calls webhook for "regular"
branch push and then does one call for each tag in that push; seems
tag calls go first.</p>
<p>If you simply do <code>git push origin [tagname]</code> or
create a tag from GitHub UI that will give one webhook call.</p>
<p>Handling <code>git push --tags</code> is something new - we
should think about how to deal with that case.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T21:51:22Z2015-02-28T21:51:22ZCan you skip a build if there is a tag?<div><p>Well, <code>git push origin [tag]</code> isn't really a solution
because then that commit doesn't actually make it into the remote
master. At some point, I still have to push to master, and that's
what kicks off the unnecessary build.</p>
<p>My work flow for most projects (regardless of which language or
CI I'm using) is to always have a commit in master marked with the
version so that when you scan the commit logs, you can easily see
where the releases were, and what commits came between them.
Generally all that commit does is increment a package number (for
nuget/npm/etc), then I tag it and push. That's the exact workflow
<code>npm version</code> uses.</p>
<p>I'm okay that the answer is "we don't support this yet." I can
work around it for now by always pushing the tag <em>first</em> so
that it will reliably get queued for building first. Long term, it
would be great to handle this better.</p>
<p>I would even accept an ability to specify
<code>skip_commits</code> separate from <code>skip_tags</code>, or
a way to say <code>skip_commits</code> doesn't apply to tags, as a
reasonable solution since I <em>always</em> want to build tags, but
may want to skip commits in certain circumstances.</p>
<p>Thanks for your quick response.</p></div>Bret Copelandtag:help.appveyor.com,2012-11-13:Comment/361647052015-02-28T23:13:16Z2015-02-28T23:13:16ZCan you skip a build if there is a tag?<div><p>Your flow is perfectly fine and I find <code>git push
--tags</code> valid too that must be supported.</p>
<p>I think we could bet here on the fact that webhook push commit
event is fired shortly after tag events. Thus we could skip commit
build by doing a check if there was tag commit with the same head
commit ID few seconds before.</p>
<p>We could deploy a fix next week.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/361647052015-03-04T01:08:22Z2015-03-04T01:08:22ZCan you skip a build if there is a tag?<div><p>Hi Bret,</p>
<p>I've been experimenting with <code>git push --tags</code>
command. Looking at webhook's "Recent deliveries" GitHub calls
"push" event for commit first and then for each tag consequently.
Could you please take a look at your repo and confirm that this is
correct order?</p>
<p>My concern here is racing condition.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/361647052015-03-04T02:33:24Z2015-03-04T02:33:24ZCan you skip a build if there is a tag?<div><p>I'm actually seeing the tag hook first most often, but I don't
see a consistent order in my logs. Sometimes the tag event is
pushed first, and sometimes the commit is first. So I don't think
relying on order would work.</p></div>Bret Copeland