forked from drydockcloud/drupal-acquia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
80 lines (80 loc) · 3.02 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
pipeline {
agent any
environment {
TAG = "${env.BRANCH_NAME}"
}
stages {
stage('Code linting') {
steps {
script {
// Check bash script formatting
sh 'find * -name *.sh -print0 | xargs -n1 -I "{}" -0 docker run -i -v "$(pwd)":/workdir -w /workdir unibeautify/beautysh --files "/workdir/{}"'
// Can't check exit code, so just test if files changed on disk
sh 'if ! git diff-index --quiet HEAD --; then echo "Bash not matching beautysh style"; exit 1; fi'
// Lint bash scripts using shellcheck
sh 'find * -name *.sh -print0 | xargs -n1 -I "{}" -0 docker run -i --rm -v "$PWD":/src koalaman/shellcheck "/src/{}"'
// Lint Dockerfiles using hadolint
sh 'find * -name Dockerfile* -print0 | xargs -n1 -I "{}" -0 docker run -i --rm -v "$PWD":/src hadolint/hadolint hadolint "/src/{}"'
}
}
}
stage('Build') {
parallel {
stage('PHP 7.1') {
steps {
script {
withEnv(['VERSION=7.1']) {
sh 'docker build -t "drydockcloud/drupal-acquia-php-${VERSION}:${TAG}" ./php --build-arg version="${VERSION}"'
}
}
}
}
stage('PHP 7.2') {
steps {
script {
withEnv(['VERSION=7.2']) {
sh 'docker build -t "drydockcloud/drupal-acquia-php-${VERSION}:${TAG}" ./php --build-arg version="${VERSION}"'
}
}
}
}
stage('httpd') {
steps {
script {
sh 'docker build -t "drydockcloud/drupal-acquia-httpd:${TAG}" ./httpd'
}
}
}
stage('MySQL') {
steps {
script {
sh 'docker build -t "drydockcloud/drupal-acquia-mysql:${TAG}" ./mysql'
}
}
}
}
}
stage('Test') {
parallel {
stage('Test PHP 7.1') {
steps {
script {
withEnv(['VERSION=7.1']) {
sh 'test/test.sh'
}
}
}
}
stage('Test PHP 7.2') {
steps {
script {
withEnv(['VERSION=7.1']) {
sh 'test/test.sh'
}
}
}
}
}
}
}
}