forked from kernelci/kernelci-core
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (152 loc) · 6.2 KB
/
docker_images.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
name: 'Reusable workflow compiler and misc docker images build'
on:
workflow_call:
inputs:
GIT_OWNER:
type: string
description: 'Repo (owner), for ex: kernelci/kernelci-core owner is kernelci'
required: true
default: 'kernelci'
GIT_BRANCH:
type: string
description: 'Branch'
required: true
default: 'main'
env:
USER_GIT_OWNER: ${{ inputs.GIT_OWNER }}
USER_GIT_BRANCH: ${{ inputs.GIT_BRANCH }}
jobs:
docker-compiler-build:
strategy:
fail-fast: false
matrix:
kciarch: [ 'arc', 'arm', 'armv5', 'arm64', 'x86', 'mips', 'riscv64' ]
kcicmd: [ 'clang-15 kselftest kernelci',
'clang-17 kselftest kernelci',
'gcc-12 kselftest kernelci'
]
# only selected people can trigger this job
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor)
runs-on: ubuntu-22.04
environment: deploydocker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.USER_GIT_OWNER }}/kernelci-core
ref: ${{ env.USER_GIT_BRANCH }}
submodules: recursive
fetch-depth: 0
path: kernelci-core
- name: Prepare necessary tools
run: |
sudo apt-get update
sudo apt-get remove containerd.io
sudo apt-get install -y python3-pip git docker.io python3-docker
pip3 install --upgrade pip
cd kernelci-core
python3 -m pip install '.[dev]'
sudo cp -R config /etc/kernelci/
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build base kernelci docker image for main branch
if: ${{ env.USER_GIT_BRANCH == 'main' }}
run: |
cd kernelci-core
export core_rev=$(git rev-parse HEAD)
export core_url=$(git remote get-url origin)
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/kernelci/ --build-arg core_url=$core_url"
./kci docker $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
- name: build base kernelci docker image for other branches
if: ${{ env.USER_GIT_BRANCH != 'main' }}
run: |
cd kernelci-core
export core_rev=$(git rev-parse HEAD)
export core_url=$(git remote get-url origin)
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/kernelci/staging- --build-arg core_url=$core_url"
./kci docker $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
docker-misc-build:
strategy:
fail-fast: false
matrix:
kcicmd: [ 'gcc-12 kunit kernelci --arch x86',
'rustc-1.74 kselftest kernelci --arch x86',
'rustc-1.75 kselftest kernelci --arch x86',
'kernelci',
'kernelci api',
'kernelci pipeline',
'kernelci lava-callback',
'k8s kernelci',
'qemu',
]
# only selected people can trigger this job
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor)
runs-on: ubuntu-22.04
environment: deploydocker
steps:
- name: Checkout kernelci-core
uses: actions/checkout@v4
with:
repository: ${{ env.USER_GIT_OWNER }}/kernelci-core
ref: ${{ env.USER_GIT_BRANCH }}
fetch-depth: 0
path: kernelci-core
- name: Checkout kernelci-pipeline
uses: actions/checkout@v4
with:
repository: ${{ env.USER_GIT_OWNER }}/kernelci-pipeline
ref: ${{ env.USER_GIT_BRANCH }}
fetch-depth: 0
path: kernelci-pipeline
- name: Checkout kernelci-api
uses: actions/checkout@v4
with:
repository: ${{ env.USER_GIT_OWNER }}/kernelci-api
ref: ${{ env.USER_GIT_BRANCH }}
fetch-depth: 0
path: kernelci-api
- name: Prepare necessary tools
run: |
sudo apt-get update
sudo apt-get remove containerd.io
sudo apt-get install -y python3-pip git docker.io python3-docker
pip3 install --upgrade pip
cd kernelci-core
python3 -m pip install '.[dev]'
sudo cp -R config /etc/kernelci/
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: kernelci
password: ${{ secrets.GITHUB_TOKEN }}
- name: build base kernelci docker image for main branch
if: ${{ env.USER_GIT_BRANCH == 'main' }}
run: |
cd kernelci-core
core_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-api
api_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-pipeline
pipeline_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-core
rev_arg="--build-arg core_rev=$core_rev --build-arg api_rev=$api_rev --build-arg pipeline_rev=$pipeline_rev"
kci_arg="build --push $rev_arg --prefix=ghcr.io/kernelci/"
./kci docker $kci_arg ${{ matrix.kcicmd }}
- name: build base kernelci docker image for other branches
if: ${{ env.USER_GIT_BRANCH != 'main' }}
run: |
cd kernelci-core
core_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-api
api_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-pipeline
pipeline_rev=$(git show --pretty=format:%H -s origin/${{ env.USER_GIT_BRANCH }})
cd ../kernelci-core
rev_arg="--build-arg core_rev=$core_rev --build-arg api_rev=$api_rev --build-arg pipeline_rev=$pipeline_rev"
kci_arg="build --push $rev_arg --prefix=ghcr.io/kernelci/staging-"
./kci docker $kci_arg ${{ matrix.kcicmd }}