UNCLASSIFIED

Commit 5b80e13a authored by paulqualls's avatar paulqualls
Browse files

updating dockerfile and scripts for remote install of plugin

parent 714e9e95
Pipeline #239675 passed with stages
in 60 minutes and 45 seconds
......@@ -6,10 +6,9 @@ FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS builder
WORKDIR /tmp
COPY install-mattermost-plugin.sh .
COPY call_mm_plugin_installer.sh .
COPY mattermost-admin-plugin-1.0.2-rc.tar.gz .
# RUN tar xzvf mattermost-admin-plugin-1.0.2-rc.tar.gz
COPY linux_amd64.tar .
RUN tar xvf linux_amd64.tar
......@@ -17,6 +16,8 @@ RUN tar xvf linux_amd64.tar
FROM registry1.dso.mil/ironbank/google/golang/golang-1.16:1.16
# FROM registry1.dso.mil/ironbank/docker/scratch:ironbank
ENV TARGET_URL="URL IS UNDEFINED"
ENV TARGET_TOKEN="TARGET TOKEN IS UNDEFINED"
WORKDIR /bin
......@@ -25,12 +26,14 @@ COPY --from=builder /tmp/mmctl .
WORKDIR /plugin
COPY --from=builder /tmp/mattermost-admin-plugin-1.0.2-rc.tar.gz .
COPY --from=builder /tmp/install-mattermost-plugin.sh .
COPY --from=builder /tmp/call_mm_plugin_installer.sh .
USER 1001
# ENTRYPOINT [ "/bin/mmctl" ]
ENTRYPOINT ["tail", "-f", "/dev/null"]
# CMD ["version"]
# 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 ["tail", "-f", "/dev/null"]
HEALTHCHECK NONE
#!/bin/sh
./install-mattermost-plugin.sh -u $TARGET_URL -t $TARGET_TOKEN
\ No newline at end of file
#!/bin/sh
# params [token, url]
# obtain the plugin name and plugin ID from the pipeline (hardcoded for now)
# need 2 params [username, password]
# call mmctl auth
# mmctl plugin add
# mmctl plugin enable
#
while getopts u:t: flag
do
let opts++
case "${flag}" in
u) url=${OPTARG};;
t) token=${OPTARG};;
esac
done
[[ $opts -lt 2 ]] && echo "Please provide 2 args" && exit 1
echo " using URL: $url";
echo " using Token: $token";
# mmctl auth login http://localhost:8065 -n paul -a cenneh38ifd9tfqy7trwra918r
result=$(mmctl auth login $url -n plugininstall -a $token)
echo "result: $result"
# look for th word "stored" for success, "Invalid" as failure
# if creds successfully stored, then delete the plugin by ID (we don't care if it fails or not)
result=$(mmctl plugin delete com.mattermost.p1-admin-mattermost-plugin)
# install the plugin with the tar.gz file
result=$(mmctl plugin add mattermost-admin-plugin-1.0.2-rc.tar.gz --format json)
# if the install was successful, then enable it
result=$(mmctl plugin enable com.mattermost.p1-admin-mattermost-plugin --format json)
echo $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