Issue Summary

To upgrade from v4 running on Ubuntu(16.04) to the latest version.
When I run bin / upgrade I get the following error.
Please tell me the correct endpoint for CircleCI.

Technical details:

sudo /opt/redash/current/bin/upgrade
Continue with upgrade? (y/n): y
Downloading release tarball...
Failed running: sudo wget --header="Accept: application/octet-stream" -O
Exit status: 2
Output:
wget: option requires an argument -- 'O'
Usage: wget [OPTION]... [URL]...

Let’s see the corresponding process.

run('sudo wget --header="Accept: application/octet-stream" -O {} {}'.format(release.filename, release.download_url))

I’ve confirmed that the release variable in this part is empty.
So I took a look at the process where the release variable is set.

def get_latest_release_from_ci():
    response = requests.get('https://circleci.com/api/v1.1/project/github/getredash/redash/latest/artifacts?branch=master')

    if response.status_code != 200:
        exit("Failed getting releases (status code: %s)." % response.status_code)

    tarball_asset = filter(lambda asset: asset['url'].endswith('.tar.gz'), response.json())[0]
    filename = urllib.unquote(tarball_asset['pretty_path'].split('/')[-1])
    version = filename.replace('redash.', '').replace('.tar.gz', '')

    release = Release(version, tarball_asset['url'], filename, '')

    return release

This part confirms that the endpoint is returning an empty JSON.

https://circleci.com/api/v1.1/project/github/getredash/redash/latest/artifacts?branch=master

Solution

The latest released version (8) did not have a tar ball, so it caused an error.

  1. Confirm the order of the version (7 is the last) where download_url exists among the versions published at https://version.redash.io/api/releases
    (v7 was the second as of April 14, 2020)
  2. Change /opt/redash/current/bin/upgrade
  3. Change the array subscript in the following function.
    (This time I want to specify the second one, so set 0 to 1.)
def get_release(channel):
    if channel == 'ci':
        return get_latest_release_from_ci()

    response = requests.get('https://version.redash.io/api/releases?channel={}'.format(channel))
    release = response.json()[0] ← here

But what if I want to upgrade from v7 to v8?