Skip to content

Fill in {commit} for Travis PR builds by querying GitHub#68

Merged
yarikoptic merged 1 commit intomasterfrom
gh-67
Jun 2, 2021
Merged

Fill in {commit} for Travis PR builds by querying GitHub#68
yarikoptic merged 1 commit intomasterfrom
gh-67

Conversation

@jwodder
Copy link
Copy Markdown
Contributor

@jwodder jwodder commented Jun 1, 2021

Closes #67.

@jwodder jwodder added the minor Increment the minor version when merged label Jun 1, 2021
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 1, 2021

Codecov Report

Attention: Patch coverage is 65.57377% with 21 lines in your changes missing coverage. Please review.

Project coverage is 65.50%. Comparing base (52c92e0) to head (c30b87e).
Report is 229 commits behind head on master.

Files with missing lines Patch % Lines
src/tinuous/travis.py 48.38% 11 Missing and 5 partials ⚠️
src/tinuous/util.py 50.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
+ Coverage   58.91%   65.50%   +6.59%     
==========================================
  Files           9        9              
  Lines         701      719      +18     
  Branches       98      101       +3     
==========================================
+ Hits          413      471      +58     
+ Misses        255      209      -46     
- Partials       33       39       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread README.rst
or that was tagged for the release. For pull request
builds, this is the head of the PR branch, or ``UNK`` if
it cannot be determined. For other builds (along with PR
builds on GitHub Actions), this is always the same as
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confused: so this PR doesn't provide solution for deducing the corresponding commit for GH actions PR runs? For GH actions, like even in this PR we might have both "pull_request" (where commit != build_commit) and "push" (where commit == build_commit AFAIK) runs.

Or it is just a matter of me not grasping it from the above description, that the comment above for "PR push builds" while "pull_request" builds will have different commit and build_commit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For PR builds in GitHub Actions, {commit} always equals {build_commit}, as the API reports the PR head commit as the commit being built (despite actually operating on a merge commit).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR my run on -inception: Running fetch for current state of this PR where pull_request run has logged

HEAD is now at 03f35eb Merge c30b87e into 52c92e0

so the {commit} is c30b87e and corresponding {build_commit} for a PR is a long version of 03f35eb

which seems to be available within workflow under `GITHUB_SHA` env var and logged
$> grep -2 03f35eb /tmp/pull.log             
2021-06-01T16:26:05.9877449Z ##[endgroup]
2021-06-01T16:26:05.9878299Z ##[group]Fetching the repository
2021-06-01T16:26:05.9880965Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +03f35ebbd696894fe61c2fff46217bff60019db8:refs/remotes/pull/68/merge
2021-06-01T16:26:06.7655812Z remote: Enumerating objects: 415, done.        
2021-06-01T16:26:06.7657174Z remote: Counting objects:   0% (1/415)        
--
2021-06-01T16:26:06.9301459Z  * [new tag]         0.1.0                                    -> 0.1.0
2021-06-01T16:26:06.9302504Z  * [new tag]         0.2.0                                    -> 0.2.0
2021-06-01T16:26:06.9303825Z  * [new ref]         03f35ebbd696894fe61c2fff46217bff60019db8 -> pull/68/merge
2021-06-01T16:26:06.9324429Z ##[endgroup]
2021-06-01T16:26:06.9325540Z ##[group]Determining the checkout info
--
2021-06-01T16:26:06.9418560Z Turn off this advice by setting config variable advice.detachedHead to false
2021-06-01T16:26:06.9419097Z 
2021-06-01T16:26:06.9419965Z HEAD is now at 03f35eb Merge c30b87e74a47cd360306f0674f793b14c79843da into 52c92e0b0cc683e53ebde25f7ec32cd98434e2ba
2021-06-01T16:26:06.9421009Z ##[endgroup]
2021-06-01T16:26:06.9468912Z [command]/usr/bin/git log -1 --format='%H'
2021-06-01T16:26:06.9503665Z '03f35ebbd696894fe61c2fff46217bff60019db8'
2021-06-01T16:26:06.9662780Z ##[group]Run actions/setup-python@v2
2021-06-01T16:26:06.9663354Z with:
--
2021-06-01T16:26:16.7066375Z py create: /home/runner/work/tinuous/tinuous/.tox/py
2021-06-01T16:26:17.0404949Z py installdeps: pytest~=6.0, pytest-cov~=2.0
2021-06-01T16:26:20.7202989Z py inst: /home/runner/work/tinuous/tinuous/.tox/.tmp/package/1/tinuous-0.2.0+25.g03f35eb.tar.gz
2021-06-01T16:26:32.4749600Z py installed: attrs==21.2.0,certifi==2021.5.30,cffi==1.14.5,chardet==4.0.0,click==8.0.1,click-loglevel==0.3.0,coverage==5.5,Deprecated==1.2.12,idna==2.10,in-place==0.5.0,iniconfig==1.1.1,packaging==20.9,pluggy==0.13.1,py==1.10.0,pycparser==2.20,pydantic==1.8.2,PyGithub==1.55,PyJWT==2.1.0,PyNaCl==1.4.0,pyparsing==2.4.7,pytest==6.2.4,pytest-cov==2.12.0,python-dateutil==2.8.1,python-dotenv==0.17.1,PyYAML==5.4.1,requests==2.25.1,six==1.16.0,tinuous @ file:///home/runner/work/tinuous/tinuous/.tox/.tmp/package/1/tinuous-0.2.0%2B25.g03f35eb.tar.gz,toml==0.10.2,typing-extensions==3.10.0.0,urllib3==1.26.5,wrapt==1.12.1
2021-06-01T16:26:32.4766477Z py run-test-pre: PYTHONHASHSEED='3615710078'
2021-06-01T16:26:32.4767989Z py run-test: commands[0] | tinuous --help
--
2021-06-01T16:26:33.8157549Z       -> GITHUB_REPOSITORY: con/tinuous
2021-06-01T16:26:33.8158362Z       -> GITHUB_RUN_ID:     896736691
2021-06-01T16:26:33.8159272Z       -> GITHUB_SHA:        03f35ebbd696894fe61c2fff46217bff60019db8
2021-06-01T16:26:33.8160217Z       -> GITHUB_WORKFLOW:   Test
2021-06-01T16:26:33.8348887Z     project root: .
using this tuned up config for inception
repo: con/tinuous
vars:
  path_prefix: 'logs/{year}/{month}/{day}/{type}/{type_id}/{commit[:8]}-{build_commit[:8]}/{ci}'
