regro / rever

Releaser of Versions
https://regro.github.io/rever-docs/
BSD 3-Clause "New" or "Revised" License
74 stars 33 forks source link

ghrelease activity is failing #230

Open asmeurer opened 3 years ago

asmeurer commented 3 years ago

I'm not really sure why, but gh-release fails with

Uploading rever/versioned-hdf5-1.1.tar.gz to GitHub release
/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/uritemplate/variable.py:363: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  return isinstance(value, (dict, collections.MutableMapping))
activity-error:ghrelease:activity failed with execption:
Traceback (most recent call last):
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1065, in _send_output
    self.send(chunk)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/ssl.py", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/ssl.py", line 1003, in send
    return self._sslobj.write(data)
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 1065, in _send_output
    self.send(chunk)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/ssl.py", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/ssl.py", line 1003, in send
    return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/models.py", line 196, in _request
    return request_method(*args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/session.py", line 169, in request
    response = super(GitHubSession, self).request(*args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('The write operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/rever/activity.xsh", line 83, in __call__
    self.func(*args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/rever/activities/ghrelease.xsh", line 112, in _func
    self._upload_asset(rel, filename)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/rever/activities/ghrelease.xsh", line 128, in _upload_asset
    release.upload_asset(content_type, name, asset)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/decorators.py", line 31, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/repos/release.py", line 276, in upload_asset
    r = self._post(url, data=asset, json=False, headers=headers)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/models.py", line 221, in _post
    return self._request("post", url, data, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/models.py", line 201, in _request
    raise exceptions.ConnectionError(exc)
github3.exceptions.ConnectionError: <class 'requests.exceptions.ConnectionError'>: A connection-level exception occurred: ('Connection aborted.', timeout('The write operation timed out'))
rewinding to 04f179997344b8c4f265143af4dc446e048b2495

on the first attempt and

Traceback (most recent call last):
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/rever/activity.xsh", line 83, in __call__
    self.func(*args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/rever/activities/ghrelease.xsh", line 101, in _func
    draft=False, prerelease=False)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/decorators.py", line 31, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/repos/repo.py", line 1204, in create_release
    json = self._json(self._post(url, data=data), 201)
  File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/github3/models.py", line 156, in _json
    raise exceptions.error_for(response)
github3.exceptions.UnprocessableEntity: 422 Validation Failed
rewinding to 04f179997344b8c4f265143af4dc446e048b2495

on the second attempt. But the release appears to be there on GitHub. Maybe pushing the tag already creates the release?

scopatz commented 3 years ago

Does rever check work?

scopatz commented 3 years ago

I used gh-releases last week, so I am wondering what is going on here

asmeurer commented 3 years ago

rever check passed for ghrelease. I ended up converting the tag into a release and uploading the tarball manually.

scopatz commented 3 years ago

what is the output of conda list for the environment that rever is installed in?

scopatz commented 3 years ago

Also I just ran a ghrelease activity with cionda-suggest-conda-forge and it worked, so it seems like maybe this is related to the conda activity problem?

asmeurer commented 3 years ago

If you change the activity to run conda_init() first, it reproduces right away. For some reason, after running it, capturing conda output doesn't work (it just goes to the terminal and $() gets the empty string). If I try doing this in a xonsh script or in a xonsh shell it captures just fine. Something rever is doing breaks the capturing after running conda_init().

asmeurer commented 3 years ago

This rever.xsh reproduces the issue

import sys
from types import ModuleType

from rever.activity import activity

def conda_init():
    """Initializes conda, if needed. This may safely be called many times."""
    if "xontrib.conda" in sys.modules:
        return
    mod = ModuleType("xontrib.conda",
                     "Autogenerated from $(conda shell.xonsh hook)")
    __xonsh__.execer.exec(
        $(conda shell.xonsh hook),
        glbs=mod.__dict__,
        filename="$(conda shell.xonsh hook)"
    )
    sys.modules["xontrib.conda"] = mod

@activity
def test():
    conda_init()
    print(repr($(conda list)))

$ACTIVITIES = ['test']
scopatz commented 3 years ago

I am seeing the ghrelease issues on xonsh now too

hadim commented 3 years ago

I recently used the ghrelease activity and it works well for me. Not sure this is related but I received a deprecation notice from GH saying the auth I used with ever is going to be deprecated. Are you aware of that?

Issue opened at https://github.com/regro/rever/issues/239

scopatz commented 3 years ago

Oof No I did not get that message. Do you have the text of the message? I just did a ghrelease and did not see that

maclandrol commented 3 years ago

@scopatz I Got a failing activity recently. I think GH has deprecated username/password authentication (github3.api.authorize)

github.xsh:91: DeprecationWarning: The anonymous API function `github3.api.authorize` is deprecated. Use `GitHub.authorize` instead. 
two_factor_callback=two_factor)
Unable to login to GitHub

401 Bad credentials. The API can't be accessed using username/password authentication. 
Please create a personal access token to access this endpoint: http://github.com/settings/tokens