Skip to content

Commit

Permalink
Update default nebari-dask, nebari image tags (#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
iameskild authored Feb 1, 2023
1 parent 587c40c commit 741c26a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 47 deletions.
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ This file is copied to nebari-dev/nebari-docs using a GitHub Action. -->
* Add export-users to keycloak CLI command, add dev CLI command by @iameskild in https://github.com/nebari-dev/nebari/pull/1610
* Unpin packages in default dashboard env by @iameskild in https://github.com/nebari-dev/pull/1628
* Add release notes for 2023.1.1 by @iameskild in https://github.com/nebari-dev/nebari/pull/1629
* Set GKE release_channel to unspecified to prevent auto k8s updates by @iameskild inhttps://github.com/nebari-dev/nebari/pull/1630
* Set GKE release_channel to unspecified to prevent auto k8s updates by @iameskild in https://github.com/nebari-dev/nebari/pull/1630
* Update default nebari-dask, nebari image tags by @iameskild in https://github.com/nebari-dev/nebari/pull/1636

## New Contributors
* @pre-commit-ci made their first contribution in https://github.com/nebari-dev/nebari/pull/1613
Expand Down
4 changes: 2 additions & 2 deletions nebari/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

HIGHEST_SUPPORTED_K8S_VERSION = "1.23.5"

DEFAULT_NEBARI_DASK_VERSION = "2022.11.1"
DEFAULT_NEBARI_IMAGE_TAG = "main"
DEFAULT_NEBARI_DASK_VERSION = "2023.1.1"
DEFAULT_NEBARI_IMAGE_TAG = "2023.1.1"

DEFAULT_CONDA_STORE_IMAGE_TAG = "v0.4.12"

Expand Down
16 changes: 0 additions & 16 deletions nebari/provider/cicd/github.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64
import os
import re
from typing import Dict, List, Optional, Union

import requests
Expand Down Expand Up @@ -71,21 +70,6 @@ def get_repo_tags(owner, repo):
return github_request(f"repos/{owner}/{repo}/tags", authenticate=False).json()


def get_latest_repo_tag(owner: str, repo: str, only_clean_tags: bool = True) -> str:
"""
Get the latest available tag on GitHub for owner/repo.
NOTE: Set `only_clean_tags=False` to include dev / pre-release (if latest).
"""
tags = get_repo_tags(owner, repo)
if not only_clean_tags and len(tags) >= 1:
return tags[0].get("name")
for t in tags:
rel = list(filter(None, re.sub(r"[A-Za-z]", " ", t["name"]).split(" ")))
if len(rel) == 1:
return t.get("name")


def create_repository(owner, repo, description, homepage, private=True):
if owner == os.environ.get("GITHUB_USERNAME"):
github_request(
Expand Down
32 changes: 4 additions & 28 deletions nebari/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
import time
from typing import Dict, List

import requests
from requests.exceptions import ConnectionError
from ruamel.yaml import YAML

from nebari.constants import DEFAULT_NEBARI_DASK_VERSION, DEFAULT_NEBARI_IMAGE_TAG
from nebari.provider.cicd.github import get_latest_repo_tag
from nebari.provider.cloud import (
amazon_web_services,
azure_cloud,
Expand All @@ -40,9 +37,6 @@

CONDA_FORGE_CHANNEL_DATA_URL = "https://conda.anaconda.org/conda-forge/channeldata.json"

DOCKER_IMAGE_OWNER = "nebari-dev"
DOCKER_IMAGE_REPO = "nebari-docker-images"

# Regex for suitable project names
namestr_regex = r"^[A-Za-z][A-Za-z\-_]*[A-Za-z]$"

Expand Down Expand Up @@ -387,37 +381,19 @@ def deep_merge(*args):
return d1


@functools.lru_cache(maxsize=None)
def set_docker_image_tag() -> str:
"""Set docker image tag for `jupyterlab`, `jupyterhub`, and `dask-worker`."""
try:
nebari_image_tag = get_latest_repo_tag(DOCKER_IMAGE_OWNER, DOCKER_IMAGE_REPO)
except ConnectionError:
print(
f"Unable to connect to the GitHub API, falling back to the default value: {DEFAULT_NEBARI_IMAGE_TAG}."
)
nebari_image_tag = DEFAULT_NEBARI_IMAGE_TAG

if NEBARI_IMAGE_TAG:
nebari_image_tag = NEBARI_IMAGE_TAG
return NEBARI_IMAGE_TAG

return nebari_image_tag
return DEFAULT_NEBARI_IMAGE_TAG


@functools.lru_cache(maxsize=None)
def set_nebari_dask_version() -> str:
"""Set version of `nebari-dask` meta package."""
try:
resp = requests.get(CONDA_FORGE_CHANNEL_DATA_URL)
nebari_dask_version = resp.json()["packages"]["nebari-dask"]["version"]
resp.raise_for_status()
except ConnectionError:
print(
f"Unable to connect to the Conda-Forge channel data, falling back to the default value: {DEFAULT_NEBARI_DASK_VERSION}"
)
nebari_dask_version = DEFAULT_NEBARI_DASK_VERSION

if NEBARI_DASK_VERSION:
nebari_dask_version = NEBARI_DASK_VERSION
return NEBARI_DASK_VERSION

return nebari_dask_version
return DEFAULT_NEBARI_DASK_VERSION

0 comments on commit 741c26a

Please sign in to comment.