Skip to content

Commit

Permalink
Merge pull request #8 from lifematics/main
Browse files Browse the repository at this point in the history
JupyterHub 3.2.1に追従するための変更
  • Loading branch information
ikfj authored Feb 7, 2024
2 parents ac693c6 + 0b64ce4 commit 9ffe7f0
Show file tree
Hide file tree
Showing 193 changed files with 8,588 additions and 6,270 deletions.
50 changes: 40 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
# https://circleci.com/docs/2.0/arm-resources/#using-arm-resources
test-arm:
machine:
image: ubuntu-2004:202101-01
image: ubuntu-2004:2022.04.1
resource_class: arm.medium
steps:
- checkout
Expand All @@ -18,12 +18,22 @@ jobs:
name: Check architecture

- run:
# NOTE: we can't use k3s 1.24 and --docker unless we also install for
# example cri-dockerd as done in
# https://github.com/jupyterhub/action-k3s-helm.
#
# NOTE: we declare --egress-selector-mode=disabled to workaround
# intermittent issues in k3s introduced as a regression in k3s
# 1.22.10, 1.23.7, and 1.24.0. This is tracked in
# https://github.com/k3s-io/k3s/issues/5633.
#
command: >-
curl -sfL https://get.k3s.io |
INSTALL_K3S_CHANNEL=v1.20 sh -s -
INSTALL_K3S_CHANNEL=v1.23 sh -s -
--disable metrics-server
--disable traefik
--docker
--egress-selector-mode=disabled
name: Install K3S

- run:
Expand All @@ -40,30 +50,50 @@ jobs:
pip3 install --no-cache-dir -r dev-requirements.txt
name: Install dependencies

# TODO: test 'docker build' instead of buildx
# Ideally we'd use standard docker build since we're building for the native
# platform. Unfortunately the singleuser image can't be built on arm64, and the
# easiest way to skip this image is to use chartpress's --platform option,
# which is only supported with docker-buildx engine
- run:
command: |
chartpress --builder docker-buildx --platform linux/arm64
export DOCKER_BUILDKIT=1
chartpress
name: Run chartpress

- run:
command: |
export KUBECONFIG="$HOME/.kube/config"
helm upgrade --install jupyterhub ./jupyterhub --values dev-config.yaml --values dev-config-arm.yaml --wait
helm upgrade --install jupyterhub ./jupyterhub \
--wait \
--values dev-config.yaml \
--values dev-config-arm.yaml \
--values dev-config-local-chart-extra-config.yaml
name: Install local chart

- run:
command: |
export KUBECONFIG="$HOME/.kube/config"
export HUB_URL=http://localhost:30080
. ./ci/common
pytest --verbose --color=yes ./tests -m 'not netpol'
# Print out logs & definition info from all pods if the tests fail
pytest --verbose --color=yes ./tests -m 'not netpol' || \
kubectl get pod -o name | \
xargs -I {} /bin/bash -c \
"echo Logs for {} && \
kubectl get {} -o yaml && \
kubectl describe {} && \
kubectl logs --all-containers {} && \
echo --------------------------------"
name: Run tests

- run:
name: k8s namespace report
when: on_fail
command: |
export KUBECONFIG="$HOME/.kube/config"
wget https://raw.githubusercontent.com/jupyterhub/action-k8s-namespace-report/v1.1.0/k8s-namespace-report
bash k8s-namespace-report
environment:
NAMESPACE: ""
POD_SELECTOR: ""
IMPORTANT_WORKLOADS: ""

workflows:
main:
jobs:
Expand Down
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
# Ignore style and complexity
# E: style errors
# W: style warnings
# C: complexity
# D: docstring warnings (unused pydocstyle extension)
ignore = E, C, W, D
42 changes: 6 additions & 36 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
# dependabot.yml reference: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
# dependabot.yml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
#
# Notes:
# - Status and logs from dependabot are provided at
# https://github.com/jupyterhub/zero-to-jupyterhub-k8s/network/updates.
# - YAML anchors are not supported here or in GitHub Workflows.
# - versioning-strategy: lockfile-only must not be used if you only have a plain
# requirements.txt like we do in images/singleuser-sample.
# - We explicitly set the "maintenance" label to help our changelog generator
# tool github-activity to categorize PRs.
#

version: 2
updates:
# Maintain Python dependencies for the jupyterhub/k8s-hub image
- package-ecosystem: pip
directory: "/images/hub"
schedule:
interval: daily
time: "00:00"
timezone: "Etc/UTC"
versioning-strategy: lockfile-only
labels:
- maintenance
- dependencies

# Maintain Python dependencies for the jupyterhub/k8s-singleuser-sample image
- package-ecosystem: pip
directory: "/images/singleuser-sample"
schedule:
interval: daily
time: "05:00"
timezone: "Etc/UTC"
labels:
- maintenance
- dependencies

