forked from JointCloud/JCC-RIP
fix:ci/cd bugs
This commit is contained in:
parent
0e86c0ca5d
commit
594103a2cc
|
@ -0,0 +1,92 @@
|
|||
version: 2
|
||||
name: 腾讯云dev环境
|
||||
description: ""
|
||||
global:
|
||||
concurrent: 1
|
||||
param:
|
||||
- ref: secret_name
|
||||
name: ""
|
||||
value: '"jcce-aliyuncs"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: project_name
|
||||
name: ""
|
||||
value: '"kubex-frontend"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
trigger:
|
||||
webhook: gitlink@1.0.0
|
||||
event:
|
||||
- ref: create_tag
|
||||
ruleset:
|
||||
- param-ref: tag
|
||||
operator: EQ
|
||||
value: '""'
|
||||
ruleset-operator: AND
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
task: start
|
||||
- ref: git_clone_0
|
||||
name: git clone
|
||||
task: git_clone@1.2.6
|
||||
input:
|
||||
ssh_key: ((test.gitlink_sshkey))
|
||||
remote_url: '"git@code.gitlink.org.cn:JCCE/kubex-frontend.git"'
|
||||
ref: '"refs/heads/earth"'
|
||||
commit_id: '""'
|
||||
depth: 1
|
||||
needs:
|
||||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((test.docker_user))
|
||||
docker_password: ((test.docker_password))
|
||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/kubex-frontend"'
|
||||
image_tag: git_clone_0.commit_time
|
||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||
docker_build_path: git_clone_0.git_path
|
||||
workspace: git_clone_0.git_path
|
||||
image_clean: true
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
- shell_0
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- kubectl_deploy_0
|
||||
- ref: kubectl_deploy_0
|
||||
name: kubectl部署资源
|
||||
task: kubectl_deploy@1.1.0
|
||||
input:
|
||||
command: '"apply"'
|
||||
resource_file_path: git_clone_0.git_path + '/deploy/k8s/kubex-frontend.yaml'
|
||||
certificate_authority_data: ((test.k8s_cad))
|
||||
server: '"https://119.45.100.73:6443"'
|
||||
client_certificate_data: ((test.k8s_ccd))
|
||||
client_key_data: ((test.k8s_ckd))
|
||||
hosts: '""'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- ref: shell_0
|
||||
name: shell
|
||||
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||
env:
|
||||
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/kubex-frontend"'
|
||||
IMAGE_TAG: git_clone_0.commit_time
|
||||
SECRET_NAME: global.secret_name
|
||||
PROJECT_NAME: global.project_name
|
||||
PROJECT_PATH: git_clone_0.git_path + '/deploy/k8s/'
|
||||
script:
|
||||
- cd ${PROJECT_PATH}
|
||||
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||
- cat ${PROJECT_NAME}.yaml
|
||||
needs:
|
||||
- git_clone_0
|
|
@ -0,0 +1,92 @@
|
|||
version: 2
|
||||
name: 阿里云test环境
|
||||
description: ""
|
||||
global:
|
||||
concurrent: 1
|
||||
param:
|
||||
- ref: secret_name
|
||||
name: ""
|
||||
value: '"jcce-aliyuncs"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
- ref: project_name
|
||||
name: ""
|
||||
value: '"kubex-frontend"'
|
||||
required: false
|
||||
type: STRING
|
||||
hidden: false
|
||||
trigger:
|
||||
webhook: gitlink@1.0.0
|
||||
event:
|
||||
- ref: create_tag
|
||||
ruleset:
|
||||
- param-ref: tag
|
||||
operator: EQ
|
||||
value: '""'
|
||||
ruleset-operator: AND
|
||||
workflow:
|
||||
- ref: start
|
||||
name: 开始
|
||||
task: start
|
||||
- ref: git_clone_0
|
||||
name: git clone
|
||||
task: git_clone@1.2.6
|
||||
input:
|
||||
ssh_key: ((test.gitlink_sshkey))
|
||||
remote_url: '"git@code.gitlink.org.cn:JCCE/kubex-frontend.git"'
|
||||
ref: '"refs/heads/earth"'
|
||||
commit_id: '""'
|
||||
depth: 1
|
||||
needs:
|
||||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: docker镜像构建
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((test.docker_user))
|
||||
docker_password: ((test.docker_password))
|
||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/kubex-frontend"'
|
||||
image_tag: git_clone_0.commit_time
|
||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||
docker_build_path: git_clone_0.git_path
|
||||
workspace: git_clone_0.git_path
|
||||
image_clean: true
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
- shell_0
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
needs:
|
||||
- kubectl_deploy_0
|
||||
- ref: kubectl_deploy_0
|
||||
name: kubectl部署资源
|
||||
task: kubectl_deploy@1.1.0
|
||||
input:
|
||||
command: '"apply"'
|
||||
resource_file_path: git_clone_0.git_path + '/deploy/k8s/kubex-frontend.yaml'
|
||||
certificate_authority_data: ((test.k8s_cad))
|
||||
server: '"https://47.92.39.128:6443"'
|
||||
client_certificate_data: ((test.k8s_ccd))
|
||||
client_key_data: ((test.k8s_ckd))
|
||||
hosts: '""'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- ref: shell_0
|
||||
name: shell
|
||||
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||
env:
|
||||
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/kubex-frontend"'
|
||||
IMAGE_TAG: git_clone_0.commit_time
|
||||
SECRET_NAME: global.secret_name
|
||||
PROJECT_NAME: global.project_name
|
||||
PROJECT_PATH: git_clone_0.git_path + '/deploy/k8s/'
|
||||
script:
|
||||
- cd ${PROJECT_PATH}
|
||||
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||
- cat ${PROJECT_NAME}.yaml
|
||||
needs:
|
||||
- git_clone_0
|
21
Dockerfile
21
Dockerfile
|
@ -1,5 +1,24 @@
|
|||
FROM node:16.20-alpine3.17 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
COPY deploy/nginx/ /app/
|
||||
RUN npm install --registry=https://registry.npmmirror.com &&\
|
||||
npm run build:prod
|
||||
|
||||
FROM nginx:stable-alpine
|
||||
COPY dist/ /usr/share/nginx/html/jcce
|
||||
WORKDIR /app
|
||||
|
||||
#修改alpine源为上海交通大学
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
apk add --update tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html/jcce
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY deploy/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
|
|
|
@ -17,10 +17,10 @@ spec:
|
|||
k8s-app: kubex-frontend
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: SECRET_NAME
|
||||
- name: secret_name
|
||||
containers:
|
||||
- name: kubex-frontend
|
||||
image: IMAGE_NAME
|
||||
image: image_name
|
||||
resources: {}
|
||||
imagePullPolicy: Always
|
||||
securityContext:
|
||||
|
@ -42,3 +42,22 @@ spec:
|
|||
maxSurge: 25%
|
||||
revisionHistoryLimit: 10
|
||||
progressDeadlineSeconds: 600
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: jcce-system
|
||||
name: kubex-frontend-service
|
||||
labels:
|
||||
k8s-service: kubex-frontend
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kubex-frontend
|
||||
ports:
|
||||
- name: web
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
namespace: jcce-system
|
||||
name: kubex-frontend-service
|
||||
labels:
|
||||
k8s-service: kubex-frontend
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kubex-frontend
|
||||
ports:
|
||||
- name: web
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
Loading…
Reference in New Issue