Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 120

[*.{scss,json,yml,yaml,conf,feature}]
indent_size = 2

[*.html]
max_line_length = off
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
allure-docker-api/static/swagger/swagger_security.json
.data/
.idea/
.DS_Store/
*.iml
*.lock
13 changes: 13 additions & 0 deletions allure-docker-scripts/handleUser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# This script is used within the OpenShift image to handle account restrictions

if ! whoami &> /dev/null; then
if [[ -w /etc/passwd ]]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:/home/${USER_NAME:-default}:/bin/bash" >> /etc/passwd
fi
if [[ ! -d /home/${USER_NAME:-default} ]] ; then
mkdir -p /home/${USER_NAME:-default}
chown -R ${USER_NAME:-default}:0 /home/${USER_NAME:-default}
fi
fi
145 changes: 145 additions & 0 deletions docker/Dockerfile.ubi8-openjdk-17
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
ARG ARCH=registry.access.redhat.com
ARG JDK=ubi8/openjdk-17-runtime
ARG BUILD_DATE
ARG BUILD_VERSION
ARG BUILD_REF
ARG ALLURE_RELEASE=NONE
ARG ALLURE_REPO=https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline
ARG QEMU_ARCH
ARG UID=1000
ARG GID=1000
ARG PYTHON_VERSION=3.8

######

FROM python:${PYTHON_VERSION}-alpine AS dev_stage
RUN apk update
RUN apk add build-base
RUN pip install -U pylint
RUN pip install --upgrade pip setuptools wheel waitress && \
pip install -Iv Flask==3.0.2 Flask-JWT-Extended==4.6.0 flask-swagger-ui==4.11.1 requests==2.31.0

ENV ROOT_DIR=/code
RUN mkdir -p $ROOT_DIR
WORKDIR $ROOT_DIR
COPY allure-docker-api $ROOT_DIR/allure-docker-api
RUN pylint --rcfile=allure-docker-api/.pylintrc allure-docker-api

######
FROM $ARCH/$JDK
ARG ARCH
ARG JDK
ARG BUILD_DATE
ARG BUILD_VERSION
ARG BUILD_REF
ARG ALLURE_RELEASE
ARG ALLURE_REPO
ARG QEMU_ARCH
ARG UID
ARG GID
# Needs to be separate var's for build on Tekton
ARG UID_OCP=1001
ARG GID_OCP=1001

ARG PYTHON_VERSION=3.8

LABEL org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.docker.dockerfile="docker/Dockerfile.ubi8-openjdk-17" \
org.label-schema.license="MIT" \
org.label-schema.name="Allure Framework" \
org.label-schema.version=${BUILD_VERSION} \
org.label-schema.description="Allure Framework is a flexible lightweight multi-language test report tool." \
org.label-schema.url="https://docs.qameta.io/allure/" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/fescobar/allure-docker-service" \
org.label-schema.arch=${ARCH} \
authors="Frank Escobar <[email protected]>, Raymond Mouthaan <[email protected]>"

# QEMU - Quick Emulation
#COPY tmp/qemu-$QEMU_ARCH-static /usr/bin/qemu-$QEMU_ARCH-static

USER root

RUN microdnf update && \
microdnf install -y \
tzdata \
nano \
procps \
python${PYTHON_VERSION} \
python3-pip \
unzip && \
ln -s /usr/bin/python3 /usr/bin/python && \
pip3 install --upgrade pip && \
python${PYTHON_VERSION} -m pip install --upgrade pip setuptools wheel waitress && \
python${PYTHON_VERSION} -m pip install -v Flask==3.0.2 Flask-JWT-Extended==4.6.0 flask-swagger-ui==4.11.1 requests==2.31.0 && \
curl ${ALLURE_REPO}/${ALLURE_RELEASE}/allure-commandline-${ALLURE_RELEASE}.zip -L -o /tmp/allure-commandline.zip && \
unzip -q /tmp/allure-commandline.zip -d / && \
microdnf remove -y unzip && \
rm -rf /tmp/* && \
rm -rf /var/lib/apt/lists/* && \
chmod -R +x /allure-$ALLURE_RELEASE/bin && \
mkdir -p /app

RUN groupadd --gid ${GID_OCP} allure \
&& useradd --uid ${UID_OCP} --gid allure --shell /bin/bash --create-home allure

ENV PYTHON_VERSION=${PYTHON_VERSION}
ENV ROOT=/app
ENV ALLURE_HOME=/allure-$ALLURE_RELEASE
ENV ALLURE_HOME_SL=/allure
ENV PATH=$PATH:$ALLURE_HOME/bin
ENV ALLURE_RESOURCES=$ROOT/resources
ENV RESULTS_DIRECTORY=$ROOT/allure-results
ENV REPORT_DIRECTORY=$ROOT/allure-report
ENV RESULTS_HISTORY=$RESULTS_DIRECTORY/history
ENV REPORT_HISTORY=$REPORT_DIRECTORY/history
ENV ALLURE_VERSION=$ROOT/version
ENV EMAILABLE_REPORT_FILE_NAME='emailable-report-allure-docker-service.html'
ENV STATIC_CONTENT=$ROOT/allure-docker-api/static
ENV STATIC_CONTENT_PROJECTS=$STATIC_CONTENT/projects
ENV DEFAULT_PROJECT=default
ENV DEFAULT_PROJECT_ROOT=$STATIC_CONTENT_PROJECTS/$DEFAULT_PROJECT
ENV DEFAULT_PROJECT_RESULTS=$DEFAULT_PROJECT_ROOT/results
ENV DEFAULT_PROJECT_REPORTS=$DEFAULT_PROJECT_ROOT/reports
ENV EXECUTOR_FILENAME=executor.json

RUN echo -n $(allure --version) > ${ALLURE_VERSION} && \
echo "ALLURE_VERSION: "$(cat ${ALLURE_VERSION}) && \
mkdir $ALLURE_HOME_SL && \
ln -s $ALLURE_HOME/* $ALLURE_HOME_SL && \
ln -s $STATIC_CONTENT_PROJECTS $ROOT/projects && \
ln -s $DEFAULT_PROJECT_REPORTS $ROOT/default-reports

WORKDIR $ROOT
COPY --chown=allure:allure allure-docker-api $ROOT/allure-docker-api
COPY --chown=allure:allure allure-docker-scripts $ROOT/
RUN chmod +x $ROOT/*.sh && \
mkdir $RESULTS_DIRECTORY && \
mkdir -p $DEFAULT_PROJECT_REPORTS/latest && \
ln -sf $RESULTS_DIRECTORY $DEFAULT_PROJECT_RESULTS && \
ln -sf $DEFAULT_PROJECT_REPORTS/latest $REPORT_DIRECTORY && \
allure generate -c -o /tmp/resources && \
mkdir $ALLURE_RESOURCES && \
cp /tmp/resources/app.js $ALLURE_RESOURCES && \
cp /tmp/resources/styles.css $ALLURE_RESOURCES

RUN chown -R allure:allure $ROOT

VOLUME [ "$RESULTS_DIRECTORY" ]

ENV DEPRECATED_PORT=4040
ENV PORT=5050

EXPOSE $DEPRECATED_PORT
EXPOSE $PORT

#HEALTHCHECK --interval=10s --timeout=60s --retries=3 \
# CMD curl -f http://localhost:$PORT || exit 1

RUN chmod -R g=u /etc/passwd /home /app \
&& chgrp -R 0 /home /app

USER ${UID_OCP}

CMD $ROOT/handleUser.sh && $ROOT/runAllureDeprecated.sh & $ROOT/runAllureApp.sh & $ROOT/checkAllureResultsFiles.sh