喜大普奔:HashiCorp Vagrant 2.2.0发布!
admin
2023-04-11 10:23:35
0

OCT 17 2018 BRIAN CAIN

We are pleased to announce the release of Vagrant 2.2.0. Vagrant is a tool for building and distributing development environments. The highlight of this release is the introduction of Vagrant Cloud command line tool.

DOWNLOAD NOW

This release of Vagrant includes a handful of bug fixes and improvements. Notable updates in this release include:

  • Vagrant Cloud integration with new cloud command
  • Core Vagrant trigger improvements supporting non-standard exit codes and a new abort option to halt a Vagrant run
  • Vagrant upload command for easily transferring files to guests
  • Many Hyper-V and Docker provider improvements and bug fixes

Vagrant Cloud CLI

This release introduces a brand new Vagrant command, cloud, which can be used to interact with Vagrant Cloudthrough the command line instead of a browser or HTTP. It comes with a variety of cloud subcommands, however this post will only cover a few highlights. If you’d like to know more about this feature, check out the documentation for more information!

vagrant cloud search hashicorp --limit 5
| NAME                    | VERSION | DOWNLOADS | PROVIDERS                       |
+-------------------------+---------+-----------+---------------------------------+
| hashicorp/precise64     | 1.1.0   | 6,689,515 | virtualbox,vmware_fusion,hyperv |
| hashicorp/precise32     | 1.0.0   | 2,264,067 | virtualbox                      |
| hashicorp/boot2docker   | 1.7.8   |    59,376 | vmware_desktop,virtualbox       |
| hashicorp/connect-vm    | 0.1.0   |     6,912 | vmware_desktop,virtualbox       |
| hashicorp/vagrant-share | 0.1.0   |     3,676 | vmware_desktop,virtualbox       |
+-------------------------+---------+-----------+---------------------------------+

If you just want box names and are not interested in a formatted table, you can reduce the result with the --short flag:

vagrant cloud search hashicorp --limit 5 --short
hashicorp/precise64
hashicorp/precise32
hashicorp/boot2docker
hashicorp/connect-vm
hashicorp/vagrant-share

There are lots of ways to use the search command with various filters to find the right box to use. Give it a try today!

Publish

So, you’ve built a new Vagrant box with Packer and want to share it with the world on Vagrant Cloud, but you’re not sure how to go about sharing the box file? The publish subcommand helps you through the process of creating and uploading a new box entry on Vagrant Cloud with a single command. Once invoked, it will confirm the new box details before publishing to Vagrant Cloud.

Note that the Progress bar will get removed after the box has finished uploading to Vagrant Cloud, but was left in for example sake for this blog post.

vagrant cloud publish briancain/supertest 1.0.0 virtualbox boxes/ubuntu-16.04.virtualbox.box --description "Now with more bits!" --version-description "A cool version" --release --short-description "More bits"
You are about to publish a box on Vagrant Cloud with the following options:
briancain/supertest:   (v1.0.0) for provider 'virtualbox'
Automatic Release:     true
Box Description:       Now with more polygons
Box Short Description: Really short
Version Description:   A cool version
Do you wish to continue? [y/N] y
==> cloud: Creating a box entry...
==> cloud: Creating a version entry...
==> cloud: Creating a provider entry...
==> cloud: Uploading provider with file /Users/brian/code/vagrant_cloud/boxes/ubuntu-16.04.virtualbox.box
Progress: 14% (Rate: 6172k/s, Estimated time remaining: 0:01:10)
==> cloud: Releasing box...
Complete! Published briancain/supertest
tag:                  briancain/supertest
username:             briancain
name:                 supertest
private:              false
downloads:            0
created_at:           2018-09-26T21:03:15.737Z
updated_at:           2018-09-26T21:05:07.388Z
short_description:    More bits
description_markdown: Now with more bits!
current_version:      1.0.0
providers:            virtualbox
old_versions:         ...

There are a lot more features that come along with the new cloud command, so check it out today!

Vagrant plugins

Vagrant now gives users the ability to define project specific plugins that are required for a Vagrantfile. Vagrant will require these plugins be installed and available for the project. If the plugins are not available, it will attempt to automatically install them into the local project. When requiring a single plugin, a string can be provided:

config.vagrant.plugins = "vagrant-plugin"

If multiple plugins are required, they can be provided as an array:

config.vagrant.plugins = ["vagrant-plugin", "vagrant-other-plugin"]

Plugins can also be defined as a Hash, which supports setting extra options for the plugins. When a Hash is used, the key is the name of the plugin, and the value is an options Hash for the plugin. For example, to set an explicit version of a plugin to install:

config.vagrant.plugins = {"vagrant-scp" => {"version" => "1.0.0"}}

More information about configuring your Vagrantfile to install local plugins can be found on the documentation for Vagrantfiles!

Vagrant Upload

Vagrant now includes a new upload command. This command allows for easy uploading of one-off files or directories from the host to a running guest. The upload command utilizes the underlying communicator configured for the target guest to provide support for uploading files and directories.

vagrant upload test.rb
Uploading test.rb to test.rb
Upload has completed successfully!

  Source: test.rb
  Destination: test.rb

The upload command also includes support for performing compression on the host prior to upload and automatic decompression on the guest. This can be very useful when uploading large directories as it not only compresses the content to be uploaded but also reduces the number of uploaded items to one. For more information about the new upload command, please refer to the documentation.

Other improvements

The Vagrant 2.2.0 release also includes a number of other improvements and bug fixes. For a detailed list of all the changes in this release, see the CHANGELOG.

相关内容

热门资讯

特朗普当场问:谁喜欢万斯?谁喜... 美国副总统万斯和国务卿鲁比奥谁会成为2028年共和党总统候选人备受关注,总统特朗普5月11日在白宫的...
实探杭州“被电商拉黑”街道:随... 据扬子晚报报道,5月6日,一名网友在社媒发帖称,自己在某电商平台看中了一款商品,商品界面却显示其地址...
大连女子烧烤店内用铁签喂狗,十... 5月11日,一段网传视频显示,女子让宠物狗坐在辽宁大连一家烧烤店的卡座上,并用铁签将肉串喂给宠物狗,...
沃尔核材获得实用新型专利授权:... 证券之星消息,根据天眼查APP数据显示沃尔核材(002130)新获得一项实用新型专利授权,专利名为“...
科技伦理审查助力人工智能产业高... 转自:证券日报     本报记者 郭冀川     随着AI(人工智能)技术迭代加速,相关伦理审查的重...
捷昌驱动获得实用新型专利授权:... 证券之星消息,根据天眼查APP数据显示捷昌驱动(603583)新获得一项实用新型专利授权,专利名为“...
2026云手机为什么这么火?这... 你是否也有过这样的念头:想试试云手机,但一看价格,月付几十甚至上百元,立马打了退堂鼓?又或者,你曾贪...
OPPO失智,武大失格,舆论失... 无知,无品,无趣。文 | 佘宗明小说《围城》里,方鸿渐在张家跟张小姐相亲,看到书架上有本《怎样去获得...
百名上海交大学子携40项科研成... 中新网上海5月11日电(记者 许婧)未来电池如何破解“放着也会老化”的难题?免疫细胞与癌细胞的“对话...
你的蓝牙耳机正在 “偷听”?这... 在科技飞速发展的当下,无线耳机、智能手表、无线键盘等蓝牙设备凭借“一键连接”带来的便捷优势,已广泛应...