#514 Release related fixes and changes vol.2
Merged 5 years ago by msuchy. Opened 5 years ago by frostyx.
copr/ frostyx/copr DockerTestEnv-F28-2.0  into  master

@@ -53,7 +53,7 @@ 

  

      rlPhaseStartTest

          rlRun "copr-cli create ${NAME_PREFIX}BuildSpec --enable-net on --chroot fedora-27-x86_64" 0

-         rlRun "copr-cli build ${NAME_PREFIX}BuildSpec files/vera.spec" 0

+         rlRun "copr-cli build ${NAME_PREFIX}BuildSpec $HERE/files/vera.spec" 0

          rlRun "copr-cli delete ${NAME_PREFIX}BuildSpec"

      rlPhaseEnd

  

@@ -35,10 +35,10 @@ 

  NAME_PREFIX="$OWNER/$NAME_VAR"

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  

  echo "FRONTEND_URL = $FRONTEND_URL"
@@ -69,7 +69,10 @@ 

  

      rlPhaseStartTest

          rlRun "copr-cli create ${NAME_PREFIX}TestBug1457888 --chroot fedora-27-x86_64" 0

-         rlRun "copr-cli buildmock ${NAME_PREFIX}TestBug1457888 --scm-url https://pagure.io/module-macros.git --spec module-macros.spec" 0

+         # The Bug 1457888 specifically concerns the Mock SCM method

+         # but since it was deprecated and even removed from the code,

+         # we are going to use its successor for this test

+         rlRun "copr-cli buildscm ${NAME_PREFIX}TestBug1457888 --clone-url https://pagure.io/module-macros.git --spec module-macros.spec" 0

          rlRun "copr-cli delete ${NAME_PREFIX}TestBug1457888"

      rlPhaseEnd

  

@@ -35,10 +35,10 @@ 

  NAME_PREFIX="$OWNER/$NAME_VAR"

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  

  echo "FRONTEND_URL = $FRONTEND_URL"
@@ -70,13 +70,16 @@ 

      rlPhaseStartTest

          # Test for https://pagure.io/copr/copr/issue/67

          rlRun "copr-cli create ${NAME_PREFIX}TestBugPagure67 --chroot fedora-28-x86_64" 0

-         rlRun "copr-cli add-package-tito ${NAME_PREFIX}TestBugPagure67 --name test_package_tito --git-url http://github.com/clime/example.git --test on --webhook-rebuild on --git-branch foo --git-dir bar"

+         # The issue #67 specifically concerns the *-package-tito commands,

+         # but since they were deprecated and even removed from the code,

+         # we are going to use its successor for this test

+         rlRun "copr-cli add-package-scm ${NAME_PREFIX}TestBugPagure67 --name test_package_tito --clone-url http://github.com/clime/example.git --method tito_test --webhook-rebuild on --commit foo --subdir bar"

          OUTPUT=`mktemp`

          rlRun "copr-cli get-package ${NAME_PREFIX}TestBugPagure67 --name test_package_tito > $OUTPUT"

-         rlAssertEquals "" `cat $OUTPUT | jq '.webhook_rebuild'` "true"

-         rlRun "copr-cli edit-package-tito ${NAME_PREFIX}TestBugPagure67 --name test_package_tito --git-url http://github.com/clime/example.git --test on --git-branch foo --git-dir bar"

+         rlAssertEquals "" `cat $OUTPUT | jq '.auto_rebuild'` "true"

+         rlRun "copr-cli edit-package-scm ${NAME_PREFIX}TestBugPagure67 --name test_package_tito --clone-url http://github.com/clime/example.git --method tito_test --commit foo --subdir bar"

          rlRun "copr-cli get-package ${NAME_PREFIX}TestBugPagure67 --name test_package_tito > $OUTPUT"

-         rlAssertEquals "" `cat $OUTPUT | jq '.webhook_rebuild'` "true"

+         rlAssertEquals "" `cat $OUTPUT | jq '.auto_rebuild'` "true"

          rlRun "copr-cli delete ${NAME_PREFIX}TestBugPagure67"

          rm $OUTPUT

      rlPhaseEnd

@@ -11,7 +11,7 @@ 

  export OUT=$TESTPATH/action-results.out.json

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  

  

@@ -34,10 +34,10 @@ 

  NAME_VAR="TEST$(date +%s)" # names should be unique

  NAME_PREFIX="$OWNER/$NAME_VAR"

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  

  echo "FRONTEND_URL = $FRONTEND_URL"
