feat: initial version - just uploading files
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Dominik Meyer 2024-08-07 13:56:32 +02:00
parent 1f9ce8dfa2
commit cc7d4eeb71
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97
2 changed files with 59 additions and 0 deletions

21
Containerfile Normal file
View File

@ -0,0 +1,21 @@
FROM alpine as builder
RUN apk update && apk add --no-cache git openssl openssl-dev make alpine-sdk cmake musl-dev linux-headers
WORKDIR /src
RUN git clone --recurse-submodules https://gitea.federationhq.de/byterazor/redmine-api-cpp.git
RUN cd redmine-api-cpp && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=OFF && make -j 4
FROM alpine:latest
RUN apk update && apk add --no-cache tini bash ca-certificates openssl libgcc libstdc++ libcurl coreutils
COPY --from=builder /src/redmine-api-cpp/build/redmine-cli /usr/local/bin/redmine-cli
ADD plugin.sh /
RUN chmod a+x /plugin.sh
ENTRYPOINT ["/sbin/tini", "--", "/plugin.sh"]

38
plugin.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
if [ -z ${PLUGIN_REDMINE_URL} ]; then
echo "ERROR: Please set REDMINE_URL"
exit -1
fi
if [ -z ${PLUGIN_REDMINE_TOKEN} ]; then
echo "ERROR: Please set REDMINE_TOKEN"
exit -1
fi
if [ -z ${PLUGIN_PROJECT_ID} ]; then
echo "ERROR: Please set PROJECT_ID"
exit -1
fi
export REDMINE_URL=$PLUGIN_REDMINE_URL
export REDMINE_TOKEN=$PLUGIN_REDMINE_TOKEN
if [ -n ${PLUGIN_UPLOAD_FILES} ]; then
if [ "${PLUGIN_UPLOAD_FILES}" == "true" ]; then
for f in $PLUGIN_FILES; do
FPATH=$(echo $f | cut -d ':' -f 1)
NAME=$(echo $f | cut -d ':' -f 2)
DESC=$(echo $f | cut -d ':' -f 3)
VERS=$(echo $f | cut -d ':' -f 4)
redmine-cli project upload -p ${PLUGIN_PROJECT_ID} -f ${NAME} -d ${DESC} -v ${VERS} $FPATH
done
fi
fi