feat: support deleting and updating wiki pages
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
8086ed9686
commit
a2fbd5c29f
@ -6,7 +6,7 @@ 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
|
||||
RUN cd redmine-api-cpp && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_TESTS=OFF && make -j 4
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
|
@ -37,7 +37,7 @@ your business on this image.
|
||||
|
||||
## Prebuild Images
|
||||
|
||||
* https://hub.docker.com/repository/docker/byterazor/drone-redmine/general
|
||||
* https://hub.docker.com/repository/docker/byterazor/drone-/general
|
||||
|
||||
## Authors
|
||||
|
||||
|
78
plugin.sh
78
plugin.sh
@ -15,24 +15,86 @@ if [ -z ${PLUGIN_REDMINE_TOKEN} ]; then
|
||||
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
|
||||
export REDMINE_API_TOKEN=$PLUGIN_REDMINE_TOKEN
|
||||
|
||||
|
||||
#
|
||||
# Upload files to the projects file section
|
||||
#
|
||||
if [ -n ${PLUGIN_UPLOAD_FILES} ]; then
|
||||
|
||||
|
||||
if [ "${PLUGIN_UPLOAD_FILES}" == "true" ]; then
|
||||
|
||||
if [ -z ${PLUGIN_PROJECT_NR} ]; then
|
||||
echo "ERROR: Please set PROJECT_NR (the number not the string identifier)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
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
|
||||
redmine-cli project upload -p ${PLUGIN_PROJECT_NR} -f ${NAME} -d ${DESC} -v ${VERS} $FPATH
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# delete a wiki page
|
||||
#
|
||||
if [ -n ${PLUGIN_DELETE_WIKI_PAGE} ]; then
|
||||
if [ "${PLUGIN_DELETE_WIKI_PAGE}" == "true" ]; then
|
||||
|
||||
if [ -z ${PLUGIN_PROJECT_ID} ]; then
|
||||
echo "ERROR: Please set PROJECT_ID when deleting a wiki page (the string identifier)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -z ${PLUGIN_PAGE_NAME} ]; then
|
||||
echo "ERROR: Please set PAGE_NAME when deleting wiki page"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "redmine-cli wiki deletePage -p ${PLUGIN_PROJECT_ID} --page ${PLUGIN_PAGE_NAME}"
|
||||
redmine-cli wiki deletePage -p ${PLUGIN_PROJECT_ID} --page ${PLUGIN_PAGE_NAME}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# update a wiki page
|
||||
#
|
||||
if [ -n ${PLUGIN_UPDATE_WIKI_PAGE}]; then
|
||||
if [ "${PLUGIN_UPDATE_WIKI_PAGE}" == "true" ]; then
|
||||
|
||||
if [ -z ${PLUGIN_PROJECT_ID} ]; then
|
||||
echo "ERROR: Please set PROJECT_ID when updating a wiki page (the string identifier)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -z ${PLUGIN_PAGE_NAME} ]; then
|
||||
echo "ERROR: Please set PAGE_NAME when updating wiki page"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
CMD="redmine-cli wiki updatePage -p ${PLUGIN_PROJECT_ID} --page ${PLUGIN_PAGE_NAME}"
|
||||
|
||||
if [ -n ${PLUGIN_PAGE_CONTENT} ]; then
|
||||
CMD="$CMD -c \'${PLUGIN_PAGE_CONTENT}\'"
|
||||
elif [ -n ${PLUGIN_PAGE_FILE} ]; then
|
||||
CMD="$CMD -f \"${PLUGIN_PAGE_FILE}\""
|
||||
fi
|
||||
|
||||
if [ -n ${PLUGIN_PAGE_ATTACHEMENTS} ]; then
|
||||
for a in ${PLUGIN_PAGE_ATTACHEMENTS}; do
|
||||
CMD="$CMD -a \"$a\""
|
||||
done
|
||||
fi
|
||||
|
||||
$CMD
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user