UNCLASSIFIED

Commit 6f14fa79 authored by Ajith Gudem's avatar Ajith Gudem
Browse files

Trying variable substitution in Docker and supporting shell scripts

parent c0d4e93a
Pipeline #281300 failed with stages
in 1 minute and 13 seconds
ARG BASE_REGISTRY=registry1.dso.mil/ironbank
ARG BASE_IMAGE=redhat/ubi/ubi8
ARG BASE_TAG=8.3
# ARG BASE_REGISTRY=registry1.dso.mil/ironbank
# ARG BASE_IMAGE=redhat/ubi/ubi8
# ARG BASE_TAG=8.3
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS builder
ARG MM_SERVER_VERSION=5.34.2
ARG PLUGIN_ID=mil.dso.p1.mattermost-admin-plugin
ARG PLUGIN_VERSION=1.0.3-rc
ARG PLUGIN_ARTIFACT=mil.dso.p1.mattermost-admin-plugin-1.0.3-rc.tar.gz
# FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS builder
WORKDIR /tmp
# 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 .
# 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:5.34.2
FROM registry1.dso.mil/ironbank/opensource/mattermost/mattermost:${MM_SERVER_VERSION}
# FROM registry1.dso.mil/ironbank/docker/scratch:ironbank
# ENV TARGET_URL="URL IS UNDEFINED"
# ENV TARGET_TOKEN="TARGET TOKEN IS UNDEFINED"
# 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 --from=builder /tmp/mil.dso.p1.mattermost-admin-plugin-1.0.3-rc.tar.gz .
COPY --from=builder /tmp/install-mattermost-plugin.sh .
COPY --from=builder /tmp/call_mm_plugin_installer.sh .
COPY call_mm_plugin_installer.sh .
COPY install-mattermost-plugin.sh .
COPY ${PLUGIN_ARTIFACT}.tar.gz .
# 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
USER 2000
# RUN ln -s /tmp /home/mattermost
# The base image sets the UID to mattermost
# USER 1001
# 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
# 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"]
......
......@@ -33,15 +33,12 @@ echo " using Token: $token";
# 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=$(/mattermost/bin/mmctl plugin delete com.mattermost.p1-admin-mattermost-plugin)
result=$(/mattermost/bin/mmctl plugin delete ${PLUGIN_ID})
# install the plugin with the tar.gz file
result=$(/mattermost/bin/mmctl plugin add mattermost-admin-plugin-1.0.2-rc.tar.gz --format json)
result=$(/mattermost/bin/mmctl plugin add ${PLUGIN_ID}-${PLUGIN_VERSION}.tar.gz --format json)
# if the install was successful, then enable it
result=$(/mattermost/bin/mmctl plugin enable com.mattermost.p1-admin-mattermost-plugin --format json)
echo $result
result=$(/mattermost/bin/mmctl plugin enable ${PLUGIN_ID} --format json)
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