From 508cefc16385c4cac016fb461f88c137abb98e06 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Mon, 15 May 2023 12:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9docker=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml~gitlab_feature_fix-cert | 91 -------------------------- build/cmd/Dockerfile | 2 + build/resources/Dockerfile | 1 + build/resources/join.sh | 2 +- 4 files changed, 4 insertions(+), 92 deletions(-) delete mode 100644 .gitlab-ci.yml~gitlab_feature_fix-cert diff --git a/.gitlab-ci.yml~gitlab_feature_fix-cert b/.gitlab-ci.yml~gitlab_feature_fix-cert deleted file mode 100644 index 906d9b9a..00000000 --- a/.gitlab-ci.yml~gitlab_feature_fix-cert +++ /dev/null @@ -1,91 +0,0 @@ -stages: - - notice - - check - - build - - deploy - - publish - -variables: - PATH: /usr/local/sonar-scanner/sonar-scanner-4.4.0.2170-linux/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/data/golang/go/bin/:/root/go/bin - GOROOT: /data/golang/go - GOPROXY: https://goproxy.cn - APP: apinto - VERSION: $CI_COMMIT_SHORT_SHA - SAVE_DIR: /opt/apinto - APP_PRE: ${APP}-${VERSION} - -default: - before_script: - - pwd - -merge-informer: # 飞书回调 - stage: notice - variables: - DIFF_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID/diffs" - rules: - - if: $CI_PIPELINE_SOURCE=="merge_request_event" - script: - - rm -rf out/apinto-* - - | - curl -X POST -H "Content-Type: application/json" \ - -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \ - https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c -checker: - stage: check - rules: - - if: $CI_COMMIT_BRANCH=="develop" - script: - - set +e - - go mod tidy - - go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.data -timeout=1m ./... - - golangci-lint run --timeout=3m --out-format checkstyle --issues-exit-code 0 ./... > report.xml - - sonar-scanner -builder: - stage: build - rules: - - if: $CI_COMMIT_BRANCH=="develop" - when: on_success - - if: $CI_COMMIT_BRANCH=="test" - when: on_success - script: - - sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod - - go mod tidy - - cd build/cmd && ./package.sh $VERSION - cache: - paths: - - out/ -deployer: - stage: deploy - rules: - - if: $CI_COMMIT_BRANCH=="develop" - variables: - DEPLOY_SERVER: root@172.18.189.43 - DEPLOY_DESC: "DEV 环境" - - if: $CI_COMMIT_BRANCH=="test" - variables: - DEPLOY_SERVER: root@172.18.65.60 - DEPLOY_DESC: "TEST 环境" - dependencies: - - builder - script: - - set -e - - scp out/${APP_PRE}.linux.x64.tar.gz ${DEPLOY_SERVER}:${SAVE_DIR} - - ssh ${DEPLOY_SERVER} "set -e; cd ${SAVE_DIR}; mkdir -p ${APP_PRE};tar -zxvf ${APP_PRE}.linux.x64.tar.gz -C ${APP_PRE};cd ${APP_PRE}/${APP}; ./install.sh upgrade;cd ${SAVE_DIR}; ./clean.sh ${APP_PRE}" - - | - curl -X POST -H "Content-Type: application/json" \ - -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:apinto\\n环境:${DEPLOY_DESC}\\n更新部署完成.\"}}" \ - https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c - when: on_success - cache: - paths: - - out/ -publisher: - stage: publish - only: - - tags - script: - - sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod - - go mod tidy - - GOVERSION=$(go version) EoscVersion=$(sed -n 's/.*eosc v/v/p' go.mod) goreleaser release --skip-validate --rm-dist --skip-publish - - mkdir -p /data/pkg/apinto/${CI_COMMIT_TAG} - - cp -if dist/*.tar.gz /data/pkg/apinto/${CI_COMMIT_TAG} \ No newline at end of file diff --git a/build/cmd/Dockerfile b/build/cmd/Dockerfile index 70d618f8..e1b8faed 100644 --- a/build/cmd/Dockerfile +++ b/build/cmd/Dockerfile @@ -3,6 +3,8 @@ FROM centos:7.9.2009 MAINTAINER eolink +RUN yum install -y wget && wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -ivh epel-release-latest-7.noarch.rpm && yum install -y jq + #声明端口 EXPOSE 9400 8099 diff --git a/build/resources/Dockerfile b/build/resources/Dockerfile index 7a72c74a..f1beafab 100644 --- a/build/resources/Dockerfile +++ b/build/resources/Dockerfile @@ -3,6 +3,7 @@ FROM centos:7.9.2009 MAINTAINER eolink +RUN yum install -y wget && wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -ivh epel-release-latest-7.noarch.rpm && yum install -y jq #声明端口 EXPOSE 9400 8099 diff --git a/build/resources/join.sh b/build/resources/join.sh index 78a4f7dd..6c9ccd96 100755 --- a/build/resources/join.sh +++ b/build/resources/join.sh @@ -4,7 +4,7 @@ set -e sleep 5s #Gets the IP addresses of all pods under the target service -response=$(curl -s GET "https://kubernetes.default.svc:443/api/v1/namespaces/${SVC_NAMESPACE}/endpoints/${SVC_NAME}" -k -H "Authorization: ${SVC_TOKEN}") +response=$(curl -s "https://kubernetes.default.svc:443/api/v1/namespaces/${SVC_NAMESPACE}/endpoints/${SVC_NAME}" -k -H "Authorization: Bearer ${SVC_TOKEN}") #Determines whether the request was successful if [[ ${response} =~ 'Failure' ]]