Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 容器化部署时自动上传插件到应用商店 #8338 #8392

Merged
merged 16 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
7ee58fd
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 7, 2023
41fc16b
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 7, 2023
972e332
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 7, 2023
cc31d15
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 8, 2023
66fd555
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 8, 2023
fcf60d5
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 8, 2023
9c89650
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 8, 2023
b571c6b
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 8, 2023
4cab22e
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 9, 2023
0dc55be
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 9, 2023
765d3a4
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 9, 2023
228ff72
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 20, 2023
be1e7ae
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 20, 2023
9fb6fa6
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 21, 2023
7680268
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 21, 2023
2851f4d
feat: 容器化部署时自动上传插件到应用商店 #8338
stubenhuang Feb 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docker-images/core/ci/dockerfile/backend.bkci.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ ENV LANG="en_US.UTF-8"

RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' > /etc/timezone && \
yum update -y && \
yum install mysql -y && \
yum update -y &&\
yum install -y epel-release &&\
yum install -y mysql &&\
yum install -y redis &&\
yum install -y python3 &&\
pip3 install requests

Expand Down
17 changes: 17 additions & 0 deletions helm-charts/core/ci/build/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ init:
turbo: true
bkrepo: true
defaultImage: true
plugin:
enabled: true
atoms:
- url: https://github.com/TencentBlueKing/ci-checkout/releases/download/v2.0.12/checkout.zip
code: checkout
- url: https://github.com/TencentBlueKing/ci-run/releases/download/v1.0.2/run-v1.0.2.zip
code: run
- url: https://github.com/TencentBlueKing/ci-SubPipelineExec/releases/download/v1.0.4/ci-SubPipelineExec.zip
code: SubPipelineExec
- url: https://github.com/TencentBlueKing/ci-uploadArtifact/releases/download/v2.0.1/uploadArtifact_en.zip
code: uploadArtifact
- url: https://github.com/TencentBlueKing/ci-uploadReport/releases/download/v1.0.1/uploadReport_en.zip
code: uploadReport
- url: https://github.com/TencentBlueKing/ci-AcrossProjectDistribution/releases/download/v1.1.1/AcrossProjectDistribution_en.zip
code: AcrossProjectDistribution
- url: https://github.com/TencentBlueKing/ci-downloadArtifact/releases/download/v1.0.2/downloadArtifact_en.zip
code: downloadArtifact

# 多集群开关
multiCluster:
Expand Down
18 changes: 18 additions & 0 deletions helm-charts/core/ci/templates/configmap/monitoring-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#monitoring configmap
{{ if .Values.configmap.enabled -}}
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "bkci.names.fullname" . }}-monitoring
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: monitoring
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
data:
application.yml: |-
{{- include "bkci.monitoring.yaml" . | nindent 4 -}}
{{- end -}}
13 changes: 12 additions & 1 deletion helm-charts/core/ci/templates/init/init.defaultImages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ spec:
- "/bin/bash"
- "-c"
- |
sleep 240s;
services="store project"
for service in $services
do
until curl --connect-timeout 3 -m 1 -s "http://{{ include "bkci.names.fullname" . }}-$service.{{ .Release.Namespace }}.svc.cluster.local" > nohup
do
echo "waiting for {{ include "bkci.names.fullname" . }}-$service";
sleep 2;
done
echo "{{ include "bkci.names.fullname" . }}-$service is available";
done

echo "{{ include "bkci.names.fullname" . }}-store is available";
curl "http://{{ include "bkci.names.fullname" . }}-store.{{ .Release.Namespace }}.svc.cluster.local/api/op/market/image/init" -X POST
restartPolicy: OnFailure
{{- end -}}
65 changes: 65 additions & 0 deletions helm-charts/core/ci/templates/init/init.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 初始化商店插件
{{ if .Values.init.plugin.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "bkci.names.fullname" . }}-init-plugin
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: init-plugin
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
template:
metadata:
labels: {{- include "bkci.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: init-plugin
spec:
containers:
- name: init-plugin
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" $) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
workingDir: /data/workspace/
{{ $mysqlData := split ":" (include "bkci.mysqlAddr" .) }}
command:
- "/bin/bash"
- "-c"
- |
services="store artifactory"
for service in $services
do
until curl --connect-timeout 3 -m 1 -s "http://{{ include "bkci.names.fullname" . }}-$service.{{ .Release.Namespace }}.svc.cluster.local" > nohup
do
echo "waiting for {{ include "bkci.names.fullname" . }}-$service";
sleep 2;
done
echo "{{ include "bkci.names.fullname" . }}-$service is available";
done

touch atom.sql
touch atom.redis

{{ range .Values.init.plugin.atoms }}
atom_code={{ .code }}
check_atom_url=http://{{ include "bkci.names.fullname" $ }}-store.{{ $.Release.Namespace }}.svc.cluster.local/api/service/pipeline/atom/codes/$atom_code/versions/1.0.0
check_atom_response=$(curl -s $check_atom_url)
if [ -z $(echo $check_atom_response | grep -o "atomCode") ]; then
atom_url={{ .url }}
atom_file=${atom_code}.zip
curl -s $atom_url -o $atom_file -L
if [ $? -eq 0 ]; then
curl "http://{{ include "bkci.names.fullname" $ }}-store.{{ $.Release.Namespace }}.svc.cluster.local/api/op/pipeline/atom/deploy" -H "X-DEVOPS-UID: admin" -F atomCode=$atom_code -F file=@$atom_file
fi
else
echo "atomCode exists"
fi

echo 'UPDATE devops_ci_store.T_ATOM SET DEFAULT_FLAG=true WHERE ATOM_CODE="$atom_code"' >> atom.sql
echo 'SADD STORE_PUBLIC_FLAG_KEY:ATOM $atom_code' >> atom.redis
{{ end }}

mysql -u{{- include "bkci.mysqlUsername" . }} -p{{- include "bkci.mysqlPassword" . }} -h{{ $mysqlData._0 }} -P{{ $mysqlData._1 }} < atom.sql
redis-cli -h {{ include "bkci.redisHost" . }} -a {{ include "bkci.redisPassword" . }} -p {{ include "bkci.redisPort" . }} < atom.redis
restartPolicy: OnFailure
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
api(project(":core:common:common-client"))
api(project(":core:common:common-auth:common-auth-api"))
api(project(":core:common:common-auth:common-auth-v3"))
api(project(":core:common:common-auth:common-auth-mock"))
api(project(":core:project:api-project-sample"))
api(project(":core:process:api-process"))
api(project(":core:repository:api-repository"))
Expand Down
Loading