Repository navigation
123 lines (119 loc) · 4.83 KB
/
Copy pathe2e_test_run.yaml
File metadata and controls
123 lines (119 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
name: Run End-to-End test
on:
# The inputs are the same but they cannot be shared between triggers.
# See https://github.com/orgs/community/discussions/39357
workflow_call:
inputs:
runner-tag:
description: The e2e test runner tag to run the workflow on.
type: string
required: true
workflow_dispatch:
inputs:
runner-tag:
description: The e2e test runner tag to run the workflow on.
type: string
required: true
jobs:
e2e-test:
name: End-to-End Test Run
runs-on: [self-hosted, linux, "${{ inputs.runner-tag }}"]
steps:
- name: Hostname is set to "github-runner"
run: sudo hostnamectl hostname | grep github-runner
# Below is a series of simple tests to assess the functionality of the newly spawned runner.
- name: Echo hello world
run: echo "hello world"
- name: File permission for /usr/local/bin
run: ls -ld /usr/local/bin | grep drwxrwxrwx
- name: Test file permission for /usr/local/bin
run: touch /usr/local/bin/test_file
# "Install microk8s" step will test if the proxies settings are correct.
- name: Proxy set in /etc/environment
run: cat /etc/environment
# "Update apt in python docker container" step will test docker default proxy settings due to
# pulling the python image.
- name: Proxy set in docker daemon
run: |
[[ -z "${http_proxy}" && -z "${HTTP_PROXY}" ]] \
|| sudo cat /etc/systemd/system/docker.service.d/http-proxy.conf | grep HTTP_PROXY
# "Update apt in python docker container" step will test docker client default proxy settings.
- name: Proxy set in docker client
run: |
[[ -z "${http_proxy}" && -z "${HTTP_PROXY}" ]] \
|| cat /home/ubuntu/.docker/config.json | grep httpProxy
- name: test network connectivity
run: |
timeout 60 curl --noproxy "*" http://example.com -svS -o /dev/null
timeout 60 curl --noproxy "*" https://example.com -svS -o /dev/null
- name: test aproxy logs
run: |
sudo snap logs aproxy.aproxy | grep -Fq "example.com:80"
sudo snap logs aproxy.aproxy | grep -Fq "example.com:443"
- name: Install microk8s
run: sudo snap install microk8s --classic
- name: Setup Dockerhub mirror for microk8s
run: |
if [[ -z "${DOCKERHUB_MIRROR}" ]]; then
echo "DOCKERHUB_MIRROR not set, skipping Docker Hub mirror setup"
exit 0
fi
sudo tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml > /dev/null << EOF
server = "$DOCKERHUB_MIRROR"
[host."$DOCKERHUB_MIRROR"]
capabilities = ["pull", "resolve"]
EOF
cat /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml
- name: Restart microk8s to apply mirror settings
run: |
if [[ -z "${DOCKERHUB_MIRROR}" ]]; then
echo "DOCKERHUB_MIRROR not set, skipping microk8s restart"
exit 0
fi
microk8s stop && microk8s start
- name: Wait for microk8s
timeout-minutes: 10
run: microk8s status --wait-ready
- name: Deploy nginx for testing
run: microk8s kubectl create deployment nginx --image=nginx
- name: Wait for nginx to be ready
run: microk8s kubectl rollout status deployment/nginx --timeout=30m
- name: Update apt in python docker container
run: docker run python:3.10-slim apt-get update
- name: Docker version
run: docker version
- name: Check python alias for python3
run: python --version
- name: pip version
run: python3 -m pip --version
- name: npm version
run: npm --version
- name: shellcheck version
run: shellcheck --version
- name: jq version
run: jq --version
- name: yq version
run: yq --version
- name: apt update
run: sudo apt-get update -y
# Use pipx for 24.04 noble, check-jsonschema breaks OS system packages.
- name: install pipx
run: sudo apt-get install -y pipx
- name: install check-jsonschema
run: python3 -m pip install check-jsonschema || pipx install check-jsonschema
- name: unzip version
run: unzip -v
- name: gh version
run: gh --version
# `check-jsonschema` is installed using pip. The directory `~/.local/bin` needs to be added to PATH.
# ~/.local/bin is added to path runner env through in scripts/env.j2
- name: test check-jsonschema
run: check-jsonschema --version
- name: show aproxy logs
if: always()
run: |
sudo snap get aproxy
sudo snap logs aproxy.aproxy -n=all
sudo nft list ruleset