130 lines
4.4 KiB
YAML
130 lines
4.4 KiB
YAML
---
|
|
apiVersion: v1
|
|
items:
|
|
- apiVersion: v1
|
|
kind: BuildConfig
|
|
metadata:
|
|
labels:
|
|
build: release-monitoring-web-build
|
|
name: release-monitoring-web-build
|
|
spec:
|
|
runPolicy: Serial
|
|
source:
|
|
dockerfile: |-
|
|
FROM fedora:36
|
|
LABEL \
|
|
name="release-monitoring-web" \
|
|
vendor="Fedora Infrastructure" \
|
|
license="MIT"
|
|
RUN dnf install -y \
|
|
git \
|
|
httpd \
|
|
graphviz \
|
|
fedora-messaging \
|
|
{% if env == 'staging' %}
|
|
poetry \
|
|
{% endif %}
|
|
python3-alembic \
|
|
python3-beautifulsoup4 \
|
|
python3-arrow \
|
|
python3-dateutil \
|
|
python3-defusedxml \
|
|
python3-flask-login \
|
|
python3-flask-restful \
|
|
python3-flask-wtf \
|
|
python3-jinja2 \
|
|
python3-mod_wsgi \
|
|
python3-ordered-set \
|
|
python3-pip \
|
|
python3-psycopg2 \
|
|
python3-semver \
|
|
python3-sphinxcontrib-httpdomain \
|
|
python3-sqlalchemy \
|
|
python3-sqlalchemy_schemadisplay \
|
|
python3-sseclient \
|
|
python3-straight-plugin \
|
|
python3-toml \
|
|
python3-wtforms && \
|
|
dnf autoremove -y && \
|
|
dnf clean all -y
|
|
# Install newer version of flask-login than what is available in Fedora 36
|
|
# It has issue with werkzeug package available in Fedora
|
|
# See https://github.com/maxcountryman/flask-login/pull/691 for more info
|
|
RUN pip install Flask-Login==0.6.2
|
|
RUN git clone https://github.com/fedora-infra/anitya.git && \
|
|
pushd anitya && \
|
|
{% if env == 'staging' %}
|
|
git checkout staging && \
|
|
poetry build && \
|
|
pip-3 install dist/*.whl && \
|
|
{% else %}
|
|
git checkout production && \
|
|
python3 setup.py install && \
|
|
{% endif %}
|
|
pushd docs && \
|
|
mkdir -p images && \
|
|
python3 generate_db_schema && \
|
|
sphinx-build-3 -b html . _build/html && \
|
|
mkdir -p ../anitya/static/docs/ && \
|
|
cp -r _build/html/* ../anitya/static/docs/ && \
|
|
popd && \
|
|
{% if env == 'staging' %}
|
|
# Uninstall the existing anitya installation first
|
|
pip-3 uninstall anitya && \
|
|
# Move bootstrap to correct folder
|
|
rm -f anitya/static/bootstrap && \
|
|
mv anitya/static/bootstrap-3.3.4-fedora anitya/static/bootstrap && \
|
|
poetry build && \
|
|
pip-3 install dist/*.whl && \
|
|
{% else %}
|
|
python3 setup.py install && \
|
|
pip-3 install . && \
|
|
{% endif %}
|
|
popd
|
|
# popd && \
|
|
# rm -rf anitya
|
|
{% if env == 'staging' %}
|
|
# Let's use staging auth server in staging
|
|
RUN sed -i 's/id.fedoraproject.org/id.stg.fedoraproject.org/g' /usr/local/lib/python3.10/site-packages/social_core/backends/fedora.py
|
|
{% endif %}
|
|
|
|
# Hotfix for social_auth-sqlalchemy
|
|
# Could be removed when we switch to something else
|
|
{% if env == 'staging' %}
|
|
RUN sed -i 's/base64.encodestring/base64.encodebytes/g' /usr/local/lib/python3.10/site-packages/social_sqlalchemy/storage.py
|
|
{% else %}
|
|
RUN sed -i 's/base64.encodestring/base64.encodebytes/g' /usr/local/lib/python3.10/site-packages/social_auth_storage_sqlalchemy-1.1.0-py3.10.egg/social_sqlalchemy/storage.py
|
|
{% endif %}
|
|
RUN mkdir /httpdir
|
|
RUN chmod 777 /httpdir
|
|
EXPOSE 8080
|
|
EXPOSE 9940
|
|
type: Dockerfile
|
|
git:
|
|
uri: https://github.com/fedora-infra/anitya.git
|
|
{% if env == 'staging' %}
|
|
ref: staging
|
|
{% else %}
|
|
ref: production
|
|
{% endif %}
|
|
strategy:
|
|
type: Docker
|
|
dockerStrategy:
|
|
noCache: true
|
|
output:
|
|
to:
|
|
kind: ImageStreamTag
|
|
name: release-monitoring-web:latest
|
|
triggers:
|
|
{% if stg_anitya_github_secret is defined and env == 'staging' %}
|
|
- type: GitHub
|
|
github:
|
|
secret: "{{ stg_anitya_github_secret }}"
|
|
{% elif anitya_github_secret is defined and env == 'production' %}
|
|
- type: GitHub
|
|
github:
|
|
secret: "{{ anitya_github_secret }}"
|
|
{% endif %}
|
|
- type: ImageChange
|
|
kind: List
|
|
metadata: {}
|