Closed gandro closed 5 years ago
@northtyphoon @mnltejaswini
@gandro Can you please share what CLI version are you using.
@jaysterp Can you please help with this issue
@mnltejaswini I can reproduce the issue with the following version:
az --version
azure-cli (2.0.50)
acr (2.1.8)
acs (2.3.11)
advisor (2.0.0)
ams (0.3.0)
appservice (0.2.6)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.19)
consumption (0.4.0)
container (0.3.8)
core (2.0.50)
cosmosdb (0.2.3)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.1)
extension (0.2.3)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.4.0)
iot (0.3.4)
iotcentral (0.1.3)
keyvault (2.2.6)
lab (0.1.3)
maps (0.3.2)
monitor (0.2.6)
network (2.2.8)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.2)
rdbms (0.3.4)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.6)
role (2.1.9)
search (0.1.1)
servicebus (0.3.2)
servicefabric (0.1.7)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.4)
telemetry (1.0.0)
vm (2.2.7)
Python location '/home/gandro/.local/lib/azure-cli/bin/python'
Extensions directory '/home/gandro/.azure/cliextensions'
Python (Linux) 3.7.1 (default, Oct 22 2018, 10:41:28)
[GCC 8.2.1 20180831]
Legal docs and information: aka.ms/AzureCliLegal
@gandro Just wanted to confirm the acrname and taskname that you gave in the above logs are not the actual names right?
@mnltejaswini Yes, I've anonymized the names :)
@gandro We repro'd this issue and found that this is a bug in the code and we will roll out a fix soon. Thank you!
:tada: Awesome, thank you!
@gandro Here is some info on the root cause of this issue: If you have an ACR task with a GitHub commit trigger and push multiple commits once, GitHub sends a list of commit ids such as
{
"commits": [
{
"id": "16cc7564eefe7c21a094963b8dddf60028a00804",
"tree_id": "03414b5fbe7903943bd7b958476a97cc5d1b34m5",
"distinct": true,
"message": "commit1",
"timestamp": "2018-11-09T11:32:05-08:00",
"url": "https://github.com/testuser/builddemo/commit/16cc7564eefe7c21a094963b8dddf60028a00808",
"author": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"committer": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"added": [],
"removed": [],
"modified": [
"test.txt"
]
},
{
"id": "43c0ff8407e63cd477405c11144301fd53446653",
"tree_id": "70b2f8e479c3682a08a80cc8afdfc2eb379785de",
"distinct": true,
"message": "commit2",
"timestamp": "2018-11-09T11:32:35-08:00",
"url": "https://github.com/testuser/builddemo/commit/43c0ff8407e63cd477405c11144301fd53445531",
"author": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"committer": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"added": [],
"removed": [],
"modified": [
"hello.txt"
]
},
{
"id": "0db4830ddb85a1eccb17c9a59d9dce34g90ad462",
"tree_id": "2874a34a7365e164381922e95c7f9c41c3fc9545",
"distinct": true,
"message": "commit3",
"timestamp": "2018-11-09T11:32:49-08:00",
"url": "https://github.com/testuser/builddemo/commit/0db4830ddb85a1eccb17c9a59d9dce32e90ad462",
"author": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"committer": {
"name": "Test User",
"email": "testuser@microsoft.com",
"username": "testuser"
},
"added": [],
"removed": [],
"modified": [
"test.txt"
]
}
]
}
GitHub sends this list of commits in chronological order. In the above example commit3
is the most recent commit. However, we parse this payload by looking at the first commit id in the list
CommitId = (string)triggerBodyJObject["commits"]?.First?["id"]
For GitHub, this means that we incorrectly trigger a build using the oldest commit. ACR also supports triggers in Azure DevOps, which sends a list of commit ids in the opposite order than GitHub (i.e. newest commit first). This is why we initially used the above method of parsing. We are making a fix so that in the case of GitHub commit triggers, we use .Last
instead of .First
so that we capture the most recent commit for an image build. Thank you for letting us know :)
@gandro We released a fix for this bug. Can you please confirm that you are unblocked?
@jaysterp Perfect, works as expected now. Thank you!
Is this a BUG REPORT or FEATURE REQUEST?:
Bug report.
What happened?:
We created an ACR build task with the following command (according to this guide).
When pushing commits to the GitHub remote, a new run is started as expected. However, if if multiple commits were pushed (e.g. the result of a
git merge
), the ACR builds the oldest commit:Pushed commits:
Metadata of run:
Note that the
commitId
isee39b7d
- which is the oldest of the pushed commits.What did you expect to happen?:
An ACR task triggered by a git push which contained multiple commits should build the newest commit, e.g. the merge commit
73092c8
in this example.How do you reproduce it (as minimally and precisely as possible)?:
See above. Make multiple git commits locally and push them together to a GitHub remote. The triggered ACR task will build the oldest commit ee39b7d instead of 73092c8.