forked from ipdk-io/k8s-infra-offload
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (95 loc) · 3.21 KB
/
build-and-test.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
# if workflow for PR or push is already running stop it, and start new one
group: build-and-test-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
BuildAndTest:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: "Set up Go"
uses: actions/setup-go@v4
with:
go-version: 1.20.5
- name: "Build"
run: make dpdk
- name: Change Permissions
run: |
sudo mkdir -p /var/lib/cni/inframanager
sudo chmod 777 -R /var/lib/cni/inframanager
ls -ltr /var/lib/cni
- name: "Test"
run: |
make test
lint_dockerfiles:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Run hadolint - Manager-arm64'
uses: hadolint/[email protected]
with:
dockerfile: 'images/Dockerfile.manager-arm64'
verbose: true
- name: 'Run hadolint - Manager'
if: always()
uses: hadolint/[email protected]
with:
dockerfile: 'images/Dockerfile.manager'
verbose: true
- name: 'Run hadolint - Agent'
if: always()
uses: hadolint/[email protected]
with:
dockerfile: 'images/Dockerfile.agent'
verbose: true
DockerBuildAndPush:
needs: [BuildAndTest, lint_dockerfiles]
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: "Set up Go"
uses: actions/setup-go@v4
with:
go-version: 1.20.5
- name: "Create k8s Kind Cluster"
uses: helm/[email protected]
- name: "kustomize test"
run: |
# https://github.com/kubernetes-sigs/kustomize/issues/2867
kustomize version
- name: "docker build"
run: make docker-build IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }}/k8s-infra-offload/ IMAGE_VERSION=sha-${GITHUB_SHA::7}
- name: "Docker build for branch"
if: github.event_name == 'push'
run: make docker-build IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }}/k8s-infra-offload/ IMAGE_VERSION=${GITHUB_REF##*/}
- name: "docker deploy"
run: |
cp -f deploy/dpdk/infraagent-config.yaml deploy/.
make deploy IMAGE_REGISTRY=ghcr.io//${{ github.repository_owner }}k8s-infra-offload/ IMAGE_VERSION=sha-${GITHUB_SHA::7}
# getnodes using kubectl
kubectl get nodes -o wide
docker images | grep "k8s-infra-offload"
- name: "Login to GitHub Container Registry"
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "push docker images to registry"
if: github.event_name == 'push'
run: |
make docker-push IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }}/k8s-infra-offload/ IMAGE_VERSION=sha-${GITHUB_SHA::7}
make docker-push IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner }}/k8s-infra-offload/ IMAGE_VERSION=${GITHUB_REF##*/}