Skip to content

Commit ad89a87

Browse files
authored
Merge pull request #1243 from consideRatio/pr/updates-to-ci
[MRG] ci: extracted full_namespace_report script to a github action and misc
2 parents cb2fa46 + d6ad5f6 commit ad89a87

File tree

6 files changed

+51
-221
lines changed

6 files changed

+51
-221
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
61
name: "CodeQL"
72

83
on:
9-
push:
10-
branches: [master]
11-
pull_request:
12-
# The branches below must be a subset of the branches above
13-
branches: [master]
144
schedule:
15-
# At 13:29 on Friday - https://crontab.guru/
16-
- cron: '29 13 * * 5'
5+
# At 05:00 - https://crontab.guru/
6+
- cron: '0 5 * * *'
177

188
jobs:
199
analyze:
@@ -23,32 +13,22 @@ jobs:
2313
strategy:
2414
fail-fast: false
2515
matrix:
26-
# Override automatic language detection by changing the below list
27-
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
28-
language: ['python', 'javascript']
29-
# Learn more...
30-
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
16+
language: [ 'python', 'javascript' ]
17+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
18+
# Learn more:
19+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3120

3221
steps:
3322
- name: Checkout repository
3423
uses: actions/checkout@v2
35-
with:
36-
# We must fetch at least the immediate parents so that if this is
37-
# a pull request then we can checkout the head.
38-
fetch-depth: 2
39-
40-
# If this run was triggered by a pull request event, then checkout
41-
# the head of the pull request instead of the merge commit.
42-
- run: git checkout HEAD^2
43-
if: ${{ github.event_name == 'pull_request' }}
4424

4525
# Initializes the CodeQL tools for scanning.
4626
- name: Initialize CodeQL
4727
uses: github/codeql-action/init@v1
4828
with:
4929
languages: ${{ matrix.language }}
5030
# If you wish to specify custom queries, you can do so here or in a config file.
51-
# By default, queries listed here will override any specified in a config file.
31+
# By default, queries listed here will override any specified in a config file.
5232
# Prefix the list here with "+" to use these queries and those in the config file.
5333
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5434

.github/workflows/publish.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@ on:
66
branches: [main, master]
77
tags: ["**"]
88

9-
defaults:
10-
run:
11-
# Declare bash be used by default in this workflow's "run" steps.
12-
#
13-
# NOTE: bash will by default run with:
14-
# --noprofile: Ignore ~/.profile etc.
15-
# --norc: Ignore ~/.bashrc etc.
16-
# -e: Exit directly on errors
17-
# -o pipefail: Don't mask errors from a command piped into another command
18-
shell: bash
199

2010
jobs:
2111
# Builds and pushes docker images to DockerHub, packages the Helm chart and

.github/workflows/test.yml

Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
tags: ["**"]
88
workflow_dispatch:
99

10-
defaults:
11-
run:
12-
shell: bash
1310

