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 5 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
13 changes: 13 additions & 0 deletions plugins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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/

RUN chmod -R 777 /extra-plugins/*.tar.gz
50 changes: 50 additions & 0 deletions plugins/ai.melange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package:
marshall007 marked this conversation as resolved.
Show resolved Hide resolved
name: mattermost-plugin-ai
version: 0.8.1
epoch: 0
description: Mattermost plugin for LLMs
copyright:
- license: Apache-2.0
target-architecture:
- x86_64
- aarch64

environment:
contents:
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
repositories:
- https://packages.wolfi.dev/os
packages:
- build-base
- busybox
- ca-certificates-bundle
- openssl-dev
- libelf
- go
- nodejs
- npm
- make

pipeline:
- uses: git-checkout
with:
repository: https://github.com/mattermost/mattermost-plugin-ai
tag: v${{package.version}}
expected-commit: 118283adf71b6f7f48c9c7689f5b49fdb4e2a898

- runs: |
# only build for current architecture (default is all)
export MM_SERVICESETTINGS_ENABLEDEVELOPER=1

make dist

mv dist/ "${{ targets.destdir }}"

update:
enabled: true
github:
identifier: mattermost/mattermost-plugin-ai
strip-prefix: v
use-tag: true
tag-filter: v
53 changes: 53 additions & 0 deletions plugins/gitlab.melange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package:
marshall007 marked this conversation as resolved.
Show resolved Hide resolved
name: mattermost-plugin-gitlab
version: 1.9.1
epoch: 0
description: A GitLab plugin for Mattermost.
copyright:
- license: Apache-2.0
target-architecture:
- x86_64
- aarch64

environment:
contents:
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
repositories:
- https://packages.wolfi.dev/os
packages:
- build-base
- busybox
- ca-certificates-bundle
- openssl-dev
- libelf
- go
- nodejs
- npm
- make

pipeline:
- uses: git-checkout
with:
repository: https://github.com/mattermost/mattermost-plugin-gitlab
tag: v${{package.version}}
expected-commit: 69ab85a2bc2ca0ba22242d4d0e9d33bd695a2edb

- runs: |
# only build for current architecture (default is all)
export MM_SERVICESETTINGS_ENABLEDEVELOPER=1

# webpack `ERR_OSSL_EVP_UNSUPPORTED` (Error: error:0308010C:digital envelope routines::unsupported)
export NODE_OPTIONS=--openssl-legacy-provider

make dist

mv dist/ "${{ targets.destdir }}"

update:
enabled: true
github:
identifier: mattermost/mattermost-plugin-gitlab
strip-prefix: v
use-tag: true
tag-filter: v
45 changes: 45 additions & 0 deletions values/common-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ minio:
enabled: false
mysqlha:
enabled: false
# TODO @marshall007: this should work pending: https://github.com/chainguard-images/images/issues/923#issuecomment-2181155300
marshall007 marked this conversation as resolved.
Show resolved Hide resolved
# initContainerImage:
# repository: cgr.dev/chainguard/curl
# tag: latest
marshall007 marked this conversation as resolved.
Show resolved Hide resolved
mattermostApp:
# Default replicacount due to HA requiring a license
replicaCount: 1
Expand All @@ -25,6 +29,47 @@ mattermostApp:
securityContext:
runAsUser: 2000
runAsGroup: 2000
extraVolumes:
- name: mattermost-plugins-init
emptyDir: {}
marshall007 marked this conversation as resolved.
Show resolved Hide resolved
extraInitContainers:
# Extra Container to install plugins
- name: init-plugins-config
image: uds-package-mattermost/mattermost-extra-plugins:latest
imagePullPolicy: Always
command:
- sh
- "-c"
- |
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"
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

# TODO @marshall007: only mattermost-team-edition chart supports plugin persistence. `emptyDir` may cause problems on EE, will need to investigate
# see: https://github.com/mattermost/mattermost-helm/blob/master/charts/mattermost-team-edition/templates/deployment.yaml#L123-L133
- name: mattermost-plugins
mountPath: /mattermost/plugins/
- name: mattermost-plugins-client
mountPath: /mattermost/client/plugins/
marshall007 marked this conversation as resolved.
Show resolved Hide resolved

serviceAccount:
create: true
Expand Down
11 changes: 11 additions & 0 deletions zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ variables:
description: "Database Password for Mattermost"

components:
- name: mattermost-plugins
required: true
images:
- uds-package-mattermost/mattermost-extra-plugins:latest
actions:
onCreate:
before:
- dir: plugins
cmd: |
docker build . -t uds-package-mattermost/mattermost-extra-plugins:latest

- name: mattermost
required: true
description: "Deploy Mattermost"
Expand Down