ci:
  github:
    path: '{path_prefix}/{wf_name}/{number}/'
    workflows:
      - test.yml
  travis:
    path: '{path_prefix}/{number}/{job}.txt'
  appveyor:
    path: '{path_prefix}/{number}/{job}.txt'
    accountName: yarikoptic
since: 2021-06-01T00:00:00Z
types: [cron, pr, push]
I got following output printed by tinuous
(git)lena:~/proj/tinuous-inception[master]git
$> ( source $PWD.secrets; tinuous fetch )                       
2021-06-01T13:59:00-0400 [INFO    ] tinuous Fetching resources from github
2021-06-01T13:59:00-0400 [INFO    ] tinuous Fetching runs newer than 2021-05-28 19:53:08+00:00
2021-06-01T13:59:00-0400 [INFO    ] tinuous Fetching runs for workflow .github/workflows/test.yml (Test)
2021-06-01T13:59:01-0400 [INFO    ] tinuous Found run 143
2021-06-01T13:59:01-0400 [INFO    ] tinuous Downloading logs for test.yml (Test) #143 to logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143
2021-06-01T13:59:02-0400 [INFO    ] tinuous Found run 142
2021-06-01T13:59:02-0400 [INFO    ] tinuous Downloading logs for test.yml (Test) #142 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142
2021-06-01T13:59:03-0400 [INFO    ] tinuous Found run 141
2021-06-01T13:59:03-0400 [INFO    ] tinuous Downloading logs for test.yml (Test) #141 to logs/2021/06/01/push/master/52c92e0b-52c92e0b/github/Test/141
2021-06-01T13:59:04-0400 [INFO    ] tinuous Fetching resources from travis
2021-06-01T13:59:04-0400 [INFO    ] tinuous Fetching builds newer than 2021-05-28 19:53:39+00:00
2021-06-01T13:59:05-0400 [INFO    ] tinuous Found build 127
2021-06-01T13:59:06-0400 [INFO    ] tinuous Downloading logs for job 127.1 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/1.txt
2021-06-01T13:59:07-0400 [INFO    ] tinuous Downloading logs for job 127.2 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/2.txt
2021-06-01T13:59:07-0400 [INFO    ] tinuous Downloading logs for job 127.3 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/3.txt
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 127.4 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/4.txt
2021-06-01T13:59:08-0400 [INFO    ] tinuous Found build 126
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 126.1 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/1.txt
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 126.2 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/2.txt
2021-06-01T13:59:09-0400 [INFO    ] tinuous Downloading logs for job 126.3 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/3.txt
2021-06-01T13:59:09-0400 [INFO    ] tinuous Downloading logs for job 126.4 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/4.txt
2021-06-01T13:59:10-0400 [INFO    ] tinuous Found build 125
2021-06-01T13:59:10-0400 [INFO    ] tinuous Downloading logs for job 125.1 to logs/2021/06/01/push/master/52c92e0b-52c92e0b/travis/125/1.txt
2021-06-01T13:59:10-0400 [INFO    ] tinuous Downloading logs for job 125.2 to logs/2021/06/01/push/master/52c92e0b-52c92e0b/travis/125/2.txt
2021-06-01T13:59:11-0400 [INFO    ] tinuous Downloading logs for job 125.3 to logs/2021/06/01/push/master/52c92e0b-52c92e0b/travis/125/3.txt
2021-06-01T13:59:11-0400 [INFO    ] tinuous Downloading logs for job 125.4 to logs/2021/06/01/push/master/52c92e0b-52c92e0b/travis/125/4.txt
2021-06-01T13:59:11-0400 [INFO    ] tinuous Fetching resources from appveyor
2021-06-01T13:59:11-0400 [INFO    ] tinuous Fetching runs newer than 2021-05-28 19:53:09.355234+00:00
2021-06-01T13:59:12-0400 [INFO    ] tinuous Found build 132
2021-06-01T13:59:13-0400 [INFO    ] tinuous Downloading logs for build 132, job 8ka4r2bfy28kipyr to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/8ka4r2bfy28kipyr.txt
2021-06-01T13:59:14-0400 [INFO    ] tinuous Downloading logs for build 132, job cngwpof9ihphuvyt to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/cngwpof9ihphuvyt.txt
2021-06-01T13:59:14-0400 [INFO    ] tinuous Downloading logs for build 132, job oc8g6obu4gi6xxkb to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/oc8g6obu4gi6xxkb.txt
2021-06-01T13:59:15-0400 [INFO    ] tinuous Downloading logs for build 132, job xc522ci6wtm7esb9 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/xc522ci6wtm7esb9.txt
2021-06-01T13:59:15-0400 [INFO    ] tinuous Found build 131
2021-06-01T13:59:16-0400 [INFO    ] tinuous Downloading logs for build 131, job iq45xnsbd5nx6msc to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/iq45xnsbd5nx6msc.txt
2021-06-01T13:59:16-0400 [INFO    ] tinuous Downloading logs for build 131, job j84iy002fq4jbw8b to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/j84iy002fq4jbw8b.txt
2021-06-01T13:59:17-0400 [INFO    ] tinuous Downloading logs for build 131, job cr7b7ego0j9o0w1f to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/cr7b7ego0j9o0w1f.txt
2021-06-01T13:59:18-0400 [INFO    ] tinuous Downloading logs for build 131, job 89poa9je5tc6kjr9 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/89poa9je5tc6kjr9.txt
2021-06-01T13:59:18-0400 [INFO    ] tinuous Found build 130
2021-06-01T13:59:19-0400 [INFO    ] tinuous Downloading logs for build 130, job 1raf7y7cf7bebdhd to logs/2021/06/01/push/master/52c92e0b-52c92e0b/appveyor/130/1raf7y7cf7bebdhd.txt
2021-06-01T13:59:19-0400 [INFO    ] tinuous Downloading logs for build 130, job kce4c7eh07gbw2ah to logs/2021/06/01/push/master/52c92e0b-52c92e0b/appveyor/130/kce4c7eh07gbw2ah.txt
2021-06-01T13:59:20-0400 [INFO    ] tinuous Downloading logs for build 130, job ttyci7iyof3ci4hn to logs/2021/06/01/push/master/52c92e0b-52c92e0b/appveyor/130/ttyci7iyof3ci4hn.txt
2021-06-01T13:59:21-0400 [INFO    ] tinuous Downloading logs for build 130, job w18avxp6vo26rtor to logs/2021/06/01/push/master/52c92e0b-52c92e0b/appveyor/130/w18avxp6vo26rtor.txt
we indeed got correct "matching" c30b87e-c30b87e7 for push builds across all (good) + the one for github PR (not so good)
$> xsel -o | grep c30b87e7-c30
2021-06-01T13:59:01-0400 [INFO    ] tinuous Downloading logs for test.yml (Test) #143 to logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143
2021-06-01T13:59:02-0400 [INFO    ] tinuous Downloading logs for test.yml (Test) #142 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 126.1 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/1.txt
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 126.2 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/2.txt
2021-06-01T13:59:09-0400 [INFO    ] tinuous Downloading logs for job 126.3 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/3.txt
2021-06-01T13:59:09-0400 [INFO    ] tinuous Downloading logs for job 126.4 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/travis/126/4.txt
2021-06-01T13:59:16-0400 [INFO    ] tinuous Downloading logs for build 131, job iq45xnsbd5nx6msc to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/iq45xnsbd5nx6msc.txt
2021-06-01T13:59:16-0400 [INFO    ] tinuous Downloading logs for build 131, job j84iy002fq4jbw8b to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/j84iy002fq4jbw8b.txt
2021-06-01T13:59:17-0400 [INFO    ] tinuous Downloading logs for build 131, job cr7b7ego0j9o0w1f to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/cr7b7ego0j9o0w1f.txt
2021-06-01T13:59:18-0400 [INFO    ] tinuous Downloading logs for build 131, job 89poa9je5tc6kjr9 to logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/appveyor/131/89poa9je5tc6kjr9.txt
and travis and appveyor correctly had c30b87e-03f35ebb (`{commit}-{build-commit}`) for PRs
$> xsel -o | grep c30b87e7-[^c]  
2021-06-01T13:59:06-0400 [INFO    ] tinuous Downloading logs for job 127.1 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/1.txt
2021-06-01T13:59:07-0400 [INFO    ] tinuous Downloading logs for job 127.2 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/2.txt
2021-06-01T13:59:07-0400 [INFO    ] tinuous Downloading logs for job 127.3 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/3.txt
2021-06-01T13:59:08-0400 [INFO    ] tinuous Downloading logs for job 127.4 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/travis/127/4.txt
2021-06-01T13:59:13-0400 [INFO    ] tinuous Downloading logs for build 132, job 8ka4r2bfy28kipyr to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/8ka4r2bfy28kipyr.txt
2021-06-01T13:59:14-0400 [INFO    ] tinuous Downloading logs for build 132, job cngwpof9ihphuvyt to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/cngwpof9ihphuvyt.txt
2021-06-01T13:59:14-0400 [INFO    ] tinuous Downloading logs for build 132, job oc8g6obu4gi6xxkb to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/oc8g6obu4gi6xxkb.txt
2021-06-01T13:59:15-0400 [INFO    ] tinuous Downloading logs for build 132, job xc522ci6wtm7esb9 to logs/2021/06/01/pr/68/c30b87e7-03f35ebb/appveyor/132/xc522ci6wtm7esb9.txt

