Skip to content
Clone

chore(deploy): package the actions engine image and runtime URL

ZhenYi committed
parent d8b82ba commit 159a1eb Browse files

6 files changed

+48 −2

File tree 6
Modified chart/templates/_helpers.tpl View chart/templates/_helpers.tpl
@@ -45,6 +45,11 @@
4545{{- printf "%s:%s" .Values.image.repository $tag -}}
4646{{- end -}}
4747
48{{- define "gitdata.actionsImage" -}}
49{{- $tag := .Values.runner.actionsImage.tag | default .Values.image.tag | default .Chart.AppVersion -}}
50{{- printf "%s:%s" .Values.runner.actionsImage.repository $tag -}}
51{{- end -}}
52
4853{{- define "gitdata.secretName" -}}
4954{{- if .Values.secret.existingSecret -}}
5055{{- .Values.secret.existingSecret -}}
Modified chart/templates/runner.yaml View chart/templates/runner.yaml
@@ -24,6 +24,21 @@
2424 terminationGracePeriodSeconds: 300
2525 securityContext:
2626 {{- toYaml .Values.podSecurityContext | nindent 8 }}
27 initContainers:
28 - name: actions-runtime
29 image: {{ include "gitdata.actionsImage" . }}
30 imagePullPolicy: {{ .Values.runner.actionsImage.pullPolicy }}
31 command: ["sh", "-c"]
32 args:
33 - |
34 mkdir -p /bundle/bin /bundle/node
35 cp /usr/local/bin/gitdata-actions-engine /bundle/bin/
36 cp -a /opt/gitdata/node/. /bundle/node/
37 securityContext:
38 {{- toYaml .Values.securityContext | nindent 12 }}
39 volumeMounts:
40 - name: actions-runtime
41 mountPath: /bundle
2742 containers:
2843 - name: runner
2944 image: {{ include "gitdata.image" . }}
@@ -52,16 +67,26 @@
5267 value: /var/lib/gitdata-runner/credential
5368 - name: APP_RUNNER__DOCKER_ENABLED
5469 value: {{ .Values.runner.dockerEnabled | quote }}
70 - name: APP_RUNNER__ACTIONS_ENGINE_BINARY
71 value: /opt/gitdata/actions/bin/gitdata-actions-engine
72 - name: APP_RUNNER__ACTIONS_CACHE_DIR
73 value: /var/lib/gitdata-runner/actions
5574 {{- with .Values.runner.extraEnv }}
5675 {{- toYaml . | nindent 12 }}
5776 {{- end }}
5877 securityContext:
59 {{- toYaml .Values.securityContext . | nindent 12 }}
78 {{- toYaml .Values.securityContext | nindent 12 }}
6079 resources:
6180 {{- toYaml .Values.runner.resources | nindent 12 }}
6281 volumeMounts:
6382 - name: workspace
6483 mountPath: /var/lib/gitdata-runner
84 - name: actions-runtime
85 mountPath: /opt/gitdata/actions
86 readOnly: true
87 - name: actions-runtime
88 mountPath: /opt/gitdata/node
89 readOnly: true
6590 {{- if .Values.runner.dockerEnabled }}
6691 - name: docker-sock
6792 mountPath: /var/run/docker.sock
@@ -69,6 +94,8 @@
6994 volumes:
7095 - name: workspace
7196 emptyDir: {}
97 - name: actions-runtime
98 emptyDir: {}
7299 {{- if .Values.runner.dockerEnabled }}
73100 - name: docker-sock
74101 hostPath:
Modified chart/templates/webhook.yaml View chart/templates/webhook.yaml
@@ -44,6 +44,8 @@
4444 value: {{ .Values.webhook.port | quote }}
4545 - name: APP_WEBHOOK__PUBLIC_BASE_URL
4646 value: {{ default (printf "https://%s" .Values.webhook.ingress.host) .Values.config.env.APP_WEBHOOK__PUBLIC_BASE_URL | quote }}
47 - name: APP_CI__RUNTIME_BASE_URL
48 value: {{ default (printf "http://%s-webhook:%d" (include "gitdata.fullname" .) .Values.webhook.port) .Values.config.env.APP_CI__RUNTIME_BASE_URL | quote }}
4749 {{- with .Values.webhook.extraEnv }}
4850 {{- toYaml . | nindent 12 }}
4951 {{- end }}
Modified chart/values.yaml View chart/values.yaml
@@ -317,6 +317,10 @@
317317runner:
318318 # 默认关闭:多数部署在自有机器上运行 runner 二进制
319319 enabled: false
320 actionsImage:
321 repository: gitdata-act
322 tag: ""
323 pullPolicy: IfNotPresent
320324 replicaCount: 1
321325 labels: ["self-hosted", "docker"]
322326 capacity: 1
Modified deploy/values/prod.yaml View deploy/values/prod.yaml
@@ -207,3 +207,7 @@
207207
208208runner:
209209 enabled: false
210 actionsImage:
211 repository: harbor.gitdata.me/app/gitdata-act
212 tag: ""
213 pullPolicy: IfNotPresent
Modified Dockerfile View Dockerfile
@@ -1,5 +1,5 @@
11# syntax=docker/dockerfile:1
2FROM rust:1-bookworm AS builder
2FROM rust:1-bookworm AS rust-deps
33
44RUN apt-get update && apt-get install -y --no-install-recommends \
55 pkg-config \
@@ -19,6 +19,9 @@
1919WORKDIR /build
2020
2121COPY Cargo.toml Cargo.lock ./
22
23
24FROM rust-deps AS builder
2225COPY lib ./lib
2326COPY app ./app
2427COPY web ./web
@@ -60,6 +63,7 @@
6063
6164COPY --chown=gitdata:gitdata config/default.toml config/default.toml
6265COPY --from=builder /out/apihost /out/githost /out/synchost /out/mails /out/migrate /out/openapi /out/im /out/adminhost /out/webhook /out/runner /out/aihost /usr/local/bin/
66
6367COPY --from=builder /out/docker /usr/local/bin/docker
6468
6569USER gitdata