@@ -46,7 +46,7 @@ 

  # Some tests might want to install built packages

  # Therefore, these packages need to be built for the same fedora version

  # as this script is going to be run from

- CHROOT="fedora-27-x86_64"

+ CHROOT="fedora-28-x86_64"

  

  SCRIPTPATH="$( builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

  

@@ -30,10 +30,10 @@ 

  . /usr/share/beakerlib/beakerlib.sh || exit 1

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  USER=`copr-cli whoami`

  
@@ -146,7 +146,7 @@ 

          PACKAGES=`mktemp`

          wait_for_finished_module "module-test-macros-module-beakertest-$DATE" 1 600 $PACKAGES

  

-         SRPM=`rpmbuild -bs files/test-macros.spec |grep Wrote: |cut -d ' ' -f2`

+         SRPM=`rpmbuild -bs $HERE/files/test-macros.spec |grep Wrote: |cut -d ' ' -f2`

          copr-cli build "module-test-macros-module-beakertest-$DATE" $SRPM

          ID=`copr-cli get-package module-test-macros-module-beakertest-$DATE --name test-macros --with-all-builds | jq '.builds[0].id'`

          TMP=`mktemp -d`

@@ -35,10 +35,10 @@ 

  NAME_PREFIX="$OWNER/$NAME_VAR"

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  

  echo "FRONTEND_URL = $FRONTEND_URL"

@@ -35,10 +35,10 @@ 

  NAME_PREFIX="$OWNER/$NAME_VAR"

  

  if [[ ! $FRONTEND_URL ]]; then

-     FRONTEND_URL="http://copr-fe-dev.cloud.fedoraproject.org"

+     FRONTEND_URL="https://copr-fe-dev.cloud.fedoraproject.org"

  fi

  if [[ ! $BACKEND_URL ]]; then

-     BACKEND_URL="http://copr-be-dev.cloud.fedoraproject.org"

+     BACKEND_URL="https://copr-be-dev.cloud.fedoraproject.org"

  fi

  

  echo "FRONTEND_URL = $FRONTEND_URL"
@@ -69,9 +69,9 @@ 

  

      rlPhaseStartTest

          rlRun "copr-cli create ${NAME_PREFIX}AuthTest --chroot fedora-27-x86_64" 0

-         rlRun "copr-cli build ${NAME_PREFIX}AuthTest files/auth_test.src.rpm" 0

-         rlRun "copr-cli --config files/copr-config-bad build ${NAME_PREFIX}AuthTest files/auth_test.src.rpm" 1

-         rlRun "copr-cli --config files/copr-config-bad build ${NAME_PREFIX}AuthTest files/auth_test.src.rpm | grep 'Uploading package'" 1

+         rlRun "copr-cli build ${NAME_PREFIX}AuthTest $HERE/files/auth_test.src.rpm" 0

+         rlRun "copr-cli --config $HERE/files/copr-config-bad build ${NAME_PREFIX}AuthTest $HERE/files/auth_test.src.rpm" 1

+         rlRun "copr-cli --config $HERE/files/copr-config-bad build ${NAME_PREFIX}AuthTest $HERE/files/auth_test.src.rpm | grep 'Uploading package'" 1

          rlRun "copr-cli delete ${NAME_PREFIX}AuthTest" 0

      rlPhaseEnd

  

file modified
+7 -5
@@ -465,16 +465,17 @@ 

  

      def action_download_build(self, args):

          build = self.client.build_proxy.get(args.build_id)

-         base_len = len(os.path.split(build.results))

+         base_len = len(os.path.split(build.repo_url))

+         build_chroots = self.client.build_chroot_proxy.get_list(args.build_id)

  

-         for chroot, url in build.results_by_chroot.items():

-             if args.chroots and chroot not in args.chroots:

+         for chroot in build_chroots:

+             if args.chroots and chroot.name not in args.chroots:

                  continue

  

              cmd = "wget -r -nH --no-parent --reject 'index.html*'".split(' ')

-             cmd.extend(['-P', os.path.join(args.dest, chroot)])

+             cmd.extend(['-P', os.path.join(args.dest, chroot.name)])

              cmd.extend(['--cut-dirs', str(base_len + 4)])

-             cmd.append(url)

+             cmd.append(chroot.result_url)

              subprocess.call(cmd)

  

      @requires_api_auth
