-
Notifications
You must be signed in to change notification settings - Fork 21
188 lines (170 loc) · 7.51 KB
/
release.yaml
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: release
on:
push:
tags:
- "v*.*.*"
env:
AGENT_IMAGE: "neondatabase/autoscaler-agent"
SCHED_IMAGE: "neondatabase/autoscale-scheduler"
MONITOR_IMAGE: "neondatabase/vm-monitor"
VM_MONITOR_BRANCH: "main"
KUSTOMIZE_VERSION: "4.5.7"
CONTROLLER_TOOLS_VERSION: "0.10.0"
CODE_GENERATOR_VERSION: "0.25.11"
IMG: "neondatabase/neonvm-controller"
IMG_VXLAN: "neondatabase/neonvm-vxlan-controller"
IMG_RUNNER: "neondatabase/neonvm-runner"
VM_KERNEL_IMAGE: "neondatabase/vm-kernel"
VM_KERNEL_VERSION: "5.15.80"
CLUSTER_AUTOSCALER_IMAGE: "neondatabase/cluster-autoscaler-neonvm"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: get version and git info
id: get_vcs_info
run: |
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo -n "git_info=" >> $GITHUB_OUTPUT
# note: --tags enables matching on lightweight (i.e. not annotated) tags, which normally
# wouldn't be necessary, except that actions/checkout@v3 does weird things to setup the
# repository that means that we actually end up checked out with *just* a lightweight tag
# to the tagged commit.
git describe --tags --long --dirty >> $GITHUB_OUTPUT
- name: get CA base git tag
id: get_ca_tag
run: |
echo -n "ca_git_tag=" >> $GITHUB_OUTPUT
cat cluster-autoscaler/ca.tag >> $GITHUB_OUTPUT
- name: install golang
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: check everything builds
run: go build ./...
- name: build binaries
run: |
make \
VM_MONITOR_IMG=${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }} \
build
- name: docker - install qemu
uses: docker/setup-qemu-action@v2
- name: docker - setup buildx
uses: docker/setup-buildx-action@v2
- name: login to docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
- name: load vm kernel
run: |
docker pull --quiet ${{ env.VM_KERNEL_IMAGE }}:${{ env.VM_KERNEL_VERSION }}
ID=$(docker create ${{ env.VM_KERNEL_IMAGE }}:${{ env.VM_KERNEL_VERSION }} true)
docker cp ${ID}:/vmlinuz neonvm/hack/vmlinuz
docker rm -f ${ID}
- name: build and push runner image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: neonvm/runner/Dockerfile
tags: ${{ env.IMG_RUNNER }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push controller image
uses: docker/build-push-action@v3
with:
build-args: VM_RUNNER_IMAGE=${{ env.IMG_RUNNER }}:${{ steps.get_vcs_info.outputs.version }}
context: .
platforms: linux/amd64
push: true
file: neonvm/Dockerfile
tags: ${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push vxlan controller image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: neonvm/tools/vxlan/Dockerfile
tags: ${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
- name: build and push autoscale-scheduler image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/autoscale-scheduler/Dockerfile
tags: ${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
- name: build and push autoscaler-agent image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/autoscaler-agent/Dockerfile
tags: ${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
- name: build and push vm-monitor image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
file: build/vm-monitor/Dockerfile
tags: ${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args: |
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
BRANCH=${{ env.VM_MONITOR_BRANCH }}
- name: render kubernetes resources
uses: stefanprodan/kube-tools@v1
with:
kustomize: ${{ env.KUSTOMIZE_VERSION }}
command: |
kustomize version --short
cd ${GITHUB_WORKSPACE}/neonvm/config/common/controller && kustomize edit set image controller=${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/neonvm/config/default-vxlan/vxlan-controller && kustomize edit set image vxlan-controller=${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/deploy/scheduler && kustomize edit set image autoscale-scheduler=${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}/deploy/agent && kustomize edit set image autoscaler-agent=${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
cd ${GITHUB_WORKSPACE}
mkdir -p rendered_manifests
kustomize build neonvm/config/default-vxlan/whereabouts > rendered_manifests/whereabouts.yaml
kustomize build neonvm/config/default-vxlan/multus-eks > rendered_manifests/multus-eks.yaml
kustomize build neonvm/config/default-vxlan/multus > rendered_manifests/multus.yaml
kustomize build neonvm/config/default-vxlan > rendered_manifests/neonvm.yaml
kustomize build deploy/scheduler > rendered_manifests/autoscale-scheduler.yaml
kustomize build deploy/agent > rendered_manifests/autoscaler-agent.yaml
# Because we want a docker image for the VM monitor, the easiest way for us to also provide
# a binary is by just extracting it from the container image itself.
- name: extract vm-monitor binary
run: |
ID=$(docker create ${{ env.MONITOR_IMAGE }}:${{ steps.get_vcs_info.outputs.version }})
docker cp $ID:/usr/bin/vm-monitor bin/vm-monitor
docker rm -f $ID
- name: build and push cluster-autoscaler image
uses: docker/build-push-action@v3
with:
tags: ${{ env.CLUSTER_AUTOSCALER_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
context: cluster-autoscaler
push: true
build-args: |
CA_GIT_TAG=${{ steps.get_ca_tag.outputs.ca_git_tag }}
- name: github release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
bin/vm-builder
bin/vm-builder-generic
bin/vm-monitor
rendered_manifests/autoscale-scheduler.yaml
rendered_manifests/autoscaler-agent.yaml
rendered_manifests/neonvm.yaml
rendered_manifests/multus.yaml
rendered_manifests/multus-eks.yaml
rendered_manifests/whereabouts.yaml
deploy/vmscrape.yaml