1411
jobs:
1512
# Most of the "main", "auth" and "helm" jobs are the same and only differ
@@ -22,47 +19,29 @@ jobs:
2219
fail-fast: false
2320
matrix:
2421
include:
25-
# This version of k3s uses kubernetes v1.18
26-
- k3s-version: v1.18.10+k3s2
27-
helm_version: v3.4.1
22+
- k3s-channel: v1.19
23+
helm-version: v3.5.0
2824
test: main
29-
- k3s-version: v1.18.10+k3s2
30-
helm_version: v3.4.1
25+
- k3s-channel: v1.19
26+
helm-version: v3.5.0
3127
test: auth
32-
- k3s-version: v1.18.10+k3s2
33-
helm_version: v3.4.1
28+
- k3s-channel: v1.19
29+
helm-version: v3.5.0
3430
test: helm
3531
steps:
3632
- uses: actions/checkout@v2
3733
with:
3834
# chartpress requires the full history
3935
fetch-depth: 0
40-
- uses: jupyterhub/[email protected]
36+
37+
- uses: jupyterhub/action-k3s-helm@v1
4138
with:
4239
k3s-version: ${{ matrix.k3s-version }}
4340
helm-version: ${{ matrix.helm-version }}
4441
metrics-enabled: false
4542
traefik-enabled: false
4643
docker-enabled: true
47-
- uses: actions/setup-python@v2
48-
with:
49-
python-version: '3.8'
50-
- name: Display kubernetes related details
51-
run: |
52-
echo "kubeconfig: $KUBECONFIG"
53-
echo
54-
echo "List of running pods:"
55-
kubectl get pods --all-namespaces
56-
echo
57-
echo "List of cluster nodes:"
58-
kubectl get nodes
59-
echo
60-
echo "Helm list output:"
61-
helm list
62-
- name: Setup helm chart repositories
63-
run: |
64-
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/
65-
helm repo update
44+
6645
- name: Setup OS level dependencies
6746
run: |
6847
sudo apt-get update
@@ -71,40 +50,54 @@ jobs:
7150
curl \
7251
libcurl4-openssl-dev \
7352
libssl-dev
53+
7454
- uses: actions/setup-node@v2-beta
7555
with:
7656
node-version: '14'
57+
7758
- name: Run webpack to build static assets
7859
run: |
7960
npm install
8061
npm run webpack
62+
63+
- uses: actions/setup-python@v2
64+
with:
65+
python-version: '3.8'
66+
8167
- name: Setup Python package dependencies
8268
run: |
8369
# Install development requirements, package requirements, and frozen image
8470
# requirements, with an increasing priority.
8571
pip install -r dev-requirements.txt
8672
pip install .
8773
pip install -r helm-chart/images/binderhub/requirements.txt
74+
8875
- name: Install JupyterHub chart for main tests
8976
if: matrix.test == 'main'
90-
run: ./testing/local-binder-k8s-hub/install-jupyterhub-chart
77+
run: |
78+
./testing/local-binder-k8s-hub/install-jupyterhub-chart
79+
9180
- name: Install JupyterHub chart for auth tests
9281
if: matrix.test == 'auth'
93-
run: ./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
82+
run: |
83+
./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
84+
9485
- name: Use chartpress to create the helm chart
9586
if: matrix.test == 'helm'
9687
run: |
9788
# Use chartpress to create the helm chart and build its images
9889
helm dependency update ./helm-chart/binderhub
9990
(cd helm-chart && chartpress)
100-
git --no-pager diff
91+
git --no-pager diff --color=always
92+
10193
- name: Validate the chart against the k8s API
10294
if: matrix.test == 'helm'
10395
run: |
10496
helm template --validate binderhub-test helm-chart/binderhub \
10597
--values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \
10698
--set config.BinderHub.hub_url=http://localhost:30902 \
10799
--set config.BinderHub.access_token=$GITHUB_ACCESS_TOKEN
100+
108101
- name: Install the chart
109102
if: matrix.test == 'helm'
110103
run: |
@@ -113,57 +106,48 @@ jobs:
113106
--set config.BinderHub.hub_url=http://localhost:30902 \
114107
--set config.BinderHub.hub_url_local=http://proxy-public \
115108
--set config.BinderHub.access_token=$GITHUB_ACCESS_TOKEN
109+
116110
- name: Wait for JupyterHub to be ready
117111
timeout-minutes: 10
118112
run: |
119-
# Wait for JupyterHub to be ready
120-
set -e
121113
. ci/common
122114
await_jupyterhub
123-
# Next few commands are here for sanity checking/debugging of CI
124-
# related issues
125-
echo "Proxy service details"
126-
kubectl get svc proxy-public -o json
127-
echo
128-
echo "kubectl describe svc proxy-public"
129-
kubectl describe svc proxy-public
130-
echo
131-
echo "kubectl get svc"
132-
kubectl get svc
133-
echo
134115
echo "curl http://localhost:30902/hub/api/" should print the JupyterHub version
135116
curl http://localhost:30902/hub/api/
117+
136118
- name: Wait for BinderHub to be ready
137119
if: matrix.test == 'helm'
138120
timeout-minutes: 10
139121
run: |
140-
# Wait for BinderHub to be ready
141-
set -e
142122
. ci/common
143123
await_binderhub
144124
echo "curl http://localhost:30901/health" to check BinderHub\'s health
145125
curl http://localhost:30901/health
146-
echo
126+
147127
- name: Run main tests
148128
if: matrix.test == 'main'
149129
# running the "main" tests means "all tests that aren't auth"
150130
run: pytest -m "not auth" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
131+
151132
- name: Run auth tests
152133
if: matrix.test == 'auth'
153134
# running the "auth" tests means "all tests that are marked as auth"
154135
run: pytest -m "auth" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
136+
155137
- name: Run helm tests
156138
if: matrix.test == 'helm'
157139
run: |
158140
export BINDER_URL=http://localhost:30901
159141
pytest -m "remote" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
142+
143+
# GitHub Action reference: https://github.com/jupyterhub/action-k8s-namespace-report
160144
- name: Kubernetes namespace report
161-
if: ${{ always() }}
162-
run: |
163-
# Display debugging information and always provide the logs from
164-
# certain important k8s deployments.
165-
. ci/common
166-
full_namespace_report deploy/binder deploy/hub deploy/proxy
145+
uses: jupyterhub/action-k8s-namespace-report@v1
146+
if: always()
147+
with:
148+
important-workloads: deploy/binder deploy/hub deploy/proxy
149+
150+
# GitHub action reference: https://github.com/codecov/codecov-action
167151
- name: Upload coverage stats
168152
uses: codecov/codecov-action@v1
169153
if: ${{ always() }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# [BinderHub](https://github.com/jupyterhub/binderhub)
22

33
[![Documentation Status](https://img.shields.io/readthedocs/binderhub?logo=read-the-docs)](https://binderhub.readthedocs.io/en/latest/)
4-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jupyterhub/binderhub/Tests?logo=github)](https://github.com/jupyterhub/binderhub/actions)
4+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jupyterhub/binderhub/Tests?logo=github&label=tests)](https://github.com/jupyterhub/binderhub/actions)
5+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jupyterhub/binderhub/CodeQL?logo=github&label=code%20scans)](https://github.com/jupyterhub/binderhub/actions)
56
[![Latest chart development release](https://img.shields.io/badge/dynamic/json.svg?label=latest&url=https://jupyterhub.github.io/helm-chart/info.json&query=$.binderhub.latest&colorB=orange)](https://jupyterhub.github.io/helm-chart/)
67
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/jupyterhub/binderhub/issues)
78
[![Discourse](https://img.shields.io/badge/help_forum-discourse-blue.svg)](https://discourse.jupyter.org/c/binder/binderhub)

0 commit comments

Comments
 (0)