Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty buildinfo when using conan export-package #157

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extensions/commands/art/cmd_build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ def build_info_create(conan_api: ConanAPI, parser, subparser, *args):
data = load_json(args.json)

# remove the 'conanfile' node
data["graph"]["nodes"].pop("0")
if not data["graph"]["nodes"]["0"]["prev"]:
czoido marked this conversation as resolved.
Show resolved Hide resolved
czoido marked this conversation as resolved.
Show resolved Hide resolved
data["graph"]["nodes"].pop("0")
bi = _BuildInfo(data, args.build_name, args.build_number, args.repository,
build_url=args.build_url,
with_dependencies=args.with_dependencies,
Expand Down
19 changes: 19 additions & 0 deletions tests/test_artifactory_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,22 @@ def test_add_server_token():
out_add = run(f'conan art:server add server1 {server_url} --user="{server_user}" --token="{token}"')

assert f"Server 'server1' ({server_url}) added successfully" in out_add


@pytest.mark.requires_credentials
def test_build_info_create_exppkg():
build_name = "mybuildinfo"
build_number = "1"

# Configure Artifactory server and credentials
run(f'conan art:server add artifactory {os.getenv("ART_URL")} --user="{os.getenv("CONAN_LOGIN_USERNAME_EXTENSIONS_STG")}" --password="{os.getenv("CONAN_PASSWORD_EXTENSIONS_STG")}"')

# Generate recipe to work with
run("conan new basic -d name=mypkg_ext -d version=1.0 --force")

# Create release packages & build info and upload them
run("conan export-pkg . --format json -s build_type=Release > create_release.json")
run("conan upload mypkg_ext/1.0 -c -r extensions-stg")
out = run(f'conan art:build-info create create_release.json {build_name}_release {build_number} --server=artifactory extensions-stg')
build_info = json.loads(out)
assert len(build_info['modules']) == 2
Loading