mozilla / release-services

Mozilla Release Engineering Services
https://docs.mozilla-releng.net
Mozilla Public License 2.0
49 stars 93 forks source link

tooltool.py client uploading is broken #2272

Open lundjordan opened 5 years ago

lundjordan commented 5 years ago

Few issues:

I think our docs are very out of date for uploading. They still talk about tooltool tokens which do not exist anymore: https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool

Next, I poked the client and saw that we did add support for accepting tc creds if the format was in json: https://github.com/mozilla/release-services/blob/master/src/tooltool/client/tooltool.py#L1019

So I tried this with after running add: python2.7 tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"

but, at least with python3, there seem to be a few bugs:

λ python tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"
Traceback (most recent call last):
  File "tooltool.py", line 1378, in <module>
    sys.exit(main(sys.argv))
  File "tooltool.py", line 1374, in main
    return 0 if process_command(options, args) else 1
  File "tooltool.py", line 1260, in process_command
    options.get('region'))
  File "tooltool.py", line 1137, in upload
    resp = _send_batch(base_urls[0], auth_file, batch, region)
  File "tooltool.py", line 1042, in _send_batch
    _authorize(req, auth_file)
  File "tooltool.py", line 1025, in _authorize
    taskcluster_header = make_taskcluster_header(auth_file_content, req)
  File "tooltool.py", line 297, in make_taskcluster_header
    req.get_data(),
AttributeError: 'Request' object has no attribute 'get_data'

urllib dropped support for [get_data()](https://github.com/mozilla/release-services/blob/master/src/tooltool/client/tooltool.py#L297) so I tried with direct: data attr. Then I hit:

λ python tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"
Traceback (most recent call last):
  File "tooltool.py", line 1378, in <module>
    sys.exit(main(sys.argv))
  File "tooltool.py", line 1374, in main
    return 0 if process_command(options, args) else 1
  File "tooltool.py", line 1260, in process_command
    options.get('region'))
  File "tooltool.py", line 1137, in upload
    resp = _send_batch(base_urls[0], auth_file, batch, region)
  File "tooltool.py", line 1042, in _send_batch
    _authorize(req, auth_file)
  File "tooltool.py", line 1025, in _authorize
    taskcluster_header = make_taskcluster_header(auth_file_content, req)
  File "tooltool.py", line 299, in make_taskcluster_header
    content_type='application/json',
  File "tooltool.py", line 201, in calculate_payload_hash
    p_hash.update(''.join(parts))
TypeError: sequence item 0: expected str instance, bytes found

For fear of going down the encoding py 2/3 rabbit hole, I'll pause here in case rok tested this elsewhere or has a better solution. I'm currently installing python2 to see if that works as the client suggests it supports both 2 and 3.

@garbas - any ideas?

garbas commented 5 years ago

@lundjordan I haven't yet managed to get tooltool docs in order since things regarding tooltool are changing to much. currently i'm moving tooltool into its own repository and once that is done i'm going to fix the documentation as well.

Last time I checked it tooltool was working with python3, but to be honest i'm currently using python2.7 when I upload. also python2.7 is used in tree. I will look at python 3 support once i move tooltool to new repo.

lundjordan commented 5 years ago

python 2 wfm I think