使用Artifactory6.x ?
JFrog Artifactory 6.x User Guide
Have a question? Want to report an issue?Contact JFrog support![]()
Overview
On top ofgeneral supportfor advanced artifact management,Artifactory support forVagrantprovides:
- Distribution and sharing of Vagrant boxes within your organization.
- Calculation of Metadata for Vagrant boxes hosted in Artifactory's local repositories
- Extensive security features that give you fine-grained access control over boxes.
- Support for flexible repository layouts that allow you to organize your boxes and assign access privileges according to projects or development teams.
- Smart searches for boxes.
配置
局部存储库
To create a local Vagrant repository to host your Vagrant boxes, create a new Local Repository and setVagrantas thePackage Type.
Deploying Vagrant Boxes
Deploying a package using the UI
To deploy a Vagrant box to Artifactory, select the repository to which you want to deploy your Vagrant box and clickDeploy..
TheDeploydialog is displayed with your selected repository as theTarget Repositoryand a defaultTarget path.
You can add properties you wish to attach to your box as parameters to the target path.
For example, to upload the boxprecise64-virtualbox-1.0.0.box, and specify that its name isprecise64, with a provider ofvirtualboxand the version is1.0.0, you would enter:
/precise64-virtualbox-1.0.0.box;box_name=precise64;box_provider=virtualbox;box_version=1.0.0
Set Me Up
You can also select your repository and clickSet Me Upto view the cURL command you can use to upload your box.
Be careful with spaces
Make sure you don't enter any superfluous spaces in the Target Path specification.
Once you have deployed your Vagrant box, and Artifactory has recalculated the repository index, your repository should be organized as displayed below:
Deploying a package using Matrix Parameters
You can also deploy Vagrant boxes to Artifactory with an explicit URL usingMatrix Parameters.
The URL is built similarly to theTarget Pathformat as follows:
PUT "http://{Artifactory URL}/{vagrantRepoKey}/{vagrantBoxName.box};box_name={name};box_provider={provider};box_version={version}"
For example, to upload the boxprecise64-virtualbox-1.0.0.box, and specify that it's name isprecise64, with a provider ofvirtualboxand the version is1.0.0, you would enter:
PUT "http://localhost:8080/artifactory/vagrant-local/precise64-virtualbox-1.0.0.box;box_name=precise64;box_provider=virtualbox;box_version=1.0.0"
Setting the Target Path
TheTarget Pathcan be anywhere in the repository, but it has to contain the 3 mandatory matrix parameters:box_name,box_providerandbox_versionand the file name must end with.box.The format is as follows:
PUT "http://{Artifactory URL}/{vagrantRepoKey}/{path/to/vagrantBoxName.box};box_name=[name];box_provider=[provider];box_version=[version]"
name |
The value to assign to thebox_nameproperty used to specify the Vagrant box name. |
provider |
The value to assign to the box _providerproperty used to specify the Vagrant boxprovider(virtualbox/lxc or others). |
version |
The value to assign to the box_versionproperty used to specify the Vagrant box version (must comply withVagrant's versioning schema) |
Provisioning Vagrant Boxes
Vagrant boxes are available through the following URL:
vagrant box add "http://{Artifactory URL}/api/vagrant/{vagrantRepoKey}/{boxName}"
Specifying the path to the box
With Vagrant client commands, make sure you don't specify the path to a box in the command. The path should be specified using properties.
For example, to provision a Vagrant box calledprecise64from a repository calledvagrant-local, you would constructit'sname in the following manner:
添加“http://localhost: 8080 / artifactory流浪的盒子/api/vagrant/vagrant-local/precise64"
You can select the repository from which you want to provision your box, and clickSet Me Upto get the specific URL for the selected repository.
You can also, optionally, pass parameters to specify a specific box version or provider. For example:
添加“http://localhost: 8080 / artifactory流浪的盒子/api/vagrant/vagrant-local/precise64 --provider virtualbox --box-version 1.0.0"
In addition, boxes can be provisioned using properties; this is useful when you want to download the latest box tagged by a specific property.
The properties query parameter value should comply withUsing Properties in Deployment and Resolution.
Examples:
添加“http://localhost: 8080 / artifactory流浪的盒子/api/vagrant/vagrant-local/precise64?properties=box_version%2B=3.0.0"
Note the '%2B'encodingon the command for the '+' symbol (which is forMandatoryproperties: key+=value)
The following example downloads a box withbox_name=trusty64,box_version=3.0.0frompath="folder".
Ituses an optional "path" property ( in addition to the mandatory properties) to specify the path where the box is stored in Artifactory. We will use this property for resolution of the box.
添加“http://localhost: 8080 / artifactory流浪的盒子/api/vagrant/vagrant-local/trusty64?properties=box_version%2B=3.0.0;path%2B=folder"
Note the format for resolution of multiple properties:key1+=value1;key2+=value2....
Authenticated Access to Servers
If you need to access a secured Artifactory server that requires a username and password, you need to specify 2 environment variables:
- ATLAS_TOKEN - ABase64encoded string of the user credentials (formatted
username:password). - VAGRANT_SERVER_URL - The base URL for the Artifactory server.
export ATLAS_TOKEN={token} export VAGRANT_SERVER_URL=http://{Artifactory URL}/api/vagrant/{vagrantRepoKey} For example: export ATLAS_TOKEN=YWRtaW46QVAzWGhzWmlDU29NVmtaQ2dCZEY3XXXXXXXX export VAGRANT_SERVER_URL=http://localhost:8081/api/vagrant/vagrant-local
Getting the ATLAS_TOKEN directly from Artifactory
You can use the following command to get the ATLAS_TOKEN string directly from Artifactory:
$ curl -uadmin:password "http://localhost:8080/artifactory/api/vagrant/auth"
YWRtaW46QVAzWGhzWmlDU29NVmtaQ2dCZEY3XXXXXXXX





