From c9240d25f5623c84553e5562d155ae1c73e2c40f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 24 2020 18:44:11 +0000 Subject: [PATCH 1/6] Install python3-email-validator in our base container Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/containers/base b/dev/containers/base index 5b58ce6..0c6d12a 100644 --- a/dev/containers/base +++ b/dev/containers/base @@ -20,6 +20,8 @@ RUN dnf -y update && \ python3-pygit2 python3-redis python3-requests \ python3-setuptools python3-six python3-sqlalchemy \ python3-straight-plugin python3-trololio \ - python-unversioned-command python3-wtforms which && \ + python-unversioned-command python3-wtforms which \ + python3-email-validator \ + && \ dnf clean all From 2ab5b7c76571d5d7f0fe1df7024a796676159294 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 27 2020 10:18:22 +0000 Subject: [PATCH 2/6] Remove email_validator from the requirements.txt on CentOS 7 That requirement is only valid where newer version of wtforms is available and that's not the case for CentOS 7. Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/containers/centos7-rpms-py2 b/dev/containers/centos7-rpms-py2 index 6b06846..48a9537 100644 --- a/dev/containers/centos7-rpms-py2 +++ b/dev/containers/centos7-rpms-py2 @@ -50,6 +50,7 @@ RUN \ sed -i -e "s|;python_version<=\"2.7\"||" /pagure/requirements.txt && \ sed -i -e "s|python3-openid;python_version>=\"3.0\"||" \ /pagure/requirements.txt && \ + sed "|email_validator|d" /pagure/requirements.txt && \ cd /pagure && python setup.py build From c058cabd930be47c2ecb9d4bc295a69723de54fa Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 27 2020 10:19:28 +0000 Subject: [PATCH 3/6] Add the possibility to specify the branch or repo via CLI arguments Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/run-tests-container.py b/dev/run-tests-container.py index ff7e99c..3531a83 100755 --- a/dev/run-tests-container.py +++ b/dev/run-tests-container.py @@ -40,6 +40,21 @@ def setup_parser(): "of running the tests", ) + parser.add_argument( + "--repo", + dest="repo", + default="https://pagure.io/pagure.git", + help="URL of the public repo to use as source, can be overridden using " + "the REPO environment variable", + ) + parser.add_argument( + "--branch", + dest="branch", + default="master", + help="Branch of the repo to use as source, can be overridden using " + "the BRANCH environment variable", + ) + return parser @@ -72,25 +87,22 @@ if __name__ == "__main__": for idx, container_name in enumerate(container_names): if args.skip_build is not False: print("------ Building Container Image -----") - output_code = sp.call( - [ - "podman", - "build", - "--build-arg", - "branch={}".format(os.environ.get("BRANCH") or "master"), - "--build-arg", - "repo={}".format( - os.environ.get("REPO") - or "https://pagure.io/pagure.git" - ), - "--rm", - "-t", - container_name, - "-f", - "dev/containers/%s" % container_files[idx], - "dev/containers", - ] - ) + cmd = [ + "podman", + "build", + "--build-arg", + "branch={}".format(os.environ.get("BRANCH") or args.branch), + "--build-arg", + "repo={}".format(os.environ.get("REPO") or args.repo), + "--rm", + "-t", + container_name, + "-f", + "dev/containers/%s" % container_files[idx], + "dev/containers", + ] + print(" ".join(cmd)) + output_code = sp.call(cmd) if output_code: print("Failed building: %s", container_name) break @@ -113,11 +125,9 @@ if __name__ == "__main__": os.getcwd(), container_files[idx] ), "-e", - "BRANCH={}".format(os.environ.get("BRANCH") or "master"), + "BRANCH={}".format(os.environ.get("BRANCH") or args.branch), "-e", - "REPO={}".format( - os.environ.get("REPO") or "https://pagure.io/pagure.git" - ), + "REPO={}".format(os.environ.get("REPO") or args.repo), "--entrypoint=/bin/bash", container_name, ] @@ -136,11 +146,9 @@ if __name__ == "__main__": os.getcwd(), container_files[idx] ), "-e", - "BRANCH={}".format(os.environ.get("BRANCH") or "master"), + "BRANCH={}".format(os.environ.get("BRANCH") or args.branch), "-e", - "REPO={}".format( - os.environ.get("REPO") or "https://pagure.io/pagure.git" - ), + "REPO={}".format(os.environ.get("REPO") or args.repo), "-e", "TESTCASE={}".format(args.test_case or ""), container_name, From 618db0704c21b842efb96325526e2191a670c74c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 27 2020 10:27:19 +0000 Subject: [PATCH 4/6] fixup centos7 Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/containers/centos7-rpms-py2 b/dev/containers/centos7-rpms-py2 index 48a9537..49f2314 100644 --- a/dev/containers/centos7-rpms-py2 +++ b/dev/containers/centos7-rpms-py2 @@ -50,7 +50,7 @@ RUN \ sed -i -e "s|;python_version<=\"2.7\"||" /pagure/requirements.txt && \ sed -i -e "s|python3-openid;python_version>=\"3.0\"||" \ /pagure/requirements.txt && \ - sed "|email_validator|d" /pagure/requirements.txt && \ + sed -i "/email_validator/d" /pagure/requirements.txt && \ cd /pagure && python setup.py build From a40039178c84760f523edfc29b00572be5b388ce Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 27 2020 10:30:27 +0000 Subject: [PATCH 5/6] Migrate the Fedora 29 container to Fedora 31 Signed-off-by: Pierre-Yves Chibon --- diff --git a/.cico.pipeline b/.cico.pipeline index 2e0b224..3dfb3d0 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -71,7 +71,7 @@ node('pagure') { throw e } finally { stage('Sync Artifacts'){ - syncfromduffynode('pagure/results_f29-rpms-py3/') + syncfromduffynode('pagure/results_f31-rpms-py3/') syncfromduffynode('pagure/results_centos7-rpms-py2/') syncfromduffynode('pagure/results_fedora-pip-py3/') } @@ -86,7 +86,7 @@ node('pagure') { } stage('Archive Artifacts'){ - archiveArtifacts artifacts: 'pagure/results_f29-rpms-py3/' + archiveArtifacts artifacts: 'pagure/results_f31-rpms-py3/' archiveArtifacts artifacts: 'pagure/results_centos7-rpms-py2/' archiveArtifacts artifacts: 'pagure/results_fedora-pip-py3/' } diff --git a/dev/containers/f29-rpms-py3 b/dev/containers/f29-rpms-py3 deleted file mode 100644 index 35baaed..0000000 --- a/dev/containers/f29-rpms-py3 +++ /dev/null @@ -1,37 +0,0 @@ -FROM fedora:29 - -ARG repo=https://pagure.io/pagure.git -ARG branch=master - -ENV REPO=$repo -ENV BRANCH=$branch - -RUN dnf -y --enablerepo=updates-testing install \ - python3-setuptools \ - python3-coverage \ - python3-nose \ - python3-mock \ - python3-docutils \ - python3-black \ - python3-flake8 \ - redis \ - which \ - git - -RUN cd / \ - && GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone -b $BRANCH $REPO \ - && chmod +x /pagure/dev/containers/runtests_py3.sh \ - && sed -i -e 's|\["alembic",|\["alembic-3",|' /pagure/tests/test_alembic.py - -# Install all the requirements from the spec file and replace the macro -# %{python_pkgversion} by '3' which thus installs all the py3 version of -# the dependencies. -RUN dnf install -y --enablerepo=updates-testing `grep "Requires:" /pagure/files/pagure.spec | \ - awk '{split($0, a, " "); print a[2]}' |grep -v "%{name}" | \ - sed -e "s|%{python_pkgversion}|3|"` && \ - dnf clean all && \ - cd /pagure && python setup.py build - -WORKDIR /pagure -ENTRYPOINT ["/pagure/dev/containers/runtests_py3.sh"] -CMD [] diff --git a/dev/containers/f31-rpms-py3 b/dev/containers/f31-rpms-py3 new file mode 100644 index 0000000..13be567 --- /dev/null +++ b/dev/containers/f31-rpms-py3 @@ -0,0 +1,38 @@ +FROM fedora:31 + +ARG repo=https://pagure.io/pagure.git +ARG branch=master + +ENV REPO=$repo +ENV BRANCH=$branch + +RUN dnf -y --enablerepo=updates-testing install \ + python3-setuptools \ + python3-coverage \ + python3-nose \ + python3-mock \ + python3-docutils \ + python3-black \ + python3-flake8 \ + redis \ + which \ + git + +RUN cd / \ + && GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone -b $BRANCH $REPO \ + && chmod +x /pagure/dev/containers/runtests_py3.sh \ + && sed -i -e 's|\["alembic",|\["alembic-3",|' /pagure/tests/test_alembic.py + +# Install all the requirements from the spec file and replace the macro +# %{python_pkgversion} by '3' which thus installs all the py3 version of +# the dependencies. +RUN sed -i "/Requires: python%{python_pkgversion}-enum34/d" /pagure/files/pagure.spec && \ + dnf install -y --enablerepo=updates-testing `grep "Requires:" /pagure/files/pagure.spec | \ + awk '{split($0, a, " "); print a[2]}' |grep -v "%{name}" | \ + sed -e "s|%{python_pkgversion}|3|"` && \ + dnf clean all && \ + cd /pagure && python setup.py build + +WORKDIR /pagure +ENTRYPOINT ["/pagure/dev/containers/runtests_py3.sh"] +CMD [] diff --git a/dev/run-tests-container.py b/dev/run-tests-container.py index 3531a83..02f5b6b 100755 --- a/dev/run-tests-container.py +++ b/dev/run-tests-container.py @@ -66,19 +66,19 @@ if __name__ == "__main__": container_names = ["pagure-c7-rpms-py2"] container_files = ["centos7-rpms-py2"] elif args.fedora is True: - container_names = ["pagure-f29-rpms-py3"] - container_files = ["f29-rpms-py3"] + container_names = ["pagure-f31-rpms-py3"] + container_files = ["f31-rpms-py3"] elif args.pip is True: container_names = ["pagure-fedora-pip-py3"] container_files = ["fedora-pip-py3"] else: container_names = [ - "pagure-f29-rpms-py3", + "pagure-f31-rpms-py3", "pagure-c7-rpms-py2", "pagure-fedora-pip-py3", ] container_files = [ - "f29-rpms-py3", + "f31-rpms-py3", "centos7-rpms-py2", "fedora-pip-py3", ] diff --git a/run_ci_tests_containers.sh b/run_ci_tests_containers.sh index 515f2e6..3bf8389 100644 --- a/run_ci_tests_containers.sh +++ b/run_ci_tests_containers.sh @@ -21,19 +21,19 @@ echo "Last commits:" git --no-pager log -2 fi -podman build --rm -t pagure-f29-rpms-py3 \ - -f dev/containers/f29-rpms-py3 \ +podman build --rm -t pagure-f31-rpms-py3 \ + -f dev/containers/f31-rpms-py3 \ dev/containers -if [ ! -d `pwd`/results_f29-rpms-py3 ]; then - mkdir `pwd`/results_f29-rpms-py3; +if [ ! -d `pwd`/results_f31-rpms-py3 ]; then + mkdir `pwd`/results_f31-rpms-py3; fi -podman run --rm -it --name pagure-f29-rpms-py3 \ - -v `pwd`/results_f29-rpms-py3:/pagure/results:z \ +podman run --rm -it --name pagure-f31-rpms-py3 \ + -v `pwd`/results_f31-rpms-py3:/pagure/results:z \ -e BRANCH=$BRANCH \ -e REPO=$REPO \ - pagure-f29-rpms-py3 + pagure-f31-rpms-py3 podman build --rm -t pagure-c7-rpms-py2 \ From 439e70001866835e3cf21aed1898758ef09e8965 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 27 2020 13:10:41 +0000 Subject: [PATCH 6/6] Add python-email-validator as a Requires in the spec file Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure.spec b/files/pagure.spec index 638db3e..fecb314 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -75,6 +75,10 @@ Requires: python%{python_pkgversion}-straight-plugin Requires: python%{python_pkgversion}-wtforms %endif +%if 0%{?rhel} && 0%{?rhel} >= 8 +Requires: python%{python_pkgversion}-email-validator +%endif + %if 0%{?rhel} && 0%{?rhel} < 8 Requires: mod_wsgi %else