Skip to content

Commit

Permalink
[feature] Implement --server flag in art:build-info & art:property co…
Browse files Browse the repository at this point in the history
…mmands (#45)

* [WIP][feature] Add art:remote commands to manage artifactory auth

* fix test

* implement

* format & json

* fixes

* some review and change file name

* dynamic input

* [feature] Implement --remote flag in art:build-info commands

* Update extensions/commands/art/cmd_remote.py

* add formatters

* rename remote to server

* renamed file and artifactory url

* rename formatter

* fix test

* review

* remote -> server

* adapt to main

* fix test and use --server flag in some calls

* fix

* Add property command

* fix bi create

* add example

* fix get server

* fix test

* fix test

* fix test

* update method

* import from file

* revert

* reuse some code

* reduce code

* fix imports

* brake circular dependency

* reduce diff

* fix help
  • Loading branch information
danimtb authored May 31, 2023
1 parent b5ea03b commit adb81c6
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 221 deletions.
28 changes: 17 additions & 11 deletions extensions/commands/art/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ optional arguments:

### Combining art:build-info and art:property to manage BuildInfo's in Artifactory

First, get a JSON output from a package build. This could come from a ``conan install`` or a ``conan create``
Firstly, configure your Artifactory server with the url and credentials you want to use (this will come handy in the next commands):

```
conan art:server add my_artifactory --user=<user> --password=<pass>
```

Now, get a JSON output from a package build. This could come from a ``conan install`` or a ``conan create``:

```
conan create . --format json -s build_type=Release > create_release.json
Expand All @@ -90,25 +96,25 @@ Then upload the created package to your repository:
conan upload ... -c -r ...
```

Using the generated JSON files you can create a BuildInfo JSON. You have to pass the build
name and number and also the url and credentials for the Artifactory repository:
Using the generated JSON files you can create a BuildInfo JSON. To do this, you need to provide the build
name and number. You will also need to indicate the artifactory server to use:

```
conan art:build-info create create_release.json mybuildname_release 1 <repo> --url=<url> --user=<user> --password=<pass> --with-dependencies > mybuildname_release.json
conan art:build-info create create_debug.json mybuildname_debug 1 <repo> --url=<url> --user=<user> --password=<pass> --with-dependencies > mybuildname_debug.json
conan art:build-info create create_release.json mybuildname_release 1 <repo> --server my_artifactory --with-dependencies > mybuildname_release.json
conan art:build-info create create_debug.json mybuildname_debug 1 <repo> --server my_artifactory --with-dependencies > mybuildname_debug.json
```

Finally, you can upload the BuildInfo's
Finally, you can upload the BuildInfo's:

```
conan art:build-info upload mybuildname_release.json <url> --user=<user> --password=<pass>
conan art:build-info upload mybuildname_debug.json <url> --user=<user> --password=<pass>
conan art:build-info upload mybuildname_release.json --server my_artifactory
conan art:build-info upload mybuildname_debug.json <url> --server my_artifactory
```

In this case we generated two BuilInfo's, for Release and Debug, we can merge those to
In this case we generated two BuildInfo's, for Release and Debug, we can merge those to
create a new aggregated BuildInfo that we also will upload and set properties to:

```
conan art:build-info append mybuildname_aggregated 1 <url> --build-info=mybuildname_release,1 --build-info=mybuildname_debug,1 --user=<user> --password=<pass> > mybuildname_aggregated.json
conan art:build-info upload mybuildname_aggregated.json <url> --user=<user> --password="<pass>"
conan art:build-info append mybuildname_aggregated 1 --build-info=mybuildname_release,1 --build-info=mybuildname_debug,1 --server my_artifactory > mybuildname_aggregated.json
conan art:build-info upload mybuildname_aggregated.json --server my_artifactory"
```
Loading

0 comments on commit adb81c6

Please sign in to comment.