Skip to content

Commit 6a6cfa6

Browse files
committed
ci/docs: update workflows with modern practices, and update master->main, etc.
1 parent a1892e7 commit 6a6cfa6

File tree

7 files changed

+97
-46
lines changed

7 files changed

+97
-46
lines changed

.github/workflows/publish.yaml

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
1-
---
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# This workflow will publish the Helm chart to jupyterhub/helm-chart's gh-pages
5+
# branch, which acts like a Helm chart repository (a static website with
6+
# index.yaml following a certain syntax).
7+
#
28
name: Publish
39

410
on:
511
push:
612
branches:
713
- "main"
8-
- "master"
14+
paths-ignore:
15+
- "**.md"
16+
- ".github/workflows/*"
17+
- "!.github/workflows/publish.yaml"
918
tags:
1019
- "**"
1120

1221
jobs:
13-
1422
publish:
1523
runs-on: ubuntu-latest
1624
steps:
17-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
1826
with:
1927
# chartpress requires the full history
2028
fetch-depth: 0
2129

22-
- uses: actions/setup-python@v2
30+
- uses: actions/setup-python@v3
2331
with:
24-
python-version: '3.8'
32+
python-version: "3.10"
2533

2634
- name: Install dependencies (chartpress, helm)
2735
run: |
28-
pip install --no-cache-dir chartpress
29-
curl -sf https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
36+
pip install chartpress
37+
curl -sf https://raw.githubusercontent.com/helm/helm/HEAD/scripts/get-helm-3 | bash
3038
3139
- name: Setup push rights to jupyterhub/helm-chart
3240
# This was setup by...
@@ -47,8 +55,6 @@ jobs:
4755
- name: Configure a git user
4856
# Having a user.email and user.name configured with git is required to
4957
# make commits, which is something chartpress does when publishing.
50-
# While Travis CI had a dummy user by default, GitHub Actions doesn't
51-
# and require this explicitly setup.
5258
run: |
5359
git config --global user.email "[email protected]"
5460
git config --global user.name "GitHub Actions user"

.github/workflows/test.yaml

+41-16
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,68 @@
1-
---
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# This workflow test the Helm chart in the following ways:
5+
#
6+
# 1. runs `helm lint`
7+
# 2. runs `helm install` with the `--wait` flag to ensure that pods startup and
8+
# enters a ready state.
9+
# 3. runs `helm test` that runs primitive tests defined as part of the Helm chart
10+
# under pebble/templates/tests to verify things seem to work.
11+
#
212
name: Test
313

414
on:
515
pull_request:
16+
paths-ignore:
17+
- "**.md"
18+
- ".github/workflows/*"
19+
- "!.github/workflows/test.yaml"
620
push:
21+
paths-ignore:
22+
- "**.md"
23+
- ".github/workflows/*"
24+
- "!.github/workflows/test.yaml"
25+
branches-ignore:
26+
- "dependabot/**"
27+
- "pre-commit-ci-update-config"
28+
workflow_dispatch:
729

830
jobs:
931
test_pebble:
1032
runs-on: ubuntu-latest
1133
timeout-minutes: 10
1234
steps:
13-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v3
1436
with:
1537
# chartpress requires the full history
1638
fetch-depth: 0
17-
- uses: jupyterhub/[email protected]
39+
40+
# ref: https://github.com/jupyterhub/action-k3s-helm
41+
- uses: jupyterhub/action-k3s-helm@v2
1842
with:
1943
k3s-version: ""
2044
helm-version: ""
2145
metrics-enabled: false
2246
traefik-enabled: false
23-
- uses: actions/setup-python@v2
47+
48+
- uses: actions/setup-python@v3
2449
with:
25-
python-version: '3.8'
50+
python-version: "3.10"
51+
2652
- name: Run tests
2753
run: |
2854
helm lint pebble --values ci/ci-values.yaml
2955
helm lint pebble --strict --values ci/ci-values.yaml
3056
helm template pebble ./pebble --values ci/ci-values.yaml --validate
3157
helm install pebble ./pebble --values ci/ci-values.yaml --wait --timeout 60s
3258
helm test pebble
33-
- name: Emit report on success
34-
if: success()
35-
run: |
36-
kubectl get all --all-namespaces
37-
- name: Emit report on failure
38-
if: failure()
39-
run: |
40-
kubectl get all --all-namespaces
41-
kubectl logs pebble-test --all-containers --prefix
42-
kubectl logs pebble-coredns-test --all-containers --prefix
43-
kubectl logs deploy/pebble-coredns --all-containers --prefix
59+
60+
# ref: https://github.com/jupyterhub/action-k8s-namespace-report
61+
- name: Kubernetes namespace report
62+
uses: jupyterhub/action-k8s-namespace-report@v1
63+
if: always()
64+
with:
65+
# The pebble-test and pebble-coredns-test pods are created by `helm
66+
# test`, and the other workloads are part of the helm chart itself.
67+
#
68+
important-workloads: pebble-test pebble-coredns-test deploy/pebble deploy/pebble-coredns

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Pebble Helm chart - Let's Encrypt for unreachable CI environment with Kubernetes!
22

