Skip to content
代码片段 群组 项目

比较版本

更改显示为版本正在合并到目标版本。了解更多关于比较版本的信息。

来源

选择目标项目
No results found

目标

选择目标项目
  • jihulab/jh-infra/platform/runway/runwayctl
1 个结果
显示更改
源代码提交(2)
include:
- template: Jobs/SAST.latest.gitlab-ci.yml
- template: Jobs/Code-Quality.gitlab-ci.yml
- template: Jobs/Secret-Detection.latest.gitlab-ci.yml
- template: Jobs/License-Scanning.latest.gitlab-ci.yml
- template: Jobs/Dependency-Scanning.latest.gitlab-ci.yml
- template: Jobs/Container-Scanning.latest.gitlab-ci.yml
stages:
- "build"
- "test"
- "release"
- "chatops"
workflow:
name: $PIPELINE_TYPE
rules:
- if: $CI_PIPELINE_SOURCE == "chat"
variables:
PIPELINE_TYPE: chatops
when: always
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "chat"
variables:
PIPELINE_TYPE: release
- if: $CI_MERGE_REQUEST_ID
variables:
PIPELINE_TYPE: dev
variables:
ALPINE_VERSION: 3
GO_VERSION: 1.21.3
GOPROXY: https://goproxy.cn,direct
.build_base: &build_base
image: docker:dind
services:
- docker:dind
build-image:
stage: build
extends:
- .build_base
script:
- echo "$CI_DEPENDENCY_PROXY_PASSWORD" | docker login $CI_DEPENDENCY_PROXY_SERVER --username $CI_DEPENDENCY_PROXY_USER
--password-stdin
- docker build -f Dockerfile
-t ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA}
--build-arg GOPROXY=${GOPROXY}
--build-arg GO_VERSION=${GO_VERSION}
--build-arg ALPINE_VERSION=${ALPINE_VERSION}
--build-arg DEPENDENCY_PROXY_PREFIX=${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/
.
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER
--password-stdin
- docker push ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA}
rules:
- if: $PIPELINE_TYPE == "dev" || $PIPELINE_TYPE == "release"
release-image:
stage: release
extends:
- .build_base
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER
--password-stdin
- docker pull ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA}
- docker tag ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA} $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA} $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
rules:
- if: $PIPELINE_TYPE == "release"
code_quality:
variables:
CODECLIMATE_PREFIX: "registry.gitlab.cn/"
needs: []
container_scanning:
variables:
CS_IMAGE: ${CI_REGISTRY_IMAGE}:preview-${CI_COMMIT_SHORT_SHA}
GIT_STRATEGY: fetch
unit-test:
stage: test
image: golang:${GO_VERSION}
script:
- go install gotest.tools/gotestsum@latest
- gotestsum --junitfile report.xml --format testname
artifacts:
when: always
reports:
junit: report.xml
rules:
- if: $TEST_DISABLED
when: never
- when: always
needs: []
coverage:
stage: test
image: golang:${GO_VERSION}
script:
- go test -v -coverpkg=./... -coverprofile=profile.cov ./...
- go tool cover -func profile.cov
- go install github.com/boumenot/gocover-cobertura@latest
- gocover-cobertura < profile.cov > coverage.xml
coverage: '/total:.*?\d+\.\d+%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules:
- if: $TEST_DISABLED
when: never
- when: always
needs: []
lint:
stage: test
image: registry.jihulab.com/jihulab/jh-infra/release-tools-go/ci-tools/golangci-lint-jq:v1.49.0
script:
- golangci-lint run --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'
artifacts:
reports:
codequality: gl-code-quality-report.json
paths:
- gl-code-quality-report.json
rules:
- if: $CODE_QUALITY_DISABLED
when: never
- when: always
needs: []