@@ -863,6 +864,7 @@ 

              help='mock chroot to build sources for the SRPM in')

      parser_custom_args_parent.add_argument(

              '--script-builddeps',

+             type=lambda x: x.split(),  # Store the deps as a list

              help='space separated list of packages needed to build the sources')

      parser_custom_args_parent.add_argument(

              '--script-resultdir',

file modified
+30 -24
@@ -281,19 +281,22 @@ 

  

  @mock.patch('copr_cli.main.subprocess')

  @mock.patch('copr.v3.proxies.build.BuildProxy.get')

+ @mock.patch('copr.v3.proxies.build_chroot.BuildChrootProxy.get_list')

  @mock.patch('copr_cli.main.config_from_file', return_value=mock_config)

- def test_download_build(config_from_file, build_proxy_get, mock_sp, capsys):

-     build_proxy_get.return_value = \

-         MagicMock(

-             data={"chroots": {

-                 u'epel-6-x86_64': u'succeeded', u'epel-6-i386': u'succeeded'

-             }},

-             results="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20",

-             results_by_chroot={

-                 u'epel-6-x86_64': u'http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20',

-                 u'epel-6-i386': u'http://example.com/results/epel-6-i386/python-copr-1.50-1.fc20',

-             }

-         )

+ def test_download_build(config_from_file, build_chroot_proxy_get_list, build_proxy_get, mock_sp, capsys):

+     build_proxy_get.return_value = MagicMock(

+         repo_url="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20")

+ 

+     mock_ch1 = MagicMock()

+     mock_ch1.configure_mock(

+         name="epel-6-x86_64",

+         result_url="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20")

+ 

+     mock_ch2 = MagicMock()

+     mock_ch2.configure_mock(

+         name="epel-6-i386",

+         result_url="http://example.com/results/epel-6-i386/python-copr-1.50-1.fc20")

+     build_chroot_proxy_get_list.return_value = [mock_ch1, mock_ch2]

  

      mock_sp.call.return_value = None

      main.main(argv=["download-build", "foo"])
@@ -318,19 +321,22 @@ 

  

  @mock.patch('copr_cli.main.subprocess')

  @mock.patch('copr.v3.proxies.build.BuildProxy.get')

+ @mock.patch('copr.v3.proxies.build_chroot.BuildChrootProxy.get_list')

  @mock.patch('copr_cli.main.config_from_file', return_value=mock_config)

- def test_download_build_select_chroot(config_from_file, build_proxy_get, mock_sp, capsys):

-     build_proxy_get.return_value = \

-         MagicMock(

-             data={"chroots": {

-                 u'epel-6-x86_64': u'succeeded', u'epel-6-i386': u'succeeded'

-             }},

-             results="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20",

-             results_by_chroot={

-                 u'epel-6-x86_64': u'http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20',

-                 u'epel-6-i386': u'http://example.com/results/epel-6-i386/python-copr-1.50-1.fc20',

-             }

-         )

+ def test_download_build_select_chroot(config_from_file, build_chroot_proxy_get_list, build_proxy_get, mock_sp, capsys):

+     build_proxy_get.return_value = MagicMock(

+         repo_url="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20")

+ 

+     mock_ch1 = MagicMock()

+     mock_ch1.configure_mock(

+         name="epel-6-x86_64",

+         result_url="http://example.com/results/epel-6-x86_64/python-copr-1.50-1.fc20")

+ 

+     mock_ch2 = MagicMock()

+     mock_ch2.configure_mock(

+         name="epel-6-i386",

+         result_url="http://example.com/results/epel-6-i386/python-copr-1.50-1.fc20")

+     build_chroot_proxy_get_list.return_value = [mock_ch1, mock_ch2]

  

      mock_sp.call.return_value = None

      main.main(argv=["download-build", "foo", "-r", "epel-6-x86_64"])

@@ -34,6 +34,9 @@ 

          "is_background": "background",

          "memory_limit": "memory_reqs",

          "source_build_method": "srpm_build_method",

+         "script_builddeps": "builddeps",

+         "script_resultdir": "resultdir",

+         "script_chroot": "chroot",

      }

      output = input.copy()

      for from_name, to_name in replace.items():
@@ -68,7 +71,7 @@ 

  @api_login_required

  def package_add(ownername, projectname, package_name, source_type_text):

      copr = get_copr(ownername, projectname)

-     data = rename_fields(without_empty_fields(get_input()))

