Skip to content

Commit 4fa1465

Browse files
committed
Add podman CI test.yml scenario (requires registry)
1 parent 1afc021 commit 4fa1465

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
- main
5656
- auth
5757
- helm
58+
test-variation:
59+
- ""
5860
include:
5961
# Chart.yaml contains the chart's oldest supported k8s version, we
6062
# test against that and the oldest known supported helm cli version
@@ -70,19 +72,49 @@ jobs:
7072
# upgrade-from represents a release channel, see: https://jupyterhub.github.io/helm-chart/info.json
7173
upgrade-from: dev
7274
upgrade-from-extra-args: ""
75+
- k3s-channel: v1.25
76+
test: helm
77+
test-variation: podman
78+
local-chart-extra-args: >-
79+
--values testing/k8s-binder-k8s-hub/binderhub-chart+podman.yaml
80+
--set config.BinderHub.image_prefix=$REGISTRY_HOST/test/
81+
--set registry.url=http://$REGISTRY_HOST
82+
83+
services:
84+
registry:
85+
image: docker.io/library/registry:latest
86+
ports:
87+
- 5000:5000
88+
7389
steps:
7490
- uses: actions/checkout@v3
7591
with:
7692
# chartpress requires the full history
7793
fetch-depth: 0
7894

95+
- name: Set registry host
96+
if: matrix.test-variation == 'podman'
97+
run: |
98+
REGISTRY_HOST=$(hostname -I | awk '{print $1}'):5000
99+
echo REGISTRY_HOST="$REGISTRY_HOST" >> $GITHUB_ENV
100+
101+
# Allow k3s to pull from private registry
102+
# https://docs.k3s.io/installation/private-registry
103+
sudo mkdir -p /etc/rancher/k3s/
104+
cat << EOF | sudo tee /etc/rancher/k3s/registries.yaml
105+
mirrors:
106+
"$REGISTRY_HOST":
107+
endpoint:
108+
- "http://$REGISTRY_HOST"
109+
EOF
110+
79111
- uses: jupyterhub/action-k3s-helm@v3
80112
with:
81113
k3s-channel: ${{ matrix.k3s-channel }}
82114
helm-version: ${{ matrix.helm-version }}
83115
metrics-enabled: false
84116
traefik-enabled: false
85-
docker-enabled: true
117+
docker-enabled: ${{ matrix.test-variation != 'podman' }}
86118

87119
- name: Setup OS level dependencies
88120
run: |
@@ -145,9 +177,17 @@ jobs:
145177
run: |
146178
export DOCKER_BUILDKIT=1
147179
180+
CHARTPRESS_ARGS=
181+
if [ "${{ matrix.test-variation }}" = "podman" ]; then
182+
CHARTPRESS_ARGS="--image-prefix localhost:5000/binderhub- --push"
183+
184+
# Allow the pink pod to push to the non-https GitHub workflow registry
185+
envsubst < testing/k8s-binder-k8s-hub/cm-insecure-registries.yaml | kubectl apply -f -
186+
fi
187+
148188
# Use chartpress to create the helm chart and build its images
149189
helm dependency update ./helm-chart/binderhub
150-
(cd helm-chart && chartpress)
190+
(cd helm-chart && chartpress $CHARTPRESS_ARGS)
151191
git --no-pager diff --color=always
152192
153193
- name: Generate values.schema.json from schema.yaml
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Additional configuration for testing podman
2+
# You must create configmap/insecure-registries first to allow testing with an
3+
# insecure http registry
4+
5+
config:
6+
BinderHub:
7+
use_registry: true
8+
9+
imageBuilderType: pink
10+
11+
pink:
12+
daemonset:
13+
extraVolumeMounts:
14+
- name: insecure-registries
15+
mountPath: /etc/containers/registries.conf.d/100-insecure-registries.conf
16+
subPath: 100-insecure-registries.conf
17+
extraVolumes:
18+
- name: insecure-registries
19+
configMap:
20+
name: insecure-registries
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# REGISTRY_HOST='HOST:PORT' envsubst < cm-insecure-registries.yaml | kubectl apply -f -
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: insecure-registries
6+
data:
7+
100-insecure-registries.conf: |
8+
# https://www.redhat.com/sysadmin/manage-container-registries
9+
unqualified-search-registries = ["docker.io"]
10+
[[registry]]
11+
location="$REGISTRY_HOST"
12+
insecure=true

0 commit comments

Comments
 (0)