This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
72 lines (69 loc) · 1.83 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
@Library("PTCSLibrary") _
podTemplate(label: 'labs-slack-integration-symfony2',
containers: [
containerTemplate(
name: 'php',
image: 'php:7.1',
ttyEnabled: true,
command: '/bin/sh -c',
args: 'cat'
),
containerTemplate(
name: 'docker',
image: 'ptcos/docker-client:latest',
alwaysPullImage: true,
ttyEnabled: true,
command: '/bin/sh -c',
args: 'cat'
),
]
) {
def project = "labs-slack-integration"
def branch = (env.BRANCH_NAME)
def namespace = "labs-slack-integration-master"
def notifySlackChannel = "#jenkins"
try {
node('labs-slack-integration-symfony2') {
stage('Checkout') {
checkout_with_tags()
}
stage('Build') {
container('php') {
withEnv(["COMPOSER_ALLOW_SUPERUSER=1"]) {
sh """
apt-get update
apt-get install -y zlib1g-dev git
docker-php-ext-install zip pdo pdo_mysql bcmath
cp build-config/php.ini /usr/local/etc/php/
cp build-config/php-cli.ini /usr/local/etc/php/
cp .env.jenkins .env
cp .env.jenkins .env.test
curl -sS https://getcomposer.org/installer | php
php composer.phar install
"""
}
}
}
stage('Test') {
container('php') {
sh """
./bin/phpunit
"""
}
}
stage('Package') {
container('docker') {
def published = publishContainerToGcr(project, branch);
toK8sTestEnv() {
sh """
kubectl set image deployment/labs-slack-integration $project=$published.image:$published.tag --namespace=$namespace
"""
}
}
}
}
} catch (e) {
currentBuild.result = "FAILED"
throw e
}
}