github actions got two separate logs (for PR and branch) logs and indeed {build_commit} was corresponding to the actual {commit}:

$> md5sum logs/2021/06/01/*/*6[78]/*-*/github/Test/*/1_*       
a7dd2fa04a10aab7073134bbe882ed44  logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt
fcda200d4a72e2ff4a10b89356385304  logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test.txt
d4b248ea53ef5633f0085dbff058c636  logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142/1_test (3.8, py).txt
ce25bcbea54edb570beaa7a6f8344bbb  logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142/1_test.txt
and actual `{build_comit}` (merge) was logged
$> grep 03f35ebb logs/2021/06/01/*/*6[78]/*-*/github/Test/*/*  
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt:2021-06-01T16:26:05.9880965Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +03f35ebbd696894fe61c2fff46217bff60019db8:refs/remotes/pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt:2021-06-01T16:26:06.9303825Z  * [new ref]         03f35ebbd696894fe61c2fff46217bff60019db8 -> pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt:2021-06-01T16:26:06.9503665Z '03f35ebbd696894fe61c2fff46217bff60019db8'
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt:2021-06-01T16:26:33.8159272Z       -> GITHUB_SHA:        03f35ebbd696894fe61c2fff46217bff60019db8
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/2_test (3.9, py).txt:2021-06-01T16:26:07.4848839Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +03f35ebbd696894fe61c2fff46217bff60019db8:refs/remotes/pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/2_test (3.9, py).txt:2021-06-01T16:26:07.5482896Z  * [new ref]         03f35ebbd696894fe61c2fff46217bff60019db8 -> pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/2_test (3.9, py).txt:2021-06-01T16:26:07.5507755Z '03f35ebbd696894fe61c2fff46217bff60019db8'
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/2_test (3.9, py).txt:2021-06-01T16:26:38.0549362Z       -> GITHUB_SHA:        03f35ebbd696894fe61c2fff46217bff60019db8
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/3_test (3.8, lint).txt:2021-06-01T16:26:04.5885839Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +03f35ebbd696894fe61c2fff46217bff60019db8:refs/remotes/pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/3_test (3.8, lint).txt:2021-06-01T16:26:04.6136425Z  * [new ref]         03f35ebbd696894fe61c2fff46217bff60019db8 -> pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/3_test (3.8, lint).txt:2021-06-01T16:26:04.6155411Z '03f35ebbd696894fe61c2fff46217bff60019db8'
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/4_test (3.8, typing).txt:2021-06-01T16:26:07.9074233Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +03f35ebbd696894fe61c2fff46217bff60019db8:refs/remotes/pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/4_test (3.8, typing).txt:2021-06-01T16:26:07.9353344Z  * [new ref]         03f35ebbd696894fe61c2fff46217bff60019db8 -> pull/68/merge
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/4_test (3.8, typing).txt:2021-06-01T16:26:07.9444015Z '03f35ebbd696894fe61c2fff46217bff60019db8'

With the observation of consistently logged GITHUB_SHA we could use that one for the case where commit == build_commit and take it instead for the build_commit if differs. Could we do that to overcome github deficiency?

here is where I observe it being printed across all runs
$> grep GITHUB_SHA logs/2021/06/01/*/*/*-*/github/Test/*/* 
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/1_test (3.8, py).txt:2021-06-01T16:26:33.8159272Z       -> GITHUB_SHA:        03f35ebbd696894fe61c2fff46217bff60019db8
logs/2021/06/01/pr/68/c30b87e7-c30b87e7/github/Test/143/2_test (3.9, py).txt:2021-06-01T16:26:38.0549362Z       -> GITHUB_SHA:        03f35ebbd696894fe61c2fff46217bff60019db8
logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142/1_test (3.8, py).txt:2021-06-01T16:25:50.5463386Z       -> GITHUB_SHA:        c30b87e74a47cd360306f0674f793b14c79843da
logs/2021/06/01/push/gh-67/c30b87e7-c30b87e7/github/Test/142/2_test (3.9, py).txt:2021-06-01T16:25:55.2605208Z       -> GITHUB_SHA:        c30b87e74a47cd360306f0674f793b14c79843da
logs/2021/06/01/push/master/52c92e0b-52c92e0b/github/Test/141/1_test (3.8, py).txt:2021-06-01T15:22:09.3739855Z       -> GITHUB_SHA:        52c92e0b0cc683e53ebde25f7ec32cd98434e2ba
logs/2021/06/01/push/master/52c92e0b-52c92e0b/github/Test/141/2_test (3.9, py).txt:2021-06-01T15:22:19.2035941Z       -> GITHUB_SHA:        52c92e0b0cc683e53ebde25f7ec32cd98434e2ba

so it seems to be nicely consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GITHUB_SHA line is part of the output from the Codecov action. It won't be present on workflows that don't use Codecov.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d'oh -- right. Could we (ab)use

HEAD is now at 03f35eb Merge c30b8...

as

HEAD is now at 03f35eb Merge {commit} .*

line then may be, even though we would not get a full hexsha out of it (well, could be chased with a follow up search for a string starting from that since it seems to be right there:

2021-06-01T16:26:06.9419965Z HEAD is now at 03f35eb Merge c30b87e74a47cd360306f0674f793b14c79843da into 52c92e0b0cc683e53ebde25f7ec32cd98434e2ba
2021-06-01T16:26:06.9421009Z ##[endgroup]
2021-06-01T16:26:06.9468912Z [command]/usr/bin/git log -1 --format='%H'
2021-06-01T16:26:06.9503665Z '03f35ebbd696894fe61c2fff46217bff60019db8'

I just do not want us to give up since then we can not nicely and easily group all runs across CIs and disambiguate between PR runs against different bases (e.g. if base is changed after PR is initiated) :-/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yarikoptic Maybe. It'd require downloading logs before knowing where to place them, and it'd fail for workflows that don't perform a checkout.

and you did file a support request IIRC with github but no action was taken yet, right?
I also dislike "parse the logs" solution but poking around API did not find yet anything which could help -- there is no endpoint by any chance to query env variables for the run, is there (I did not find any)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I did not file a support request about this. Are you thinking of the support request I filed with Travis to include the PR head in their API?

I do not believe the GitHub API has an endpoint for workflow run variables.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I mixed up with that one indeed! Could you please file an issue with github so we possibly see if there is a bright future whenever it would be supported? I also wonder why they do not anyhow expose environment variables (e.g. even without secrets) -- that could have given us remedy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support issue filed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's hold breath for a little bit. I think we can proceed with this PR since for many usecases we can already have it working nicely, filed a dedicated #69 for the github actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged Travis

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Figure out {commit} for a {build_commit} wherever is missing

3 participants