Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: native support for plugins #99

Merged
merged 25 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
66e09c2
WIP plugin support
marshall007 Jun 21, 2024
3f35bb6
bundle plugins into image
marshall007 Jun 25, 2024
efcd6ac
add renovate config for plugins
marshall007 Jun 28, 2024
697f195
fix indentation
marshall007 Jun 28, 2024
1eb861c
Merge branch 'main' into marshall_plugins
marshall007 Jun 28, 2024
49599db
PR feedback
marshall007 Jul 1, 2024
16934e8
move script to container image
marshall007 Jul 1, 2024
8609f8f
publish skeleton package
marshall007 Jul 9, 2024
7fc7c98
add publish step for skeleton package
marshall007 Jul 9, 2024
c45f82d
Merge branch 'main' into marshall_plugins
zachariahmiller Jul 9, 2024
695ce73
fix package publishing
marshall007 Jul 10, 2024
794c503
fix plugin package flavor and arch
marshall007 Jul 10, 2024
8f1a26e
add configuration docs
marshall007 Jul 12, 2024
b705a52
move config to UDS bundle
marshall007 Jul 12, 2024
ab8f88e
Merge branch 'main' into marshall_plugins
marshall007 Jul 12, 2024
c932964
fix uds bundle config
marshall007 Jul 12, 2024
32f856a
fix bundle upgrade
marshall007 Jul 12, 2024
3cca06d
increase tests timout
marshall007 Jul 15, 2024
6c8c76d
remove restart for sso
marshall007 Jul 15, 2024
925dbc3
attempt larger runner
marshall007 Jul 15, 2024
e0e4169
only use bigboy for registry1 upgrades
marshall007 Jul 15, 2024
45a401e
use proper platform name
marshall007 Jul 15, 2024
3a60c32
Update values/common-values.yaml
marshall007 Jul 15, 2024
d299608
limit which packages are published
marshall007 Jul 16, 2024
e55d71a
link to uds-common issue
marshall007 Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ permissions:
jobs:
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.flavor == 'registry1' && matrix.type == 'upgrade' && 'uds-swf-ubuntu-big-boy-4-core' || 'ubuntu-latest' }}
timeout-minutes: 20
strategy:
matrix:
Expand Down
16 changes: 16 additions & 0 deletions bundle/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ packages:
- name: ACCESS_KEY
- name: SECRET_KEY

- name: mattermost-plugins
path: ../
# x-release-please-start-version
ref: 9.9.1-uds.0
# x-release-please-end

- name: mattermost
path: ../
# x-release-please-start-version
Expand All @@ -64,3 +70,13 @@ packages:
value: "minio.dev-minio.svc.cluster.local:9000"
- path: "objectStorage.bucket"
value: "uds-mattermost-dev"
mattermost-enterprise-edition:
values:
- path: "mattermostApp.extraInitContainers"
value:
- name: mattermost-extra-plugins
image: uds-package-mattermost/mattermost-extra-plugins:latest
imagePullPolicy: Always
volumeMounts:
- name: mattermost-plugins
mountPath: /mattermost/plugins/
41 changes: 41 additions & 0 deletions docs/configuration.md
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/
```
17 changes: 17 additions & 0 deletions plugins/Dockerfile
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" ]
16 changes: 16 additions & 0 deletions plugins/entrypoint.sh
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"
21 changes: 21 additions & 0 deletions plugins/zarf.yaml
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
10 changes: 8 additions & 2 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ tasks:
- task: create:package
with:
options: "--skip-sbom"
- task: create:package
with:
path: ./plugins
options: "--skip-sbom --flavor ''"

- name: create-mm-test-bundle
description: Create a local UDS Mattermost bundle
Expand All @@ -33,6 +37,10 @@ tasks:
- name: create-mm-latest-release-bundle
description: Create UDS Mattermost bundle based on the latest release
actions:
- task: create:package
with:
path: ./plugins
options: "--skip-sbom --flavor ''"
- task: pull:latest-package-release
with:
spoof_release: "true"
Expand Down Expand Up @@ -65,6 +73,4 @@ tasks:
- task: setup:create-doug-user
- task: create-mm-test-bundle
- task: deploy:test-bundle
- cmd: ./uds zarf tools kubectl delete pods --all --namespace mattermost
description: "Workaround - restart the pods so the sso configuration will take effect"
- task: test:all
37 changes: 29 additions & 8 deletions tasks/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,36 @@ includes:
- test: ./test.yaml
- create: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.7.1/tasks/create.yaml
- deploy: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.7.1/tasks/deploy.yaml
- publish: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.7.1/tasks/publish.yaml
# - publish: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.7.1/tasks/publish.yaml
zachariahmiller marked this conversation as resolved.
Show resolved Hide resolved
- setup: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.7.1/tasks/setup.yaml

tasks:
# Slightly modified version of uds-common `publish:package`:
# https://github.com/defenseunicorns/uds-common/blob/v0.6.0/tasks/publish.yaml#L2-L20
- name: publish
description: Publish package for the supplied architecture
inputs:
path:
description: Path to the zarf package being published
default: .
target_repo:
description: The repository to publish into
default: ghcr.io/defenseunicorns/packages/uds
actions:
- description: Publish package for the supplied architecture
cmd: |
for pkg in ${{ .inputs.path }}/zarf-package-*.tar.zst; do
./uds zarf package publish "$pkg" oci://${{ .inputs.target_repo }}
done
marshall007 marked this conversation as resolved.
Show resolved Hide resolved

- name: build-package
description: Build package
actions:
- task: create:package
- task: create:package
with:
path: ./plugins
options: "--flavor ''"

- name: test-package
description: Test the package
Expand All @@ -23,11 +45,10 @@ tasks:
- task: test:all

- name: publish-package
description: Publish the package
description: Publish the packages
actions:
- description: Publish the package
task: publish:package
with:
# x-release-please-start-version
version: "9.9.1-uds.0"
# x-release-please-end
- description: Publish the full packages
task: publish
- description: Publish the skeleton plugins package
cmd: |
./uds zarf package publish ./plugins oci://ghcr.io/defenseunicorns/packages/uds