ansible/roles/openshift-apps/release-monitoring/templates/buildconfig.yml
Michal Konecny 540c1ae874 [release-monitoring] Update staging deployment to F40
As tested locally F40 container deployment works, but let's test it on staging first.

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
2024-05-16 15:32:10 +02:00

122 lines
3.9 KiB
YAML

---
apiVersion: build.openshift.io/v1
items:
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
build: release-monitoring-web-build
name: release-monitoring-web-build
spec:
runPolicy: Serial
source:
dockerfile: |-
{% if env == 'staging' %}
FROM fedora:40
{% else %}
FROM fedora:38
{% endif %}
LABEL \
name="release-monitoring-web" \
vendor="Fedora Infrastructure" \
license="MIT"
RUN dnf install -y \
git \
httpd \
graphviz \
fedora-messaging \
npm \
poetry \
python3-alembic \
python3-beautifulsoup4 \
python3-arrow \
python3-dateutil \
python3-defusedxml \
python3-flask-login \
python3-flask-wtf \
python3-jinja2 \
python3-mod_wsgi \
python3-ordered-set \
python3-pip \
python3-psycopg2 \
python3-semver \
python3-sqlalchemy \
python3-sqlalchemy_schemadisplay \
python3-sseclient \
python3-straight-plugin \
python3-toml \
python3-wtforms && \
dnf autoremove -y && \
dnf clean all -y
# This is needed because the version 1.7.0 currently available in Fedora
# doesn't work with sphinx 5+ and fails when building documentation
RUN pip-3 install sphinxcontrib-httpdomain
RUN git clone https://github.com/fedora-infra/anitya.git && \
pushd anitya && \
{% if env == 'staging' %}
git checkout staging && \
{% else %}
git checkout production && \
{% endif %}
poetry build && \
pip-3 install dist/*.whl && \
pushd docs && \
mkdir -p images && \
python3 generate_db_schema && \
sphinx-build -b html . _build/html && \
mkdir -p ../anitya/static/docs/ && \
cp -r _build/html/* ../anitya/static/docs/ && \
popd && \
# Uninstall the existing anitya installation first
pip-3 uninstall -y anitya && \
# Install javascript dependencies
pushd anitya/static && \
npm install && \
popd && \
poetry build && \
pip-3 install dist/*.whl && \
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.12/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.12/site-packages/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: {}