Skip to content

Bug 1664167 - add before context in jsone_push context#470

Merged
escapewindow merged 6 commits intomozilla-releng:masterfrom
MihaiTabara:1664167
Sep 10, 2020
Merged

Bug 1664167 - add before context in jsone_push context#470
escapewindow merged 6 commits intomozilla-releng:masterfrom
MihaiTabara:1664167

Conversation

@MihaiTabara
Copy link
Copy Markdown
Contributor

@MihaiTabara MihaiTabara commented Sep 10, 2020

For Pul-requests, it reads the event.pull_request.base.sha which in CoT is rebuilt from github3's PyPI package's https://github3.readthedocs.io/en/master/api-reference/repos.html?highlight=repository#github3.repos.repo.ShortRepository.pull_request that returns this type of object which in turn behaves like this and has the sha key. Since the github3 python package maps on Github and we use that in CoT, we naturally solve this problem in Pull-requests just by relying on the Github API, indirectly.

So we only need to fix this for github-pushes, by adding that in the context.

],
"payload": {
"env": {
"MPD001_BASE_REV": "330ea928b42ff2403fc99cd3e596d13294fe8775",
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.

@escapewindow can't access the repo, I think I should've put the real value here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No worries. Let's drop this change.

Comment thread src/scriptworker/cot/verify.py Outdated
# This value could have been taken from `commit_data.parents[0]` too but
# it is more visible if picked up from `.taskcluster.yml` env vars
base_prefix = "{}_BASE_REV".format(context.config["source_env_prefix"])
before_hash = task["payload"]["env"][base_prefix]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I don't change the mpd test file, and I change this to a .get(), it works.

Then if I verify_cot --cot-product mobile --no-check-task --task-type scriptworker --cleanup -- SyfDmaLsR6utrjkL5FmbhA , that succeeds.

Copy link
Copy Markdown
Contributor

@escapewindow escapewindow left a comment

Choose a reason for hiding this comment

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

\o/ Thank you! Going to bump versions then merge.

@escapewindow escapewindow merged commit 3536966 into mozilla-releng:master Sep 10, 2020
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

Successfully merging this pull request may close these issues.

2 participants