This project helps to automate a stable means of testing pull requests for the Jenkins slack-plugin.
Note: Prerequisites include: Java 1.8, Vagrant, VirtualBox, and Ubuntu Linux 16.04 as a host.
For testing slack-plugin
pull requests, I run through a manual
test sequence in addition to depending on the automated tests. In general, I
feel comfortable merging a change when:
- ✅ The plugin smoothly upgrades to SNAPSHOT build of the PR from the stable version of the slack plugin without breaking existing configurations.
- ✅ The code integrates well with existing configurations.
- ✅ You have included tests!
The following outlines a more detailed test sequence.
-
Bootstrap fresh Jenkins.
./slack_bootstrap.sh
. -
Once Jenkins is up and running, execute the following automation script to run through building jobs.
./tests/integration/slack-test.sh
-
Once the script finishes running, manually verify all of the output messages at https://jenkins-slack-plugin.slack.com/.
Configure Mattermost
-
Bootstrap Mattermost with
vagrant up
. Log into http://localhost:8065/ when it finishes. -
Sign up with a dummy account. This first account will be an admin.
-
Create a new team named
slack-plugin
. -
Enable integrations. Visit System Console > Integrations > Custom Integrations and be sure to Enable Incoming Webhooks. Switch back to the
slack-plugin
team when finished. -
Under
slack-plugin
menu click Integrations. Add an incomming web hook. Give it any name. When you're finished you'll be presented with an integration URL likehttp://localhost:8065/hooks/zsj3k4e3qbyq7qxpoqndruyoqy
.http://localhost:8065/hooks/
is your base URL.zsj3k4e3qbyq7qxpoqndruyoqy
is your integration token.
Configure slack plugin to use Mattermost.
-
Go to Manage Jenkins > Configure System.
-
Under the Global Slack Notifier Settings you'll need to configure:
- Base URL:
http://localhost:8065/hooks/
- Team Subdomain:
slack-plugin
- Integration Token:
zsj3k4e3qbyq7qxpoqndruyoqy
(this will be different each time) - Channel:
Off-Topic
- Base URL:
-
Test the connection to be sure it's good.
-
Configure all jobs to use the global mattermost configurations by executing the following script.
./tests/integration/setup-mattermost.sh
-
Execute the following automation script to run through building jobs.
./tests/integration/slack-test.sh
-
Once the script finishes running, manually verify all of the output messages at
http://localhost:8065/slack-plugin/channels/off-topic
. All output messages should be the same as when tested onslack.com
.
For usage instructions related to scripts in this repository see USAGE.md.
The Jenkins Slack plugin publishes build information to Slack teams. This project is meant to bootstrap Jenkins from scratch and pre-configure it to use the Slack plugin for testing.
If you're not already a member of jenkins-slack-plugin.slack.com
then please
join before bootstrapping this code so you can see messages posted
to it.
Keeping up with updates can be a challenge if it's not automated. The following process keeps upgrading simple.
./scripts/upgrade/upgrade_build_gradle.sh
See the more detailed upgrade process.
Copyright (c) 2015-2017 Sam Gleske - https://github.com/samrocketman/jenkins-bootstrap-slack
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For the full license see LICENSE.