Commit Graph

161 Commits

Author SHA1 Message Date
Wilken Rivera 076596cd3b Makefile: Update install steps for gox 2021-03-31 11:53:41 -04:00
Megan Marsh c90e3d8466 fix makefile 2020-12-11 13:37:03 -08:00
Megan Marsh 395920f917 didnt mean to delete this 2020-12-10 14:38:16 -08:00
Megan Marsh f179f01314 Modify struct-markdown generator code to work from different projct roots
Modify makefile to call generate code properly, setting project root.
'make generate' now avoids deleting website code generated in the packer plugin sdk.
For now it will be maintainers' responsibility to regenerate this docs code from the
packer plugin sdk every release, and commit it to these folders manually.
remove boot command generator code
2020-12-10 14:35:14 -08:00
Megan Marsh 6ecdd3ca16 small tweaks 2020-12-07 15:45:16 -08:00
Megan Marsh 76177b50ce Refactor provisioner acceptance tests to shell directly out to Packer rather than import the core. Modify test case formatting to more closely reflect the builder test cases. 2020-12-07 15:45:16 -08:00
Megan Marsh afc798c30a Modify vmware_vmx acceptance tests to use builderT framework
Modify builderT framework to enable use of shell and file provisioners
2020-12-03 11:25:02 -08:00
Megan Marsh f8f1ebf0c7 move version and useragent definitions into sdk 2020-11-18 11:42:02 -08:00
Megan Marsh 7d658149ea update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
Wilken Rivera 26161b7599 makefile: Disable test caching explicitly for go test
* Bump the default time for acceptance tests to 120m
2020-10-23 13:41:14 -04:00
Megan Marsh 9f2cb0d560
make the default target generate dev builds. (#9811) 2020-08-25 10:11:38 +02:00
Megan Marsh f295b6d2e5
change default target to just make the dev binaries (#9706) 2020-08-05 13:32:24 +02:00
Ivo van Geel f27d9ab35e
make generate: don't error when find does not find any file (#9413)
Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
2020-06-12 16:30:44 +02:00
Megan Marsh b28059c0a5 add generator to create a list of all the deprecated options that the fixers fix
fix location of deprecated_options code
2020-05-29 09:40:31 -07:00
Wilken Rivera 7ec55860e5
Revert golangci-lint to use new-from-rev pinned at 1.23.8 (#9072)
Turns out linting each file individually causes issues with the linter not being able to find the import types.
2020-04-15 06:53:51 -04:00
Megan Marsh f12269f124
fix builds on linux (#9031)
* fix builds on linux

* Build: Move to CGO_ENABLED=0 (#9057)

After further investigation on cross-compiling Go bins on Linux. I found
that statically linking against GCC (for libc) failed to build for ARM
and introduced a possible licensing issue as our bins would essentially
be bundling libc into the bin. Diving further into cross compiling on Linux
I found that the defacto solution is to compile with CGO disabled - this
was also found to be the case for other HashiCorp products.

Disabling CGO has the limitation of not allowing the use of any pkg that
calls out to C (net, os), but in looking into the Packer code base and
the relevant Go code base it appears that the latest versions of Go have
pure Go implementations of the said packages so I believe we are good to
go. I should also point out that CGO is disabled by default when cross
compiling via `go build`. However, the GOX tool will enable it if it is
not explicitly disabled.

Below are three test cases executed to validate the compile bins work as
expected.

Build results after change
```
⇶  make bin
WARN: 'make bin' is for debug / test builds only. Use 'make release' for
release builds.
==> Checking for necessary tools...
==> Entering Packer source dir...
==> Ensuring output directories are present...
==> Removing old builds...
==> Building...
Number of parallel builds: 7

-->   windows/amd64: github.com/hashicorp/packer
-->     linux/arm64: github.com/hashicorp/packer
-->       linux/386: github.com/hashicorp/packer
-->       linux/arm: github.com/hashicorp/packer
-->    darwin/amd64: github.com/hashicorp/packer
-->     windows/386: github.com/hashicorp/packer
-->     linux/amd64: github.com/hashicorp/packer
-->      darwin/386: github.com/hashicorp/packer
==> Copying binaries for this platform...
'./pkg/linux_amd64/packer' -> 'bin/packer'
'./pkg/linux_amd64/packer' -> '/home/wilken/Development/go/bin/packer'

==> Results:
total 111M
-rwxr-xr-x 1 wilken wilken 111M Apr 13 12:29 packer
```

Packer executed on ARM based machine
```
ubuntu@ip-172-31-10-18:~$ ./packer version
Packer v1.5.6-dev (314ac5b65+CHANGES

ubuntu@ip-172-31-10-18:~$ uname -a
Linux ip-172-31-10-18 4.15.0-1054-aws #56-Ubuntu SMP Thu Nov 7 16:18:50 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

ubuntu@ip-172-31-10-18:~$ ./packer build build.json
null: output will be in this color.

==> null: Running local shell script: /tmp/packer-shell170248556
    null: UUID from Packer: 79cc8532-6114-925d-2a79-33ef6ce281cd
Build 'null' finished.

==> Builds finished. The artifacts of successful builds are:
--> null: Did not export anything. This is the null builder
```

Custom Docker image with updated bin
```
⇶  docker run packertest:latest version
Packer v1.5.6-dev (314ac5b65+CHANGES)

⇶  docker run packertest:latest build build.json
null: output will be in this color.

==> null: Running local shell script: /tmp/packer-shell065599452
    null: UUID from Packer: 852f0604-2be4-9e16-99af-6d7df972ac2e
Build 'null' finished.

==> Builds finished. The artifacts of successful builds are:
--> null: Did not export anything. This is the null builder
```

Windows AMI
```
[...]
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Adding tags to source instance
    amazon-ebs: Adding tag: "Name": "Packer Builder"
    amazon-ebs: Instance ID: i-04387545cf3e2acd3
==> amazon-ebs: Waiting for instance (i-04387545cf3e2acd3) to become ready...
==> amazon-ebs: Skipping waiting for password since WinRM password set...
==> amazon-ebs: Using winrm communicator to connect: 18.206.100.104
==> amazon-ebs: Waiting for WinRM to become available...
    amazon-ebs: WinRM connected.
==> amazon-ebs: Connected to WinRM!
==> amazon-ebs: Uploading packertest => c:/Windows/Temp
==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with powershell script: /tmp/powershell-provisioner173180945
    amazon-ebs: Packer v1.5.6-dev (314ac5b65+CHANGES)
    amazon-ebs: null: output will be in this color.
    amazon-ebs:
```

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2020-04-14 14:48:50 -04:00
Wilken Rivera c9c0ee65d3
circle-ci: update ci-lint steps (#9043)
* new-from-rev option is showing inconsistent results on circle and
locally. This change moves to a custom command `script/lint.sh` that gets a list of added
go files and pipes them to golangci-lint for testing.

* Add a git fetch as a step before retrieving merge-base changes to fix
the issue described at https://discuss.circleci.com/t/checkout-script-adds-commits-to-master-from-circle-branch/14194/2

* Moved source code out of GOPATH to ensure go mod support and reduce
the risk of having golangci-lint trying to scan all of the files within
GOPATH. This was an issue in the past, in changing it I found less OOM
issues on circle.
2020-04-14 12:03:22 +02:00
Jeff Escalante 2999934326
fix generation script, bugfixes in source comments, update website paths in primary codebase 2020-04-07 17:53:22 -04:00
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Sylvia Moss 665330de92
Write generic Builder-Provisioner acceptance test logic (#8963) 2020-04-03 18:17:09 +02:00
Wilken Rivera 3a9d356c9d
golangci-lint: Update --new-from-rev option to check only newly added commits (#8923)
* golangci-lint: Update --new-from-rev option to check only code added in the latest commit

Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
2020-03-20 14:28:48 -04:00
Adrien Delorme b15c92bc1e scripts/generate-plugins.go: programatically gofmt the file before outputing it to avoid having to do that later on 2020-03-17 11:56:32 +01:00
Sylvia Moss fa4b9ae958
Add Codecov configuration (#8862) 2020-03-12 10:36:10 +01:00
Wilken Rivera 5a87760702
makefile: Update code path for golangci-lint (#8751)
While `golangci-lint run` is the same as `golangci-lint run ./...` running it without a
path seems to throw warning messages related to its cache, which is confusing.
This change sets an explicit path for golangci-lint when calling `make lint` or `make ci-lint`.
2020-02-17 11:24:08 +01:00
Wilken Rivera 9ec8b67392
Add golangci-lint to project (#8686)
* Add golangci-lint as linting tool

* Disable failing staticchecks to start; GitHub issue to handle coming soon

* Run `goimports -w` to repair all source files that have improperly
formatted imports

* makefile: Add ci-lint target to run on travis

This change adds a new make target for running golangci-lint on newly
added Go files only. This target is expected to run during Packer ci builds.

* .github/contributing: Add code linting instructions

* travis: Update job configuration to run parallel builds
2020-02-14 11:42:29 -05:00
Adrien Delorme 75a639775e Update Makefile
there's no find dir
2019-10-16 10:24:34 +02:00
Adrien Delorme 1158eeb46d Update Makefile
to @go install ./cmd/mapstructure-to-hcl2 so that we can `make generate` and tests that generated code is what it should be
2019-10-15 12:56:43 +02:00
Adrien Delorme 597a3e323b Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-10 13:20:07 +02:00
Adrien Delorme 1091066c57 go get use enumer@master 2019-09-06 12:15:48 +02:00
Adrien Delorme c77a0bd196 remove goimports dependency as the generated code is now correct and won't need fixing
this should save us from running this command every now an then
2019-09-06 12:15:27 +02:00
Adrien Delorme 22a89ccf8a fix comment typo 2019-09-05 17:19:50 +02:00
Adrien Delorme a2e934e7fb Makefile: document why 2019-09-05 17:17:04 +02:00
Adrien Delorme e4563655fd Makefile: go to temporary directory to avoid go get of binaries from changing go deps 2019-09-05 17:11:08 +02:00
Adrien Delorme 4cb7c30987 Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-08-21 16:44:23 +02:00
Megan Marsh b82ab2cc6a change installation of pigeon if off gopath 2019-07-01 12:16:50 -07:00
Adrien Delorme 4c1abf828c
Merge branch 'master' into scrape_doc_to_builder_struct_config 2019-06-19 11:21:06 +02:00
Megan Marsh 0a2f4d884a make bin currently won't work outside of GOPATH 2019-06-14 11:12:58 -07:00
Adrien Delorme 6fcf581e3e remove all generated doc files before generating it again
in order to remove files that should be
2019-06-14 14:58:58 +02:00
Adrien Delorme 4ab5471490 Makefile: install-gen-deps now installs ./cmd/struct-markdown 2019-06-06 17:34:17 +02:00
Adrien Delorme 36ee40b2a1 test that go generated code if what is should be 2019-05-27 16:00:20 +02:00
Adrien Delorme 5a0b5e3944 Makefile: don't run fmt-check in test/testrace
* this is now run on a different circle ci track
2019-05-27 15:42:58 +02:00
Adrien Delorme deb2212e9e Makefile: use `go fmt`
fmt-check no runs go fmt and then a git diff; this should also fail on line ending diffs
2019-05-27 15:37:03 +02:00
Adrien Delorme 768736425e Makefile: remove unused golang.org/x/tools/cmd/stringer dep 2019-05-27 15:07:49 +02:00
Adrien Delorme 26d0448142 Makefile: split install-build-deps vs install-gen-deps 2019-05-27 15:06:49 +02:00
Adrien Delorme abd6eda6c9 generate execution policy from makefile
* make generate now generates on `./...` instead of `.`
2019-05-27 14:52:04 +02:00
Adrien Delorme 267e2253a2 check if running `go mod vendor` has an effect on vendor directory and if so fail 2019-04-11 14:19:25 +02:00
Adrien Delorme 5a896367ef make sure CI builds with GO111MODULE=off 2019-04-11 14:19:25 +02:00
Megan Marsh 12bd1c5f96 increase timeout for tests to reduce flakiness in travis 2019-04-05 10:57:47 -07:00
Adrien Delorme fef25e0b24 Revert "remove vet which seems to have been broken in golang v1.12"
This reverts commit 58f0b8c22e.
2019-03-04 11:18:00 +01:00
Adrien Delorme b842adcffd Update Makefile
make sure we use "go list ./..."
* without removing vendor dir as it is now removed by default.
* stop using ls -d */
2019-03-04 11:17:58 +01:00