forked from leonidlm/packer-builder-softlayer
-
Notifications
You must be signed in to change notification settings - Fork 8
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 ancient Vagrantfile & fix imports #18
Open
david-shepard
wants to merge
12
commits into
master
Choose a base branch
from
fixVagrant
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
371ef04
fix ancient Vagrantfile
david-shepard 58641ef
fixed Vagrantfile
david-shepard 86293d2
finally fixed the Vagrantfile
david-shepard f456697
make sure vagrant is the owner of $GOPATH
david-shepard ae8046b
fixed a ton of imports
david-shepard 61ac859
remove glide reference and fix gox import
david-shepard 82e4aef
fix gox import
19e4cf4
test without /vendor dir
ba0e5ea
increment go version to 1.9.2
1e48240
added necessary ssh arg
david-shepard bc1705c
add a necessary ssh arg
david-shepard be38d4b
attempt to fix deps
david-shepard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: go | ||
go: | ||
- 1.9 | ||
- 1.9.2 | ||
- tip | ||
cache: | ||
directories: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
# Original version of this file copied from: https://raw.githubusercontent.com/mitchellh/packer/master/Vagrantfile | ||
# Original version of this file copied from: https://raw.githubusercontent.com/hashicorp/packer/master/Vagrantfile | ||
# | ||
|
||
# VM Specifications | ||
|
@@ -11,60 +11,78 @@ VM_GUI=false | |
GOROOT = '/opt/go' | ||
GOPATH = '/opt/gopath' | ||
PACKAGE_PATH = 'src/github.com/watson-platform/packer-builder-softlayer' | ||
GO_VERSION = '1.9.2' | ||
|
||
script = <<SCRIPT | ||
set -x | ||
|
||
SRCROOT="#{GOROOT}" | ||
|
||
# Install Go | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential mercurial | ||
sudo hg clone -u release https://code.google.com/p/go $SRCROOT | ||
cd ${SRCROOT}/src | ||
sudo ./all.bash | ||
|
||
# Setup the GOPATH | ||
sudo mkdir -p #{GOPATH} | ||
cat <<EOF >/tmp/gopath.sh | ||
|
||
download="https://storage.googleapis.com/golang/go#{GO_VERSION}.linux-amd64.tar.gz" | ||
|
||
wget -q -O /tmp/go.tar.gz ${download} | ||
|
||
tar -C /tmp -xf /tmp/go.tar.gz | ||
sudo mv /tmp/go /usr/local | ||
sudo chown -R root:root /usr/local/go | ||
|
||
# Ensure that the GOPATH tree is owned by vagrant:vagrant | ||
mkdir -p #{GOPATH} | ||
sudo chown -R vagrant:vagrant #{GOPATH} | ||
sudo chown -R -f vagrant:vagrant $SRCROOT | ||
|
||
# Ensure Go is on PATH | ||
if [ ! -e /usr/bin/go ] ; then | ||
ln -s /usr/local/go/bin/go /usr/bin/go | ||
fi | ||
if [ ! -e /usr/bin/gofmt ] ; then | ||
ln -s /usr/local/go/bin/gofmt /usr/bin/gofmt | ||
fi | ||
|
||
|
||
# Ensure new sessions know about GOPATH | ||
if [ ! -f /etc/profile.d/gopath.sh ] ; then | ||
cat <<EOT > /etc/profile.d/gopath.sh | ||
export GOPATH="#{GOPATH}" | ||
export PATH="#{GOROOT}/bin:\\$GOPATH/bin:\\$PATH" | ||
export SL_USERNAME=#{ENV['SL_USERNAME']} | ||
export SL_API_KEY=#{ENV['SL_API_KEY']} | ||
EOF | ||
sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh | ||
sudo chmod 0755 /etc/profile.d/gopath.sh | ||
export PATH="#{GOPATH}/bin:\$PATH" | ||
EOT | ||
chmod 755 /etc/profile.d/gopath.sh | ||
fi | ||
|
||
source /etc/profile.d/gopath.sh | ||
|
||
|
||
# Install some other stuff we need | ||
sudo apt-get install -y curl git-core zip | ||
sudo apt-get update && sudo apt-get install -y curl git-core zip build-essential | ||
|
||
# Download and build Packer | ||
source /etc/profile.d/gopath.sh | ||
go get -u github.com/mitchellh/gox | ||
gox -build-toolchain | ||
go get -d -u github.com/mitchellh/packer | ||
cd $GOPATH/src/github.com/mitchellh/packer | ||
make updatedeps | ||
# These next two lines cause duplicate files in $GOPATH/bin | ||
go get -d -u github.com/hashicorp/packer | ||
cd $GOPATH/src/github.com/hashicorp/packer | ||
make | ||
make dev | ||
|
||
# Build packer-builder-softlayer | ||
cd $GOPATH/#{PACKAGE_PATH} | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
go build | ||
go test ./... | ||
go install | ||
|
||
# Make sure the gopath is usable by vagrant | ||
sudo chown -R -f vagrant:vagrant $SRCROOT | ||
sudo chown -R -f vagrant:vagrant #{GOPATH} | ||
# Ensure vagrant still owns the GOPATH | ||
sudo chown -R vagrant:vagrant #{GOPATH} | ||
|
||
echo "Ready for development. Begin with cd $GOPATH/#{PACKAGE_PATH}" | ||
|
||
SCRIPT | ||
|
||
Vagrant.configure(2) do |config| | ||
config.vm.box = "chef/ubuntu-12.04" | ||
config.vm.box = "ubuntu/trusty64" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use generic/ubuntu1604 instead since it supports more providers? |
||
|
||
config.vm.synced_folder '.', "#{GOPATH}/#{PACKAGE_PATH}", id: 'src' | ||
config.vm.synced_folder '.', "#{GOPATH}/#{PACKAGE_PATH}", id: 'src' | ||
|
||
config.vm.provision 'shell', inline: script | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EOT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heredoc for adding that text to
gopath.sh