conan-io / conan-package-tools

Conan Package Tools. Helps with massive package creation and CI integration (Travis CI, Appveyor...)
MIT License
165 stars 70 forks source link

No upload when CONAN_LOGIN_USERNAME, CONAN_USERNAME or Conanfile.user are defined and different #606

Open NokiDev opened 2 years ago

NokiDev commented 2 years ago

Description of Problem

CPT uses CONAN_LOGIN_USERNAME as conan user, rather than defined variable CONAN_USERNAME or Conanfile.user I believe this leads to a reference mismatch, making the upload of artifacts not executed (the process stops after running test_package, without a log). See runner.py#171.

I'm not sure why the user used by cpt is not the one defined either with CONAN_USERNAME or Conanfile.user, but it happened when upgrading conan from 1.45 to 1.52.0. So it might be a conan API thing.

The workaround, we use for now is to define directly the user in ConanMultiPackager(user=my_package_user)

Environment Details

Steps to reproduce (Include if Applicable)

The following recipe :

class MyRecipeConan(ConanFile):
    name = "my-recipe"
    license = ""
    user = "my_package_user"

    requires = ()

    settings = {}
    short_paths = False
    exports_sources = ["*"]
    generators = "txt"

    def generate(self):
        pass

    def layout(self):
        pass

    def build(self):
        pass

    def build_id(self):
        self.info_build.clear()

    def package(self):
        self.copy("*")

    def package_id(self):
        self.info.clear()

The following build.py :

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from cpt.packager import ConanMultiPackager

if __name__ == "__main__":
    builder = ConanMultiPackager(
    archs=['x86_64'], #Don't really matters actually.
        visual_versions=['16'],
        build_types=['RelWithDebInfo'],
        visual_runtimes=['MD',]
    )
    builder.add_common_builds()
    builder.run()

Setting the following in environment :

CONAN_USERNAME="my_package_user"
CONAN_CHANNEL="stable"
CONAN_LOGIN_USERNAME="my_login_user"
CONAN_PASSWORD="mypassword"

Running python ./build.py

Build logs (Include if Available)

Notice the mismatch between CPT user in configuration and the actual user of the package.

+--------------------+-----------------------------------------------------------------+
| Configuration      | value                                                           |
|--------------------+-----------------------------------------------------------------|
| name               | my-recipe                                                       |
| version            | 0.0.0                                                           |
| user               | my_login_user                                                   |
| channel            | stable                                                          |
| build_modes        |                                                                 |
| require_overrides  |                                                                 |
| profile_name       | C:\Windows\TEMP\tmprm11l096conan_package_tools_profiles\profile |
| profile_build_name |                                                                 |
+--------------------+-----------------------------------------------------------------+
Exporting package recipe
my-recipe/0.0.0@my_package_user/stable exports_sources: Copied 1 file: .gitignore
my-recipe/0.0.0@my_package_user/stable: A new conanfile.py version was exported
my-recipe/0.0.0@my_package_user/stable: Folder: K:\.c.p\2099_\.conan\data\my-recipe\0.0.0\my_package_user\stable\export
my-recipe/0.0.0@my_package_user/stable: Using the exported files summary hash as the recipe revision: f92738ed1a316ed685e7135a7dd73a2f 
my-recipe/0.0.0@my_package_user/stable: Exported revision: f92738ed1a316ed685e7135a7dd73a2f