forked from mattermost/mattermost-integration-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.git* | ||
*.swp | ||
*.egg-info | ||
*.pyc | ||
.tox | ||
.coverage | ||
htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN apt -y update && apt -y upgrade | ||
RUN apt -y install python-pip python-dev build-essential | ||
RUN pip install virtualenv | ||
|
||
RUN mkdir -p /opt/mattermost-integration-gitlab | ||
COPY . /opt/mattermost-integration-gitlab | ||
WORKDIR /opt/mattermost-integration-gitlab | ||
RUN pip install . | ||
|
||
|
||
EXPOSE 5000 | ||
|
||
CMD /opt/mattermost-integration-gitlab/entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
|
||
PLUGIN_ARGS= | ||
|
||
if [ -n "${MATTERMOST_USERNAME}" ]; then | ||
PLUGIN_ARGS="${PLUGIN_ARGS} --username ${MATTERMOST_USERNAME}" | ||
fi | ||
|
||
if [ -n "${MATTERMOST_CHANNEL}" ]; then | ||
PLUGIN_ARGS="${PLUGIN_ARGS} --channel ${MATTERMOST_CHANNEL}" | ||
fi | ||
|
||
if [ -n "${MATTERMOST_ICON}" ]; then | ||
PLUGIN_ARGS="${PLUGIN_ARGS} --icon ${MATTERMOST_ICON}" | ||
fi | ||
|
||
|
||
EVENTS=( PUSH TAG ) | ||
for POSSIBLE_EVENT in "${EVENTS[@]}"; do | ||
ENV_NAME="MATTERMOST_EVENT_${POSSIBLE_EVENT}" | ||
eval VALUE=\$${ENV_NAME} | ||
if [ -n "${VALUE}" ]; then | ||
if [ "${VALUE}" == "1" -o "${VALUE}" == "yes" -o "${VALUE}" == "y" ]; then | ||
PLUGIN_ARGS="${PLUGIN_ARGS} --${POSSIBLE_EVENT,,}" | ||
fi | ||
fi | ||
done | ||
|
||
NEGATIVE_EVENTS=( ISSUE COMMENT MERGE-REQUEST CI ) | ||
for POSSIBLE_EVENT in "${NEGATIVE_EVENTS[@]}"; do | ||
ENV_NAME="MATTERMOST_EVENT_${POSSIBLE_EVENT}" | ||
eval VALUE=\$${ENV_NAME} | ||
if [ -n "${VALUE}" ]; then | ||
if [ "${VALUE}" == "0" -o "${VALUE}" == "n" -o "${VALUE}" == "no" ]; then | ||
PLUGIN_ARGS="${PLUGIN_ARGS} --no-${POSSIBLE_EVENT,,}" | ||
fi | ||
fi | ||
done | ||
|
||
if [ -z "${MATTERMOST_WEBHOOK_URL}" ]; then | ||
echo "Missing Mattermost WEBHOOK url !" >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
if [ ! -x "/usr/local/bin/mattermost_gitlab" ]; then | ||
echo "Missing application executable !" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "Starting: " | ||
echo "/usr/local/bin/mattermost_gitlab ${PLUGIN_ARGS} '${MATTERMOST_WEBHOOK_URL}'" | ||
/usr/local/bin/mattermost_gitlab ${PLUGIN_ARGS} "${MATTERMOST_WEBHOOK_URL}" |