1 |
|
测试人员的技术博客;交流请加QQ群:549576208
1 |
|
1 | node { |
Jenkins代码详见:
https://gitee.com/roclli/pp4-3-dockerfile.git
Jenkinsfile内容为:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16pipeline {
// agent { dockerfile true }
agent {
dockerfile {
additionalBuildArgs '-t node-svn:7-alpine'
}
}
stages {
stage('Test') {
steps {
sh 'node --version'
sh 'svn --version'
}
}
}
}
Dockerfile1
2FROM node:7-alpine
RUN apk add -U subversion
1 | node { |
Jenkins代码详见:
https://gitee.com/roclli/pp4-2-multip-container
Jenkinsfile内容为:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21pipeline {
agent none
stages {
stage('Back-end') {
agent {
docker { image 'maven:3-alpine' }
}
steps {
sh 'mvn --version'
}
}
stage('Front-end') {
agent {
docker { image 'node:7-alpine' }
}
steps {
sh 'node --version'
}
}
}
}
1 | node { |
Jenkins代码详见:
https://gitee.com/roclli/pp4-1-cache-data.git
Jenkinsfile内容为:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20pipeline {
agent {
/* Requires the Docker Pipeline plugin to be installed
注意:正常情况下应该使用$HOME/.m2
我本地用的是用的是特殊的maven
docker.image('maven:3-alpine').inside('-v $HOME/.m2:/root/.m2') {
*/
docker {
image 'maven:3-alpine'
args '-v $M2_HOME/repo:/root/.m2'
}
}
stages {
stage('Build') {
steps {
sh 'mvn -D$HOME/.m2=/root/.m2 -DskipTests clean package'
}
}
}
}
1 | node { |
Jenkins代码详见:
https://gitee.com/roclli/pp4-0-custom-exec-env
Jenkinsfile内容为:1
2
3
4
5
6
7
8
9
10
11
12
13
14#!/usr/bing/env groovy
pipeline {
agent {
docker { image 'node:7-alpine' }
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
Jenkins代码详见:
https://gitee.com/roclli/simple-maven-project-with-tests.git
Jenkinsfile内容为:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#!/usr/bing/env groovy
node('master') {
echo "----------------------start git url----------------------"
checkout scm
// git url: 'https://gitee.com/roclli/simple-maven-project-with-tests.git'
echo "----------------------version()----------------------"
def v = version()
if (v) {
echo "---Building version ${v}---"
}
def mvnHome = tool 'M3'
echo "----------------------mvn -B -D verify----------------------"
sh "${mvnHome}/bin/mvn -B -Dmaven.test.failure.ignore verify"
}
def version() {
def matcher = readFile('pom.xml') =~ '<version>(.+)</version>'
echo "---${matcher[0][1]}---" //---1.0-SNAPSHOT---
echo "---${matcher[0][2]}---" //---null---
echo "---${matcher[0][3]}---" //---null---
echo "---${matcher[1][1]}---" //---2.18.1---
echo "---${matcher[1][2]}---" //---null---
echo "---${matcher[1][3]}---" //---null---
echo "---${matcher[2][1]}---" //---4.11---
echo "---${matcher[2][2]}---" //---null---
echo "---${matcher[2][3]}---" //---null---
matcher ? matcher[0][1] : null
}
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true