UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Plugins
Mattermost Admin Plugin
Commits
671e7a9a
Commit
671e7a9a
authored
Jun 09, 2021
by
Ajith Gudem
Browse files
Added logic for enable/disable, updated versions and cleanup
parent
f7a8f88d
Pipeline
#306649
passed with stages
in 5 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
38 deletions
+12
-38
Dockerfile
Dockerfile
+0
-29
call_mm_plugin_installer.sh
call_mm_plugin_installer.sh
+1
-1
install-mattermost-plugin.sh
install-mattermost-plugin.sh
+11
-8
No files found.
Dockerfile
View file @
671e7a9a
# ARG BASE_REGISTRY=registry1.dso.mil/ironbank
# ARG BASE_IMAGE=redhat/ubi/ubi8
# ARG BASE_TAG=8.3
ARG
MM_SERVER_VERSION=5.34.2
# FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS builder
# WORKDIR /tmp
# COPY call_mm_plugin_installer.sh .
# COPY install-mattermost-plugin.sh .
# COPY mil.dso.p1.mattermost-admin-plugin-1.0.3-rc.tar.gz .
# RUN tar xvf linux_amd64.tar
FROM
registry1.dso.mil/ironbank/opensource/mattermost/mattermost:${MM_SERVER_VERSION}
ARG
PLUGIN_ID=mil.dso.p1.mattermost-admin-plugin
...
...
@@ -21,24 +7,11 @@ ARG PLUGIN_VERSION=1.1.0-rc
ENV
PLUGIN_ID=${PLUGIN_ID}
ENV
PLUGIN_ARTIFACT=${PLUGIN_ID}-${PLUGIN_VERSION}.tar.gz
# ENV PLUGIN_ARTIFACT=${PLUGIN_ARTIFACT}
# FROM registry1.dso.mil/ironbank/docker/scratch:ironbank
# RUN echo $PLUGIN_ID
# ENV PLUGIN_ID=${PLUGIN_ID}
# ENV PLUGIN_VERSION=${PLUGIN_VERSION}
# WORKDIR mattermost/bin
# COPY --from=builder /tmp/mmctl .
WORKDIR
/scripts
COPY
call_mm_plugin_installer.sh .
COPY
install-mattermost-plugin.sh .
# COPY *.tar.gz .
COPY
${PLUGIN_ARTIFACT} .
# COPY --from=builder /tmp/${PLUGIN_ID}-${PLUGIN_VERSION}}.tar.gz .
# COPY --from=builder /tmp/install-mattermost-plugin.sh .
# COPY --from=builder /tmp/call_mm_plugin_installer.sh .
USER
root
RUN
mkdir
-p
/home/mattermost
&&
chown
2000:2000 /home/mattermost
...
...
@@ -46,7 +19,5 @@ USER 2000
# The entrypoint script calls the main installer which uses ENV vars for token and url to contact the target and install the plugin
ENTRYPOINT
[ "./call_mm_plugin_installer.sh" ]
# ENTRYPOINT [ "./install-mattermost-plugin.sh" ]
# ENTRYPOINT ["tail", "-f", "/dev/null"]
HEALTHCHECK
NONE
call_mm_plugin_installer.sh
View file @
671e7a9a
#!/bin/sh
./install-mattermost-plugin.sh
-u
$TARGET_URL
-t
$TARGET_TOKEN
\ No newline at end of file
./install-mattermost-plugin.sh
-u
$TARGET_URL
-t
$TARGET_TOKEN
-e
$PLUGIN_ENABLED
install-mattermost-plugin.sh
View file @
671e7a9a
...
...
@@ -4,26 +4,28 @@
# obtain the plugin name and plugin ID from the pipeline (hardcoded for now)
# need
2
params [u
sername, password
]
# need
3
params [u
rl, token, status
]
# call mmctl auth
# mmctl plugin add
# mmctl plugin enable
#
while
getopts
u:t: flag
while
getopts
u:t:
e:
flag
do
let
opts++
case
"
${
flag
}
"
in
u
)
url
=
${
OPTARG
}
;;
t
)
token
=
${
OPTARG
}
;;
e
)
enabled
=
${
OPTARG
}
;;
esac
done
[[
$opts
-lt
2
]]
&&
echo
"Please provide
2
args"
&&
exit
1
[[
$opts
-lt
3
]]
&&
echo
"Please provide
3
args"
&&
exit
1
echo
" using URL:
$url
"
;
echo
" using Token:
$token
"
;
echo
" enabled:
$enabled
"
;
# mmctl auth login http://localhost:8065 -n paul -a cenneh38ifd9tfqy7trwra918r
result
=
$(
/mattermost/bin/mmctl auth login
$url
-n
plugininstall
-a
$token
)
...
...
@@ -35,10 +37,11 @@ echo " using Token: $token";
# if creds successfully stored, then delete the plugin by ID (we don't care if it fails or not)
result
=
$(
/mattermost/bin/mmctl plugin delete
${
PLUGIN_ID
}
)
# install the plugin with the tar.gz file
result
=
$(
/mattermost/bin/mmctl plugin add
${
PLUGIN_ARTIFACT
}
--format
json
)
# if the install was successful, then enable it
result
=
$(
/mattermost/bin/mmctl plugin
enable
${
PLUGIN_ID
}
--format
json
)
if
[[
$enabled
==
"true"
]]
;
then
# install the plugin with the tar.gz file
result
=
$(
/mattermost/bin/mmctl plugin add
${
PLUGIN_ARTIFACT
}
--format
json
)
# if the install was successful, then enable it
result
=
$(
/mattermost/bin/mmctl plugin
enable
${
PLUGIN_ID
}
--format
json
)
fi
echo
"result:
$result
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment