-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: native support for plugins (#99)
## Description This adds an `initContainer` used to sideload mattermost plugins. New plugins can be added by adding additional `ADD` commands to the included `Dockerfile`. ## Related Issue Fixes #7 Depends on defenseunicorns/uds-common#161 for renovate changes. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [ ] Test, docs, adr added or updated as needed - [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-package-mattermost/blob/main/CONTRIBUTING.md#developer-workflow) followed --------- Co-authored-by: zamaz <71521611+zachariahmiller@users.noreply.github.com>
- Loading branch information
1 parent
05ae7cf
commit 1940db1
Showing
8 changed files
with
154 additions
and
10 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
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,41 @@ | ||
# Configuration | ||
|
||
This Mattermost package is primarily configured through the upstream | ||
[Mattermost chart](https://github.com/mattermost/mattermost-helm/tree/master/charts/mattermost-enterprise-edition). | ||
|
||
## Plugins | ||
|
||
For installing plugins into your environment, we recommend the included `mattermost-plugins` Zarf package. | ||
It includes the following plugins by default: | ||
|
||
- [`mattermost-plugin-ai`](https://github.com/mattermost/mattermost-plugin-ai) | ||
- [`mattermost-plugin-gitlab`](https://github.com/mattermost/mattermost-plugin-gitlab) | ||
|
||
|
||
In order to load these plugins into the Mattermost server, the `uds-package-mattermost/mattermost-extra-plugins` | ||
image provided by this package should be injected as an `initContainer` by adding the following `overrides` to your | ||
UDS bundle: | ||
|
||
```yaml | ||
- name: mattermost | ||
overrides: | ||
mattermost: | ||
mattermost-enterprise-edition: | ||
values: | ||
- path: "mattermostApp.extraInitContainers" | ||
value: | ||
# Extra Container to install plugins | ||
- name: mattermost-extra-plugins | ||
image: uds-package-mattermost/mattermost-extra-plugins:latest | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
# Must match plugins volumes from chart | ||
|
||
# In mattermost-team-edition chart, this is `/mattermost/$MM_PLUGINSETTINGS_CLIENTDIRECTORY` | ||
# see: https://github.com/mattermost/mattermost-helm/blob/master/charts/mattermost-team-edition/templates/deployment.yaml#L103-L104 | ||
|
||
# In mattermost-enterprise-edition chart, it is hardcoded to `/mattermost/plugins/` | ||
# see: https://github.com/mattermost/mattermost-helm/blob/master/charts/mattermost-enterprise-edition/templates/deployment-mattermost-app.yaml#L174-L177 | ||
- name: mattermost-plugins | ||
mountPath: /mattermost/plugins/ | ||
``` |
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,17 @@ | ||
FROM cgr.dev/chainguard/busybox:latest | ||
|
||
# renovate: datasource=github-tags depName=mattermost/mattermost-plugin-ai versioning=semver | ||
ENV MATTERMOST_AI_PLUGIN_VERSION=0.8.2 | ||
# renovate: datasource=github-tags depName=mattermost/mattermost-plugin-gitlab versioning=semver | ||
ENV MATTERMOST_GITLAB_PLUGIN_VERSION=1.9.1 | ||
|
||
USER root | ||
|
||
ADD https://github.com/mattermost/mattermost-plugin-ai/releases/download/v$MATTERMOST_AI_PLUGIN_VERSION/mattermost-plugin-ai-v$MATTERMOST_AI_PLUGIN_VERSION-linux-amd64.tar.gz /extra-plugins/ | ||
ADD https://github.com/mattermost/mattermost-plugin-gitlab/releases/download/v$MATTERMOST_GITLAB_PLUGIN_VERSION/com.github.manland.mattermost-plugin-gitlab-$MATTERMOST_GITLAB_PLUGIN_VERSION.tar.gz /extra-plugins/ | ||
|
||
COPY ./entrypoint.sh /bin/entrypoint.sh | ||
|
||
RUN chmod -R 777 /extra-plugins/*.tar.gz | ||
|
||
ENTRYPOINT [ "/bin/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /bin/sh | ||
|
||
set -e | ||
|
||
PLUGINS_TAR=$(ls /extra-plugins) | ||
|
||
cd /mattermost/plugins/ | ||
|
||
for plugin_tar in ${PLUGINS_TAR}; | ||
do | ||
plugin_tar="/extra-plugins/${plugin_tar##*/}" | ||
echo "extracting $plugin_tar ..." | ||
tar -xf $plugin_tar | ||
done | ||
|
||
echo "finished loading plugins" |
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,21 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/zarf/main/zarf.schema.json | ||
kind: ZarfPackageConfig | ||
metadata: | ||
name: mattermost-plugins | ||
description: "UDS Mattermost Plugins Package" | ||
# x-release-please-start-version | ||
version: "9.9.1-uds.0" | ||
# x-release-please-end | ||
|
||
components: | ||
- name: mattermost-plugins | ||
required: true | ||
images: | ||
- uds-package-mattermost/mattermost-extra-plugins:latest | ||
actions: | ||
onCreate: | ||
before: | ||
# we always build on amd64 because that is the target architecture for the plugin binaries | ||
# but we still need fake arm64 images because @zachariahmiller said so | ||
- cmd: | | ||
docker buildx build . -t uds-package-mattermost/mattermost-extra-plugins:latest --platform linux/amd64 |
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