Environment Commands - project-ncl/pnc-cli GitHub Wiki
Environments define the type of operating system, build architecture, and other details regarding where the build should be performed.
#List of Commands#
###create-environment### Create a new Environment.
#####Required Parameters#####
- name: Name for the Environment
#####Optional parameters#####
- attributes (-a / --attributes): List of additional properties that should be associated with this Environment.
- description (-d / --description): Description of the Environment
- build-type (-bt / --build-type): Type of build for this environment. One of "JAVA", "DOCKER", "NATIVE"
- image-id (-iid / --image-id): ID for the Docker image for this Environment.
- image-repository-url (-iru / --image-repository-url): URL for the Docker repository in which the image can be found.
[[thauser] [14:50:00] pnc-cli (master)]$pnc create-environment "tester" -iid something -iru http://some.docker.registry.com -bt JAVA
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
###delete-environment### Remove an existing Environment from PNC.
#####Optional Parameters#####
- ID (-i / --id): ID of the Environment to delete.
- Name (-n / --name): Name of the Environment to delete.
[[thauser] [14:49:02] pnc-cli (master)]$pnc list-environments
{'attributes': {u'JDK': '1.7.0', u'OS': 'Linux'},
'build_type': 'JAVA',
'description': 'Basic Java and Maven Environment',
'id': 1,
'image_id': '12345678',
'image_repository_url': None,
'name': 'Demo Environment 1',
'system_image_repository_url': None}
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 2,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
[[thauser] [14:49:03] pnc-cli (master)]$pnc delete-environment -n tester
[[thauser] [14:49:22] pnc-cli (master)]$pnc list-environments
{'attributes': {u'JDK': '1.7.0', u'OS': 'Linux'},
'build_type': 'JAVA',
'description': 'Basic Java and Maven Environment',
'id': 1,
'image_id': '12345678',
'image_repository_url': None,
'name': 'Demo Environment 1',
'system_image_repository_url': None}
###get-environment### Retrieve a JSON payload about a specific Environment.
#####Optional Parameters#####
- ID (-i / --id): ID of the Environment to retrieve.
- Name (-n / --name): Name of the Environment to retrieve.
[[thauser] [14:50:05] pnc-cli (master)]$pnc get-environment -n tester
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
[[thauser] [14:52:20] pnc-cli (master)]$pnc get-environment -i 3
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
###list-environments### List all Environments that exist in the PNC instance.
#####Optional Parameters#####
- page-size (-p / --page-size): The maximum amount of pages to be returned in the JSON payload.
- sort (-s / --sort): RSQL Query to define how to sort returned Environments.
- query (-q): RSQL Query to filter results.
[[thauser] [14:54:13] pnc-cli (master)]$pnc list-environments
{'attributes': {u'JDK': '1.7.0', u'OS': 'Linux'},
'build_type': 'JAVA',
'description': 'Basic Java and Maven Environment',
'id': 1,
'image_id': '12345678',
'image_repository_url': None,
'name': 'Demo Environment 1',
'system_image_repository_url': None}
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
[[thauser] [14:54:17] pnc-cli (master)]$pnc list-environments -q name==tester
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'http://some.docker.registry.com',
'name': 'tester',
'system_image_repository_url': 'http://some.docker.registry.com'}
###update-environment### Modify an existing Environments fields.
#####Required Parameters#####
- ID: ID of the Environment to update
#####Optional Parameters#####
- Build type (-bt / --build-type): New value for the Environment's build-type. One of "JAVA", "DOCKER", "NATIVE".
- Description (-d / --description): New description for the Environment.
- Image repository URL (-iru / --image-repository-url): New image repository URL for the Environment.
- Name (-n / --name): Updated name for the Environment. Must be unique among already existing Environment names.
[[thauser] [15:01:21] pnc-cli (master)]$pnc list-environments -q name==tester
{'attributes': {},
'build_type': 'JAVA',
'description': None,
'id': 3,
'image_id': 'something',
'image_repository_url': 'someurl',
'name': 'tester',
'system_image_repository_url': 'someurl'}
[[thauser] [15:01:23] pnc-cli (master)]$pnc update-environment 3 -bt NATIVE -d "some description" -iru "another url" -n "newname"
[[thauser] [15:01:59] pnc-cli (master)]$pnc list-environments -q name==newname
{'attributes': {},
'build_type': 'NATIVE',
'description': 'some description',
'id': 3,
'image_id': 'something',
'image_repository_url': 'another url',
'name': 'newname',
'system_image_repository_url': 'another url'}