3-
[![TravisCI (.com) build status](https://img.shields.io/travis/com/jupyterhub/pebble-helm-chart/master?logo=travis)](https://travis-ci.com/jupyterhub/pebble-helm-chart)
4-
[![Latest stable release of the Helm chart](https://img.shields.io/badge/dynamic/json.svg?label=version&url=https://jupyterhub.github.io/helm-chart/info.json&query=$.pebble.stable&colorB=orange&logo=helm)](https://jupyterhub.github.io/helm-chart/#pebble)
3+
[![GitHub Workflow Status - Test](https://img.shields.io/github/workflow/status/jupyterhub/pebble-helm-chart/test?logo=github&label=tests)](https://github.com/jupyterhub/zero-to-jupyterhub-k8s/actions)
4+
[![Latest stable release of the Helm chart](https://img.shields.io/badge/dynamic/json.svg?label=stable&url=https://jupyterhub.github.io/helm-chart/info.json&query=$.pebble.stable&colorB=orange&logo=helm)](https://jupyterhub.github.io/helm-chart#pebble)
5+
[![Latest development release of the Helm chart](https://img.shields.io/badge/dynamic/json.svg?label=dev&url=https://jupyterhub.github.io/helm-chart/info.json&query=$.pebble.latest&colorB=orange&logo=helm)](https://jupyterhub.github.io/helm-chart#development-releases-pebble)
56
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyterhub/pebble-helm-chart/issues)
67
[![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub)
78
[![Gitter](https://img.shields.io/badge/social_chat-gitter-blue?logo=gitter)](https://gitter.im/jupyterhub/jupyterhub)
@@ -34,9 +35,11 @@ This Helm chart deploys an ACME server (Pebble) and a DNS server ([CoreDNS](http
3435
## Installation
3536

3637
```shell
37-
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/
38-
helm repo update
39-
helm install pebble jupyterhub/pebble
38+
# Note that pebble is written twice below, the first is the helm chart name as
39+
# found in the Helm chart repository while the second is the name of the
40+
# "helm release" which is the Helm official terminology for an installation
41+
# of a Helm chart.
42+
helm install pebble pebble --repo=https://jupyterhub.github.io/helm-chart/
4043
```
4144

4245

@@ -283,7 +286,7 @@ kubectl logs deploy/pebble-coredns --all-containers --prefix
283286

284287
## Release
285288

286-
No changelog or similar yet. Making a release is as easy as pushing a tagged commit on the master branch.
289+
No changelog or similar yet. Making a release is as easy as pushing a tagged commit on the main branch.
287290

288291
```
289292
git tag -a x.y.z -m x.y.z

chartpress.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# This is the configuration for chartpress, a CLI for Helm chart management.
2+
#
3+
# chartpress is used to:
4+
# - Build images - but this Helm chart doesn't have any
5+
# - Update Chart.yaml (version) and values.yaml (image tags)
6+
# - Package and publish Helm charts to a GitHub based Helm chart repository
7+
#
8+
# For more information, see the projects README.md file:
9+
# https://github.com/jupyterhub/chartpress
10+
#
111
charts:
212
- name: pebble
313
repo:

ci/publish

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/bin/bash
2-
# This script publishes the Helm chart to the JupyterHub Helm chart repo and
3-
# pushes associated built docker images to Docker hub using chartpress.
2+
# This script publishes the Helm chart to the JupyterHub Helm chart repo (a
3+
# static website based on GitHub Pages), using chartpress.
44
# --------------------------------------------------------------------------
55

66
# Exit on errors, assert env vars, log commands
77
set -eux
88

9+
PUBLISH_ARGS="\
10+
--push \
11+
--publish-chart
12+
"
13+
914
# chartpress use git to push to our Helm chart repository, which is the gh-pages
1015
# branch of jupyterhub/helm-chart. We have installed a private SSH key within
1116
# the ~/.ssh folder with permissions to push to jupyterhub/helm-chart.
1217
if [[ $GITHUB_REF != refs/tags/* ]]; then
13-
# Using --long, we are ensured to get a build suffix, which ensures we don't
14-
# build the same tag twice.
15-
#
1618
# Using --extra-message, we help readers of merged PRs to know what version
1719
# they need to bump to in order to make use of the PR. This is enabled by a
1820
# GitHub notificaiton in the PR like "Github Action user pushed a commit to
@@ -22,19 +24,24 @@ if [[ $GITHUB_REF != refs/tags/* ]]; then
2224
#
2325
# NOTE: GitHub merge commits contain a PR reference like #123. `sed` looks
2426
# to extract either a PR reference like #123 or fall back to create a
25-
# commit hash reference like @123abcd. Combined with TRAVIS_REPO_SLUG
27+
# commit hash reference like @123abcd. Combined with GITHUB_REPOSITORY
2628
# we craft a commit message like jupyterhub/pebble-helm-chart#123 or
2729
# jupyterhub/pebble-helm-chart@123abcd which will be understood as a
2830
# reference by GitHub.
2931
PR_OR_HASH=$(git log -1 --pretty=%h-%B | head -n1 | sed 's/^.*\(#[0-9]*\).*/\1/' | sed 's/^\([0-9a-f]*\)-.*/@\1/')
30-
EXTRA_MESSAGE="${GITHUB_REPOSITORY}${PR_OR_HASH}"
31-
chartpress --push --publish-chart --long --extra-message "${EXTRA_MESSAGE}"
32+
LATEST_COMMIT_TITLE=$(git log -1 --pretty=%B | head -n1)
33+
EXTRA_MESSAGE="${GITHUB_REPOSITORY}${PR_OR_HASH} ${LATEST_COMMIT_TITLE}"
34+
35+
# shellcheck disable=SC2086
36+
chartpress $PUBLISH_ARGS --extra-message "${EXTRA_MESSAGE}"
3237
else
3338
# Setting a tag explicitly enforces a rebuild if this tag had already been
3439
# built and we wanted to override it.
35-
chartpress --push --publish-chart --tag "${GITHUB_REF:10}"
40+
41+
# shellcheck disable=SC2086
42+
chartpress $PUBLISH_ARGS --tag "${GITHUB_REF:10}"
3643
fi
3744

38-
# Let us log the changes chartpress did, it should include replacements for
39-
# fields in values.yaml, such as what tag for various images we are using.
40-
git --no-pager diff
45+
# Let us log the changes chartpress did, it should include replacements for the
46+
# version field in Chart.yaml.
47+
git --no-pager diff --color

pebble/templates/pebble-configmap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ data:
2626
# These temporary root certs are exposed through a REST API at /roots/0
2727
# on the acme-mgmt port.
2828
#
29-
# ref: https://github.com/letsencrypt/pebble/tree/master/test/certs
29+
# ref: https://github.com/letsencrypt/pebble/tree/HEAD/test/certs
3030
{{- (.Files.Glob "files/root-cert.pem").AsConfig | nindent 2 }}
3131
{{- (.Files.Glob "files/root-key.pem").AsConfig | nindent 2 }}
3232
{{- end }}

pebble/values.schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft-07/schema#",
3-
"$id": "https://github.com/jupyterhub/pebble-helm-chart/blob/master/pebble/values.schema.json",
3+
"$id": "https://github.com/jupyterhub/pebble-helm-chart/blob/HEAD/pebble/values.schema.json",
44

55
"definitions": {
66
"image": {

0 commit comments

Comments
 (0)