# Maintain dependencies in our GitHub Workflows
- package-ecosystem: "github-actions"
directory: "/" # This should be / rather than .github/workflows
- package-ecosystem: github-actions
directory: /
labels: [ci]
schedule:
interval: daily
interval: monthly
time: "05:00"
timezone: "Etc/UTC"
labels:
- maintenance
- dependencies
timezone: Etc/UTC
47 changes: 23 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: Publish

# Trigger the workflow on pushed tags or commits to main branch.
on:
pull_request:
paths-ignore:
- "doc/**"
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yaml"
push:
paths-ignore:
- "doc/**"
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
- "update-*"
- "vuln-scan-*"
tags:
- "**"

Expand All @@ -28,53 +31,48 @@ jobs:
# JupyterHub organization Helm chart repository.
#
# ref: https://github.com/jupyterhub/helm-chart
# ref: https://hub.docker.com/orgs/jupyterhub
# ref: https://quay.io/organization/jupyterhub

publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# chartpress requires git history to set chart version and image tags
# correctly
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.11"

- name: store whether we are publishing the chart
- name: Decide to publish or not
id: publishing
shell: python
env:
REPO: ${{ github.repository }}
EVENT: ${{ github.event_name }}
REF: ${{ github.event.ref }}
run: |
import os
repo = os.environ["REPO"]
event = os.environ["EVENT"]
ref = os.environ["REF"]
repo = "${{ github.repository }}"
event = "${{ github.event_name }}"
ref = "${{ github.event.ref }}"
publishing = ""
if (
repo == "jupyterhub/zero-to-jupyterhub-k8s"
and event == "push"
and (
# any tag
ref.startswith("refs/tags/")
# or default branch
or ref == "refs/heads/main"
)
):
publishing = "true"
print("Publishing chart")
print(f"::set-output name=publishing::{publishing}")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"publishing={publishing}\n")
- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx (for chartpress multi-arch builds)
uses: docker/setup-buildx-action@abe5d8f79a1606a2d3e218847032f3f2b1726ab0 # dependabot updates to latest release
uses: docker/setup-buildx-action@v3

- name: Install chart publishing dependencies (chartpress, helm)
run: |
Expand Down Expand Up @@ -110,7 +108,8 @@ jobs:
# https://github.com/jupyterhub/zero-to-jupyterhub-k8s/settings/secrets/actions
if: steps.publishing.outputs.publishing
run: |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" docker.io
- name: Configure a git user
# Having a user.email and user.name configured with git is required to
Expand All @@ -123,7 +122,7 @@ jobs:
- name: build chart with chartpress
run: |
# Create values.schema.yaml from schema.yaml.
# Create values.schema.json from values.schema.yaml.
./tools/generate-json-schema.py
# Append annotations to Chart.yaml with current images so that
Expand All @@ -145,7 +144,7 @@ jobs:
run: helm package jupyterhub

# ref: https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: steps.publishing.outputs.publishing == ''
with:
name: jupyterhub-${{ github.sha }}
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Create a GitHub release whenever a tag is pushed.
# Tags that aren't in the form N.N.N are considered pre-releases.

name: release-tag
on:
push:
tags:
- "**"

jobs:
create-release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# https://github.com/actions/github-script
# https://octokit.github.io/rest.js/v18#repos-create-release
- uses: actions/github-script@v6
with:
script: |
if (!context.ref.startsWith('refs/tags/')) {
core.setFailed(`${context.ref} is not in the form refs/tags/$tag`)
}
const tag = context.ref.slice(10)
const prerelease = !tag.match(/\d+\.\d+\.\d+$/)
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
prerelease: prerelease,
body: 'Please see the [changelog](https://zero-to-jupyterhub.readthedocs.io/en/latest/changelog.html) for details.'
});
33 changes: 33 additions & 0 deletions .github/workflows/support-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://github.com/dessant/support-requests
name: "Support Requests"

on:
issues:
types: [labeled, unlabeled, reopened]

permissions:
issues: write

jobs:
action:
runs-on: ubuntu-22.04
steps:
- uses: dessant/support-requests@v3
with:
github-token: ${{ github.token }}
support-label: "support"
issue-comment: |
Hi there @{issue-author} :wave:!
I closed this issue because it was labelled as a support question.
Please help us organize discussion by posting this on the https://discourse.jupyter.org/ forum. If it's your first time posting
please read https://discourse.jupyter.org/t/getting-good-answers-to-your-questions/1825.
The more information you provide the more likely we can help you.
Our goal is to sustain a positive experience for both users and developers. We use GitHub issues for specific discussions related to changing a repository's content, and let the forum be where we can more generally help and inspire each other.
Thanks you for being an active member of our community! :heart:
close-issue: true
lock-issue: false
issue-lock-reason: "off-topic"
Loading

0 comments on commit 9ffe7f0

Please sign in to comment.