-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 2.02 KB
/
Copy pathtest.yml
File metadata and controls
67 lines (58 loc) · 2.02 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
# Designed to be used with act, uses kubeconfig from host.
# Run with act -j test-start --container-options "-v /home/user/.kube:/root/.kube -v /home/user/.minikube:/root/.minikube"
name: Test mirrord preview action
on: push
jobs:
test-start:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup kubeconfig
run: |
KUBE_CFG="$HOME/.kube/config"
if [ ! -f "$KUBE_CFG" ]; then
echo "::error::No kubeconfig found at $KUBE_CFG"
exit 1
fi
echo "Found kubeconfig at $KUBE_CFG"
PATCHED="$HOME/.kube/config-patched"
sed "s|/home/[^/]*/.minikube|$HOME/.minikube|g" "$KUBE_CFG" > "$PATCHED"
echo "KUBECONFIG=$PATCHED" >> "$GITHUB_ENV"
echo "Patched cert paths:"
grep -E 'certificate|client-key' "$PATCHED" || true
- name: Start preview
id: preview
uses: ./
with:
action: start
target: deployment/echoserver
namespace: echoserver
mode: steal
filter: 'x-preview-id: test-123'
# ports: '[80, 8080]'
# ttl_mins: '30'
key: 'test-key-123'
image: "byjg/static-httpserver"
# For testing mostly, or using non-latest cli version.
# cli_path: /mirrord/target/debug/mirrord
- name: Print session key
run: echo "Session key = ${{ steps.preview.outputs.session-key }}"
test-stop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup kubeconfig
run: |
KUBE_CFG="$HOME/.kube/config"
if [ ! -f "$KUBE_CFG" ]; then
echo "::error::No kubeconfig found at $KUBE_CFG"
exit 1
fi
PATCHED="$HOME/.kube/config-patched"
sed "s|/home/[^/]*/.minikube|$HOME/.minikube|g" "$KUBE_CFG" > "$PATCHED"
echo "KUBECONFIG=$PATCHED" >> "$GITHUB_ENV"
- name: Stop preview
uses: ./
with:
action: stop
key: 'test-key-123'