Adding jenkinsfile for new build server.
Этот коммит содержится в:
146
build/Jenkinsfile
поставляемый
Обычный файл
146
build/Jenkinsfile
поставляемый
Обычный файл
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
podTemplate(label: 'jenkins-slave',
|
||||
containers: [
|
||||
containerTemplate(
|
||||
name: 'mattermost-mysql',
|
||||
image: 'mysql:5.7',
|
||||
alwaysPullImage: false,
|
||||
resourceRequestCpu: '1000m',
|
||||
resourceLimitCpu: '2000m',
|
||||
resourceRequestMemory: '2Gi',
|
||||
resourceLimitMemory: '4Gi',
|
||||
ports: [portMapping(name: 'mysql', containerPort: 3306, hostPort: 3306)],
|
||||
envVars: [envVar(key: 'MYSQL_ROOT_PASSWORD', value: 'mostest'), envVar(key: 'MYSQL_USER', value: 'mmuser'), envVar(key: 'MYSQL_PASSWORD', value: 'mostest'), envVar(key: 'MYSQL_DATABASE', value: 'mattermost_test')]
|
||||
),
|
||||
containerTemplate(
|
||||
name: 'golang',
|
||||
image: 'golang:1.8',
|
||||
ttyEnabled: true,
|
||||
command: 'cat',
|
||||
alwaysPullImage: false,
|
||||
resourceRequestCpu: '1000m',
|
||||
resourceLimitCpu: '2000m',
|
||||
resourceRequestMemory: '2Gi',
|
||||
resourceLimitMemory: '4Gi'
|
||||
),
|
||||
containerTemplate(
|
||||
name: 'mattermost-inbucket',
|
||||
image: 'jhillyerd/inbucket:latest',
|
||||
ports: [portMapping(name: 'inbucket', hostPost: 10025, containerPort: 10025)],
|
||||
resourceRequestCpu: '250m',
|
||||
resourceLimitCpu: '250m',
|
||||
resourceRequestMemory: '256Mi',
|
||||
resourceLimitMemory: '256Mi'
|
||||
),
|
||||
containerTemplate(
|
||||
name: 'mattermost-openldap',
|
||||
image: 'osixia/openldap:1.1.9',
|
||||
alwaysPullImage: true,
|
||||
ports: [portMapping(name: 'openldap1', hostPost: 389, containerPort: 389), portMapping(name: 'openldap2', hostPost: 636, containerPort: 636)],
|
||||
envVars: [envVar(key: 'LDAP_TLS_VERIFY_CLIENT', value: 'never'), envVar(key: 'LDAP_ORGANISATION', value: 'Mattermost Test'), envVar(key: 'LDAP_DOMAIN', value: 'mm.test.com'), envVar(key: 'LDAP_ADMIN_PASSWORD', value: 'mostest')],
|
||||
args: "--loglevel debug",
|
||||
resourceRequestCpu: '250m',
|
||||
resourceLimitCpu: '250m',
|
||||
resourceRequestMemory: '256Mi',
|
||||
resourceLimitMemory: '256Mi'
|
||||
),
|
||||
containerTemplate(
|
||||
name: 'mattermost-redis',
|
||||
image: 'redis',
|
||||
ports: [portMapping(name: 'redis', hostPost: 6379, containerPort: 6379)],
|
||||
resourceRequestCpu: '250m',
|
||||
resourceLimitCpu: '250m',
|
||||
resourceRequestMemory: '256Mi',
|
||||
resourceLimitMemory: '256Mi'
|
||||
),/*
|
||||
containerTemplate(
|
||||
name: 'mattermost-elasticsearch',
|
||||
image: 'grundleborg/elasticsearch:latest',
|
||||
ports: [portMapping(name: 'elasticsearch', hostPost: 9200, containerPort: 9200)],
|
||||
envVars: [envVar(key: 'http.host', value: '0.0.0.0'), envVar(key: 'transport.host', value: '127.0.0.1'), envVar(key: 'ES_JAVA_OPTS', value: '-Xmx250m -Xmx250m')],
|
||||
resourceRequestCpu: '250m',
|
||||
resourceLimitCpu: '250m',
|
||||
resourceRequestMemory: '256Mi',
|
||||
resourceLimitMemory: '256Mi'
|
||||
),*/
|
||||
containerTemplate(
|
||||
name: 'mattermost-node',
|
||||
image: 'node',
|
||||
ttyEnabled: true,
|
||||
command: 'cat',
|
||||
alwaysPullImage: false,
|
||||
resourceRequestCpu: '1000m',
|
||||
resourceLimitCpu: '2000m',
|
||||
resourceRequestMemory: '2Gi',
|
||||
resourceLimitMemory: '4Gi'
|
||||
)
|
||||
]
|
||||
)
|
||||
{
|
||||
node('jenkins-slave') {
|
||||
stage('Checkout') {
|
||||
container('golang') {
|
||||
// Checkout platform
|
||||
dir('platform') {
|
||||
git branch: env.BRANCH_NAME, credentialsId: 'a8f2d76b-8a29-4525-b57a-eb0447d7779c', url: 'https://github.com/mattermost/platform.git'
|
||||
}
|
||||
|
||||
// Checkout enterprise
|
||||
dir('enterprise') {
|
||||
git branch: 'master', credentialsId: 'a8f2d76b-8a29-4525-b57a-eb0447d7779c', url: 'https://github.com/mattermost/enterprise.git'
|
||||
sh "git checkout ${env.BRANCH_NAME} || echo 'NO EE BRANCH'"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Prep Environment') {
|
||||
container('golang') {
|
||||
// Link up the code to GOPATH.
|
||||
sh 'mkdir -p /go/src/github.com/mattermost'
|
||||
sh 'ln -s `pwd`/platform /go/src/github.com/mattermost/platform'
|
||||
sh 'ln -s `pwd`/enterprise /go/src/github.com/mattermost/enterprise'
|
||||
|
||||
// Install build deps
|
||||
sh 'apt-get update && apt-get install zip -y'
|
||||
|
||||
// Modify config to run on jenkins
|
||||
sh 'mv /go/src/github.com/mattermost/platform/config/default.json /go/src/github.com/mattermost/platform/config/config.json'
|
||||
sh 'cd /go/src/github.com/mattermost/platform && sed -i \'s/dockerhost/localhost/g\' config/config.json'
|
||||
sh 'cd /go/src/github.com/mattermost/platform && sed -i \'s/2500/10025/g\' config/config.json'
|
||||
}
|
||||
|
||||
// Setup openldap container
|
||||
/*container('mattermost-openldap') {
|
||||
sh 'echo \\"dn: ou=testusers,dc=mm,dc=test,dc=com\\" >> user1'
|
||||
sh 'echo \\"objectclass: organizationalunit\\" >> user1'
|
||||
sh 'ldapadd -x -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -w mostest -f user1'
|
||||
sh 'echo -e \\"dn: uid=test.one,ou=testusers,dc=mm,dc=test,dc=com\\nobjectclass: iNetOrgPerson\\nsn: User\\ncn: Test1\\nmail: success+testone@simulator.amazonses.com\\" | ldapadd -x -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -w mostest'
|
||||
sh 'ldappasswd -s Password1 -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -x \\"uid=test.one,ou=testusers,dc=mm,dc=test,dc=com\\" -w mostest'
|
||||
sh 'echo -e \\"dn: uid=test.two,ou=testusers,dc=mm,dc=test,dc=com\\nobjectclass: iNetOrgPerson\\nsn: User\\ncn: Test2\\nmail: success+testtwo@simulator.amazonses.com\\" | ldapadd -x -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -w mostest'
|
||||
sh 'ldappasswd -s Password1 -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -x \\"uid=test.two,ou=testusers,dc=mm,dc=test,dc=com\\" -w mostest'
|
||||
sh 'echo -e \\"dn: cn=tgroup,ou=testusers,dc=mm,dc=test,dc=com\\nobjectclass: groupOfUniqueNames\\nuniqueMember: uid=test.one,ou=testusers,dc=mm,dc=test,dc=com\\" | ldapadd -x -D \\"cn=admin,dc=mm,dc=test,dc=com\\" -w mostest'
|
||||
}*/
|
||||
}
|
||||
stage('Style Checks') {
|
||||
container('golang') {
|
||||
sh 'cd /go/src/github.com/mattermost/platform && make check-style BUILD_NUMBER=$BUILD_NUMBER'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
container('golang') {
|
||||
sh 'cd /go/src/github.com/mattermost/platform && make build BUILD_NUMBER=$BUILD_NUMBER'
|
||||
}
|
||||
container('mattermost-node') {
|
||||
sh 'cd platform && make build-client BUILD_NUMBER=$BUILD_NUMBER'
|
||||
}
|
||||
container('golang') {
|
||||
sh 'cd /go/src/github.com/mattermost/platform && make package BUILD_NUMBER=$BUILD_NUMBER'
|
||||
}
|
||||
}
|
||||
stage('Unit Tests') {
|
||||
container('golang') {
|
||||
sh 'cd /go/src/github.com/mattermost/platform && make test BUILD_NUMBER=$BUILD_NUMBER TESTFLAGS= TESTFLAGSEE='
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user