-
Notifications
You must be signed in to change notification settings - Fork 75
188 lines (166 loc) · 6.31 KB
/
ci.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
#
# Linter checker
#
linters:
name: Linters
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
go-version: [1.19]
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
skip-cache: true
args: --timeout=5m
#
# Project checker
#
# based on https://github.com/containerd/project-checks/blob/main/action.yml
project:
name: Project Checks
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
with:
path: src/github.com/containerd/accelerated-container-image
fetch-depth: 100
- name: set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
# TODO(fuweid): remove the env GO111MODULE=off in new version of go
- name: install dependencies
shell: bash
env:
GO111MODULE: off
run: |
echo "::group:: install dependencies"
go get -u -v github.com/vbatts/git-validation
go get -u -v github.com/kunalkushwaha/ltag
echo "::endgroup::"
- name: DCO checker
shell: bash
working-directory: src/github.com/containerd/accelerated-container-image
env:
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
DCO_VERBOSITY: "-v"
DCO_RANGE: ""
run: |
echo "::group:: DCO checks"
set -eu -o pipefail
if [ -z "${GITHUB_COMMIT_URL}" ]; then
DCO_RANGE=$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH})
else
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha + "..HEAD"')
fi
range=
[ ! -z "${DCO_RANGE}" ] && range="-range ${DCO_RANGE}"
git-validation ${DCO_VERBOSITY} ${range} -run DCO,short-subject,dangling-whitespace
echo "::endgroup::"
- name: validate file headers
shell: bash
working-directory: src/github.com/containerd/accelerated-container-image
run: |
set -eu -o pipefail
echo "::group:: file headers"
ltag -t "script/validate/template" --excludes "vendor contrib" --check -v
echo "::endgroup::"
ut:
name: ut
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
path: src/github.com/containerd/accelerated-container-image
fetch-depth: 100
- name: install Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: unit test
working-directory: src/github.com/containerd/accelerated-container-image
run: |
sudo GO_TESTFLAGS=-v make test
e2e:
name: e2e
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
path: src/github.com/containerd/accelerated-container-image
fetch-depth: 100
- name: install Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: e2e
working-directory: src/github.com/containerd/accelerated-container-image
run: |
echo "[ init env ]"
sudo apt update && sudo apt install -y containerd.io libnl-3-200 libnl-genl-3-200
sudo modprobe -a target_core_user tcm_loop
wget https://github.com/containerd/overlaybd/releases/download/v0.6.10/overlaybd-0.6.10-0ubuntu1.22.04.x86_64.deb &&
sudo dpkg -i overlaybd-0.6.10-0ubuntu1.22.04.x86_64.deb
sudo systemctl enable /opt/overlaybd/overlaybd-tcmu.service
sudo systemctl start overlaybd-tcmu
sudo systemctl status overlaybd-tcmu
go mod tidy
make
sudo mkdir /etc/overlaybd-snapshotter
sudo echo '{"root": "/var/lib/overlaybd/","address": "/run/overlaybd-snapshotter/overlaybd.sock"}' | sudo tee -a /etc/overlaybd-snapshotter/config.json
sudo bin/overlaybd-snapshotter &
sudo mkdir -p /etc/containerd/
sudo echo -e '[proxy_plugins.overlaybd]\n\ttype = "snapshot"\n\taddress = "/run/overlaybd-snapshotter/overlaybd.sock"' | sudo tee -a /etc/containerd/config.toml
cat /etc/containerd/config.toml
sudo systemctl restart containerd
sudo containerd -v
sudo ctr plugin ls
echo "[ run container ]"
sudo bin/ctr rpull docker.io/overlaybd/redis:6.2.1_obd
sudo ctr run -d --net-host --snapshotter=overlaybd docker.io/overlaybd/redis:6.2.1_obd test
sudo ctr t ls
echo "[ obdconv ]"
sudo ctr i pull registry.hub.docker.com/library/redis:6.2.1
sudo bin/ctr obdconv registry.hub.docker.com/library/redis:6.2.1 registry.hub.docker.com/overlaybd/redis:6.2.1_obd_new
echo "[ record trace ]"
sudo bin/ctr rpull registry.hub.docker.com/overlaybd/redis:6.2.1_obdconv
# sudo bin/ctr record-trace --disable-network-isolation --time 15 registry.hub.docker.com/overlaybd/redis:6.2.1_obdconv registry.hub.docker.com/overlaybd/redis:6.2.1_obdconv_trace
sudo ctr i ls
touch /tmp/trace_file
sudo ctr run -d --snapshotter=overlaybd --snapshotter-label containerd.io/snapshot/overlaybd/record-trace=yes --snapshotter-label containerd.io/snapshot/overlaybd/record-trace-path=/tmp/trace_file registry.hub.docker.com/overlaybd/redis:6.2.1_obdconv demo
ls -l /tmp/
sleep 15s
sudo ctr t ls
sudo ctr t kill -s 9 demo && sleep 5s && sudo ctr t ls
sudo ctr c rm demo && sudo ctr c ls
sudo ctr i rm registry.hub.docker.com/overlaybd/redis:6.2.1_obdconv
sleep 5s
ls -l /tmp/
sudo cat /var/log/overlaybd.log