Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runner.conda: Explicitly get latest main version #280

Merged
merged 2 commits into from
May 23, 2023

Conversation

joverlee521
Copy link
Contributor

Learned through the conda-base repo's CI job that Anaconda's /release/{owner_login}/{package_name}/latest API endpoint returns the latest package version regardless of labels.¹ This means that users can accidentally install test versions of the nextstrain-base package.

I tried various endpoints from the API docs² to see if we can pass the label as a URL param that can allow the filtering to be done on server, but there were no leads in the docs and nothing I tried worked. So this commit adds an explicit check for the latest main version by pulling all package files and then filtering for the label and finding the max upload_time.

¹ nextstrain/conda-base#26 ² https://api.anaconda.org/docs

Testing

  • Checks pass

@joverlee521 joverlee521 requested a review from a team May 10, 2023 22:38
nextstrain/cli/runner/conda.py Outdated Show resolved Hide resolved
nextstrain/cli/runner/conda.py Show resolved Hide resolved
@tsibley
Copy link
Member

tsibley commented May 12, 2023

Looks like some new CI errors from type checking and linting.

nextstrain/cli/runner/conda.py Outdated Show resolved Hide resolved
nextstrain/cli/runner/conda.py Outdated Show resolved Hide resolved
nextstrain/cli/runner/conda.py Outdated Show resolved Hide resolved
nextstrain/cli/runner/conda.py Outdated Show resolved Hide resolved
Learned through the conda-base repo's CI job that Anaconda's
`/release/{owner_login}/{package_name}/latest` API endpoint returns the
latest package version regardless of labels.¹ This means that users can
accidentally install test versions of the nextstrain-base package.

I tried various endpoints from the API docs² to see if we can pass the
label as a URL param that can allow the filtering to be done on server,
but there were no leads in the docs and nothing I tried worked.
So this commit adds an explicit check for the latest `main` version
by pulling all package files and then filtering for the label and
finding the max `version`.

If the check for the latest `main` version fails, then this will return
to the previous behavior of using `latest` with a warning that the
latest version will be used regardless of label.

¹ nextstrain/conda-base#26
² https://api.anaconda.org/docs
@tsibley noted in review that the `/release...` API endpoint can
actually include one release per subdir per build when there are
multiple builds.

This commit explicitly finds the max `build_number` for available
distributions so that users are installing the latest build.
Copy link
Member

@tsibley tsibley left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for bearing with changes.

(Also, I wish CI was fixed so we didn't have standing errors potentially masking real issues with branches, so sorry for that!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants