-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (77 loc) · 3 KB
/
docker-image.yml
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
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
# - name: Build the Docker cross platform image
# run: docker build . --file Dockerfile --tag image:ci
- name: Build the Docker cross platform image
uses: knicknic/os-specific-run@v1
with:
linux: docker build . --file Dockerfile --tag image:ci
windows: docker build . --file Dockerfile.windows --tag image:ci
- uses: KnicKnic/[email protected]
- run: kubectl apply -f test/pod.yaml
# - run: kubectl get pod powershell-web-test -o yaml
# - run: kubectl describe pod powershell-web-test
- run: kubectl expose pod powershell-web-test --port=80 --target-port=80 --type=LoadBalancer
- run: kubectl get pod -A
- run: |
kubectl wait --timeout=120s --for=condition=Ready pod/powershell-web-test
kubectl logs pod/powershell-web-test
kubectl get pod -o yaml
kubectl describe pod powershell-web-test
kubectl wait --timeout=10s --for=condition=Ready pod/powershell-web-test
- name: Test web page
run: |
$p = kubectl get pod powershell-web-test -o json | ConvertFrom-Json
$request = Invoke-WebRequest $p.status.podIP
$request
if($request.RawContent.Contains("Hi")){
exit 0
}
exit 1
shell: pwsh
# this seems to not work on windows due to the k3s not having outbound internet why? - https://github.com/KnicKnic/temp-kubernetes-ci/issues/11
# Because of this we are not verifying that the job succeeds
- name: test internet
run: |
kubectl create job ping --image image:ci -- pwsh --command "Invoke-WebRequest 172.217.14.206 -UseBasicParsing"
sleep 30
kubectl get job
kubectl get pod -o yaml
# validate ping job succeeds
# - run: kubectl wait --timeout=10s --for=condition=complete job/ping
- run: kubectl get pod -A
- run: kubectl get service -A -o yaml
- run: sleep 30
- run: kubectl get pod -A
- run: kubectl get service -A -o yaml
- name: view ipconfig of host
uses: knicknic/os-specific-run@v1
with:
linux: ifconfig
windows: ipconfig
# Commenting this out as it seems the ip of the host changed
# I thought it was guaranteed to be 10.1.0.4 in which loopback loadbalancer would map to it
# - run: curl http://10.1.0.4:80
# - name: Build the Docker image Linux
# run: docker build . --file Dockerfile --tag image:ci
# if: matrix.os == 'ubuntu-latest'
# - name: Build the Docker image Windows
# run: docker build . --file Dockerfile.windows --tag image:ci
# if: matrix.os == 'windows-latest'
# uses: docker/[email protected]
# with:
# push: false
# repository: image
# tags: ci