+     data = rename_fields(get_form_compatible_data(preserve=["python_versions"]))

      process_package_add_or_edit(copr, source_type_text, data=data)

      package = PackagesLogic.get(copr.main_dir.id, package_name).first()

      return flask.jsonify(to_dict(package))
@@ -78,7 +81,7 @@ 

  @api_login_required

  def package_edit(ownername, projectname, package_name, source_type_text=None):

      copr = get_copr(ownername, projectname)

-     data = rename_fields(without_empty_fields(get_input()))

+     data = rename_fields(get_form_compatible_data(preserve=["python_versions"]))

      try:

          package = PackagesLogic.get(copr.main_dir.id, package_name)[0]

          source_type_text = source_type_text or package.source_type_text
@@ -110,7 +113,7 @@ 

  @api_login_required

  def package_build():

      copr = get_copr()

-     data = rename_fields(get_form_compatible_data())

+     data = rename_fields(get_form_compatible_data(preserve=["python_versions"]))

      form = forms.RebuildPackageFactory.create_form_cls(copr.active_chroots)(data, csrf_enabled=False)

      try:

          package = PackagesLogic.get(copr.main_dir.id, form.package_name.data)[0]

@@ -2,11 +2,15 @@ 

  from werkzeug.datastructures import MultiDict

  

  

- def get_form_compatible_data():

+ def get_form_compatible_data(preserve=None):

      input = without_empty_fields(get_input_dict())

-     output = {}

+     output = dict(input).copy()

  

      for k, v in input.items():

+         # Preserve the original value and return it unchanged

+         if k in (preserve or []):

+             continue

+ 

          # Transform lists to strings separated with spaces

          if type(v) == list:

              v = " ".join(map(str, v))

file modified
+7
@@ -12,8 +12,11 @@ 

          type httpd_t;

          type git_script_t;

          type git_user_content_t;

+         type gpg_web_t;

          type syslogd_t;

          type auditd_log_t;

+         type httpd_var_lib_t;

+         type user_tmp_t;

          class dir { write getattr read remove_name open add_name create rmdir};

          class file { rename write getattr read create open lock unlink};

  }
@@ -45,3 +48,7 @@ 

  

  #keygen

  allow httpd_t httpd_var_lib_t:sock_file { create getattr setattr unlink write };

+ allow gpg_web_t httpd_var_lib_t:dir { search getattr read write add_name remove_name };

+ allow gpg_web_t httpd_var_lib_t:file { getattr read open write create unlink rename link };

+ allow gpg_web_t httpd_var_lib_t:sock_file { getattr write create };

+ allow gpg_web_t user_tmp_t:dir { search };

There is one more batch of small unrelated commits needed for the release. Please see commit descriptions for more info.
The PR#508 is prerequisite for this PR.

Changes in this PR addresses issues in following sanity tests:

build-spec.sh
bz1457888.sh
pagure67.sh
runtest-custom-method.sh
runtest-fork.sh
scm.sh 
upload_authentication.sh

The runtest-custom-method.sh throws some other fails. I've contacted @praiskup offlist, regarding them. Also, the runtest-modules.sh will be covered by separate PR.

rebased onto d881f5d3e6817e5d424f20e7088eaa7aa4eede63

5 years ago

2 new commits added

  • [frontend][cli] fix storing the custom script parameters
  • [frontend] use get_form_compatible_data even for apiv3_packages
5 years ago
  • The prerequisite PR#508 is already merged, so we don't need to worry about that
  • I've rebased the branch from master
  • I've added two more commits dealing with the runtest-custom-method.sh issues. Only one failing needs to be resolved.

9 new commits added

  • [frontend][cli] fix storing the custom script parameters
  • [frontend] use get_form_compatible_data even for apiv3_packages
  • [beaker-tests-sanity] increment chroot to F28
  • [cli] properly rewrite download-build to use APIv3
  • [beaker-tests-sanity] APIv3 returns auto_rebuild property instead of webhook_rebuild
  • [beaker-tests-sanity] buildscm instead of buildtito and buildmock
  • [beaker-tests-sanity] use https urls for fe-dev and be-dev
  • [selinux] add more rules for keygen (follow-up to 4f689743)
  • [beaker-tests-sanity] allow to run tests from any directory
5 years ago

rebased onto a6319a1e5498ce20de82416e17cdac6e24443299

5 years ago

Pull-Request has been merged by msuchy

5 years ago