DevOps

Contain:

  • Jenkins: 代码持续交互生产平台
  • Gitlab: 代码托管平台
  • SonarQube: 代码质量扫描平台
  • Sentry: 错误日志管理平台
  • Yapi: 文档管理平台
  • Docker

Jenkins: 配置

  • 项目:dacheadmin后台java
  1. 源码管理:Git 、url 、选择分支
  2. Build根目录POM文件
  3. post steps:文件上传/发布的服务器
    在这里插入图片描述
  • 项目:dacheadmin后台vue
  1. Add timestamps to the Console Output
  2. Provide Node & npm bin/ folder to PATH
  3. 选择nodejs版本

构建操作

cd ./frontWeb
node -v
npm install -g yarn --registry=https://registry.npm.taobao.org
yarn  -v
yarn install

yarn lint
yarn build

cd ./dist/
tar -zcvf dist.tar.gz *

在这里插入图片描述


  • 项目:mqtt项目同1

在这里插入图片描述


  • 项目:sfc同上
  • 项目:php
    在这里插入图片描述

  • 项目:安卓
    在这里插入图片描述
    在这里插入图片描述
  • 项目:微信小程序ci
    另一种方式:使用pipeline script
pipeline {
	agent any
	// 环境变量 
	environment {
	   GIT_USER_NAME = 'ljie'
	   GIT_USER_EMAIL = 'liujie@guoshikeji.onaliyun.com'
	   GIT_ADDRESS = 'http://ljie:456789123qaz@192.168.0.70:10080/guoshi/wxminiproject.git'
	   BRANCH_NAME = 'Bike'
	}
	// 拉取git代码
	stages {
		stage('git pull') {
			steps {
				git branch: 'Bike', credentialsId: '3fbceb89-c153-4179-8663-c022ea106dfa', url: 'http://192.168.0.70:10080/guoshi/wxminiproject.git'
			}
		}
		// 询问当前版本信息
    	stage('inquirer version') {
    		steps {
    			script {
    				// 读取版本信息
    				def versionJson = readJSON file: './version.config.json', text: ''
    
    				// 设置问题描述
    				def userInput = input(
    					id: 'versionInput',
    					message: '请设置版本信息', 
    					parameters: [
    						[defaultValue: versionJson.version, description: '设置版本号', name: 'VERSION', $class: 'TextParameterDefinition'],
    						[defaultValue: 'jenkins CI的上传试用版为: ' + new Date().format('yyyy-MM-dd HH:mm:ss'), description: '设置版本描述(please use english)', name: 'VERSIONDESC', $class: 'TextParameterDefinition']
    					]
    				)
    
    				// 设置全局变量
    				env.VERSION = userInput.VERSION;
    				env.VERSIONDESC = userInput.VERSIONDESC;
    
    				// 重写本地版本文件(为后续进行版本提交做准备)
    				writeJSON file: './version.config.json', json: [version:  env.VERSION, versionDesc: env.VERSIONDESC], pretty: 4;
    			}
    		}
    	}
        // 构建
        stage('build') {
            steps {
                nodejs('NodeJS 14.3.0') {
                    sh "npm install"
                    sh "npm run build"
                }
            }
        }
    	// 推送版本信息到git仓库
    	stage('push version2git') {
    		steps {
    			sh "git config --local user.name ${GIT_USER_NAME} && git config --local user.email ${GIT_USER_EMAIL}"
    			sh "git add version.config.json"
    			sh "git commit -m 'docs: 更改版本号为${VERSION}'"
    			sh "git checkout ${BRANCH_NAME}"
    			sh "git push ${GIT_ADDRESS}"
    			script {
    	            buildDescription '<img src ="./${BUILD_NUMBER}/execution/node/3/ws/destination.jpg" height="100" width="100">'
    	        }
    		}
    	}
	}
}

选项:使用 Groovy 沙盒 yes

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值