Skip to content

Commit

Permalink
Merge pull request #2 from zestia/1.0.5
Browse files Browse the repository at this point in the history
A fix for Packer version 1.11.0 and above
  • Loading branch information
andiempettJISC authored Sep 5, 2024
2 parents 7fdfac1 + 8796cbb commit e40c80b
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 573 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ packer {
required_plugins {
digitalocean-image-lifecycle = {
version = ">=v1.0.0"
source = "github.com/androidwiltron/digitalocean-image-lifecycle"
source = "github.com/andiempettJISC/digitalocean-image-lifecycle"
}
}
}
Expand Down Expand Up @@ -60,4 +60,40 @@ comment out the `required_plugins` block in [`example/main.pkr.hcl`](example/mai
cd example
packer init .
packer build .
```
```


### If you're up to this for the first time, ensure you've got `Go` set up

```
brew install go
brew install goreleaser
```

For a missing `packer-sdc` command, run the below command.
```
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
# if not done before, add the your go/bin to your PATH to be able to run Go commands:
export PATH=$PATH:$HOME/go/bin
```

For missing dependencies:
```
go mod tidy
```

When trying `goreleaser` or `go build` locally, a few variables have to be set locally, too. Variables can be checked by running `go env <variable_name>` (e.g. `go env GOOS`.)
```
export API_VERSION=$(go run . describe | jq -r '.api_version')
# the below will be needed for a local go build
export VERSION=<your_version, in 0.0.0 format>
export MODULE_PATH=$(go list -m)
export GOOS=${GOOS:-$(go env GOOS)}
export GOARCH=${GOARCH:-$(go env GOARCH)}
```

Running `goreleaser` requires a Git tag to be populated, as that value is used to fill the plugin's version variable.

To test a plugin, run `<path_to_the_plugin> describe` - that should return a JSON block with its _description_, e.g. `version`.

The Packer plugin can be then validated with Packer by running `packer plugins install -path <path_to_the_generate_plugin> "github.com/zestia/digitalocean-image-lifecycle"` - it also does a `describe` but also confirms all is valid for a Packer plugin.
72 changes: 40 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,63 +1,71 @@
module packer-plugin-digitalocean-image-lifecycle

go 1.19
go 1.21.0

require github.com/hashicorp/packer-plugin-sdk v0.3.2
toolchain go1.23.0

require (
github.com/digitalocean/godo v1.93.0
github.com/hashicorp/hcl/v2 v2.19.1
github.com/hashicorp/packer-plugin-sdk v0.5.4
github.com/zclconf/go-cty v1.13.3
)

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/aws/aws-sdk-go v1.40.34 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.114 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/digitalocean/godo v1.93.0 // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/consul/api v1.10.1 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/consul/api v1.25.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter/v2 v2.1.0 // indirect
github.com/hashicorp/go-hclog v0.16.2 // indirect
github.com/hashicorp/go-getter/v2 v2.2.2 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/hashicorp/serf v0.9.5 // indirect
github.com/hashicorp/vault/api v1.1.1 // indirect
github.com/hashicorp/vault/sdk v0.2.1 // indirect
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/hashicorp/vault/api v1.14.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/klauspost/compress v1.11.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/iochan v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect
golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187
Loading

0 comments on commit e40c80b

Please sign in to comment.