UNCLASSIFIED

Commit 671e7a9a authored by Ajith Gudem's avatar 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
# 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
#!/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
......@@ -4,26 +4,28 @@
# obtain the plugin name and plugin ID from the pipeline (hardcoded for now)
# need 2 params [username, password]
# need 3 params [url, 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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment