Compare commits

..

1 Commits

Author SHA1 Message Date
杨永强
f43590c7db Configure SAST in .gitlab-ci.yml, creating this file if it does not already exist 2021-10-27 03:56:01 +00:00

View File

@@ -1,71 +1,25 @@
#定义变量
variables:
#获取当前时间戳
DATE: $(date +%Y%m%d)
#定义克隆的路径 $CI_BUILDS_DIR 为 runners.builds_dir 设置的路径
CLONE_NO_TIME_PATH: $CI_BUILDS_DIR/gap_tsg_api1
#定义克隆的路径 $CI_BUILDS_DIR 为 runners.builds_dir 设置的路径
GIT_CLONE_PATH: $CI_BUILDS_DIR/gap_tsg_api1$DATE
#git ssh 地址
GITLAB_SSH: git@git.mesalab.cn:yangyongqiang/yyq_test.git
# 指定git获取代码的方式clone,fetch,none
GIT_STRATEGY: clone
#在作业之前执行的脚本或命令
before_script:
- echo "环境部署操作"
- echo $DATE
# 创建对应目录
- mkdir -p $CLONE_NO_TIME_PATH$(date +%Y%m%d)
- cd $CLONE_NO_TIME_PATH$(date +%Y%m%d)
- pwd
#在作业之后执行的脚本或命令
after_script:
# - echo "克隆完成"
#配置目录的用户权限
# - chown root $GIT_CLONE_PATH
# 全局定义流水线阶段pipeline
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- build
# develop_build:
# stage: build
# #需要执行的shell脚本
# script:
# - echo "开发服务器环境配置"
# - if [ ! -d ".git" ]; then
# - git clone -b master $GITLAB_SSH $GIT_CLONE_PATH --depth 1
# - else
# - git stash
# - fi
# - git pull
# only:
# # 指定分支
# - develop
# tags:
# # 指定执行作业的runner
# - develop
master_build:
stage: build
script:
- echo $DATE
- echo "正式服务器环境配置"
- if [ ! -d ".git" ]; then
- git clone -b master $GITLAB_SSH $CLONE_NO_TIME_PATH$(date +%Y%m%d) --depth 1
- else
- git stash
- fi
- git pull origin master
- echo $DATE
only:
- master
tags:
- master
- build
- test
- deploy
- review
- dast
- staging
- canary
- production
- incremental rollout 10%
- incremental rollout 25%
- incremental rollout 50%
- incremental rollout 100%
- performance
- cleanup
sast:
stage: test
include:
- template: Auto-DevOps.gitlab-ci.yml