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='
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
build/help.mk
Обычный файл
28
build/help.mk
Обычный файл
@@ -0,0 +1,28 @@
|
||||
help:
|
||||
@echo "-----------------------------------------------------------------------------------------------"
|
||||
@echo "------------------------------------- Makefile Help -------------------------------------------"
|
||||
@echo "-----------------------------------------------------------------------------------------------"
|
||||
@echo ""
|
||||
@echo " General:"
|
||||
@echo "make run Build and run the Mattermost server for development"
|
||||
@echo "make run-fullmap Same as run but with a full sourcemap for client"
|
||||
@echo "make stop Stops server and client."
|
||||
@echo "make restart-server Restarts the mattermost server to pick up development change."
|
||||
@echo "make clean Clean up everything except persistant server data"
|
||||
@echo "make nuke clean plus removes persistant server data"
|
||||
@echo ""
|
||||
@echo " Testing:"
|
||||
@echo "make test Runs all checks and tests below (except race detection and postgres)"
|
||||
@echo "make govet Runs govet against all packages"
|
||||
@echo "make gofmt Runs gofmt against all packages"
|
||||
@echo "make check-style Runs govet and gofmt against all packages"
|
||||
@echo "make check-server-race Runs the unit tests with race detection mode on"
|
||||
@echo "make test-postgres Runs the unit tests against a postgres database"
|
||||
@echo "make cover Runs the golang coverage tool. You must run the unit tests first."
|
||||
@echo ""
|
||||
@echo " Docker:"
|
||||
@echo "make start-docker Starts the docker containers for local development"
|
||||
@echo "make stop-docker Stops the docker containers for local development"
|
||||
@echo "make clean-docker Deletes the docker containers for local development"
|
||||
@echo ""
|
||||
@echo "-----------------------------------------------------------------------------------------------"
|
||||
98
build/release.mk
Обычный файл
98
build/release.mk
Обычный файл
@@ -0,0 +1,98 @@
|
||||
|
||||
dist: | check-style test package
|
||||
|
||||
build-linux:
|
||||
@echo Build Linux amd64
|
||||
env GOOS=linux GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./cmd/platform
|
||||
|
||||
build-osx:
|
||||
@echo Build OSX amd64
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./cmd/platform
|
||||
|
||||
build-windows:
|
||||
@echo Build Windows amd64
|
||||
env GOOS=windows GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./cmd/platform
|
||||
|
||||
build: build-linux build-windows build-osx
|
||||
|
||||
build-client:
|
||||
@echo Building mattermost web app
|
||||
|
||||
cd $(BUILD_WEBAPP_DIR) && $(MAKE) build
|
||||
|
||||
package:
|
||||
@ echo Packaging mattermost
|
||||
|
||||
@# Remove any old files
|
||||
rm -Rf $(DIST_ROOT)
|
||||
|
||||
@# Create needed directories
|
||||
mkdir -p $(DIST_PATH)/bin
|
||||
mkdir -p $(DIST_PATH)/logs
|
||||
|
||||
@# Resource directories
|
||||
cp -RL config $(DIST_PATH)
|
||||
cp -RL fonts $(DIST_PATH)
|
||||
cp -RL templates $(DIST_PATH)
|
||||
cp -RL i18n $(DIST_PATH)
|
||||
|
||||
@# Disable developer settings
|
||||
sed -i'' -e 's|"ConsoleLevel": "DEBUG"|"ConsoleLevel": "INFO"|g' $(DIST_PATH)/config/config.json
|
||||
sed -i'' -e 's|"SiteURL": "http://localhost:8065"|"SiteURL": ""|g' $(DIST_PATH)/config/config.json
|
||||
|
||||
@# Reset email sending to original configuration
|
||||
sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' $(DIST_PATH)/config/config.json
|
||||
sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' $(DIST_PATH)/config/config.json
|
||||
sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json
|
||||
sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' $(DIST_PATH)/config/config.json
|
||||
|
||||
@# Package webapp
|
||||
mkdir -p $(DIST_PATH)/webapp/dist
|
||||
cp -RL $(BUILD_WEBAPP_DIR)/dist $(DIST_PATH)/webapp
|
||||
|
||||
@# Help files
|
||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
cp $(BUILD_ENTERPRISE_DIR)/ENTERPRISE-EDITION-LICENSE.txt $(DIST_PATH)
|
||||
else
|
||||
cp build/MIT-COMPILED-LICENSE.md $(DIST_PATH)
|
||||
endif
|
||||
cp NOTICE.txt $(DIST_PATH)
|
||||
cp README.md $(DIST_PATH)
|
||||
|
||||
@# ----- PLATFORM SPECIFIC -----
|
||||
|
||||
@# Make osx package
|
||||
@# Copy binary
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
||||
cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||
else
|
||||
cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||
endif
|
||||
@# Package
|
||||
tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-osx-amd64.tar.gz mattermost
|
||||
@# Cleanup
|
||||
rm -f $(DIST_PATH)/bin/platform
|
||||
|
||||
@# Make windows package
|
||||
@# Copy binary
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
||||
cp $(GOPATH)/bin/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||
else
|
||||
cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||
endif
|
||||
@# Package
|
||||
cd $(DIST_ROOT) && zip -9 -r -q -l mattermost-$(BUILD_TYPE_NAME)-windows-amd64.zip mattermost && cd ..
|
||||
@# Cleanup
|
||||
rm -f $(DIST_PATH)/bin/platform.exe
|
||||
|
||||
@# Make linux package
|
||||
@# Copy binary
|
||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
||||
cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||
else
|
||||
cp $(GOPATH)/bin/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||
endif
|
||||
@# Package
|
||||
tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-linux-amd64.tar.gz mattermost
|
||||
@# Don't clean up native package so dev machines will have an unzipped package available
|
||||
@#rm -f $(DIST_PATH)/bin/platform
|
||||
Ссылка в новой задаче
Block a user