Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# Copyright IBM Corp. 2013, 2026
# SPDX-License-Identifier: MPL-2.0

changelog:
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.7
1.25.11
96 changes: 25 additions & 71 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,37 @@
# Copyright (c) HashiCorp, Inc.
# Copyright IBM Corp. 2013, 2026
# SPDX-License-Identifier: MPL-2.0

version: "2"

issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

linters:
default: none
enable:
- errcheck
- asasalint
- asciicheck
- bidichk
- decorder
- dupword
- govet
- ineffassign
- misspell
- nilerr
- reassign
- staticcheck
- unconvert
- unused
exclusions:
paths:
- ".*\\.hcl2spec\\.go$"
rules:
# Exclude gosimple bool check.
- linters:
- staticcheck
text: "S(1002|1008|1021)"
# Exclude failing staticchecks for now.
- linters:
- staticcheck
text: "SA(1006|1019|4006|4010|4017|5007|6005|9004):"
# Exclude lll issues for long lines with go:generate.
- linters:
- lll
source: "^//go:generate "
- linters:
- errcheck
text: "Error return value of `.*\\.Close` is not checked"
- linters:
- errcheck
path: ".*_test.go"
settings:
errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false

# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false

# Functions excluded from unchecked error reporting.
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*
- io:Close
staticcheck:
checks:
- all
- "-ST*"
- "-QF*"

formatters:
enable:
- goimports
# SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
# Example (to disable some checks): [ "all", "-SA1000", "-SA1001"]
# Run `GL_DEBUG=staticcheck golangci-lint run --enable=staticcheck` to see all available checks and enabled by config checks.
checks: ["all", "-SA4006", "-ST1000", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1004", "-QF1008", "-QF1012"]

# options for analysis running
run:
Expand All @@ -80,28 +47,15 @@ run:
# include test files or not, default is true
tests: true

# Go language version used by linters.
go: "1.23"

# list of build tags, all linters use it. Default is empty list.
#build-tags:
# - mytag

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
modules-download-mode: readonly
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# skip-files:
# - ".*\\.hcl2spec\\.go$"
# - lib/bad.go

# output configuration options
output:
formats:
text:
path: stdout
print-issued-lines: true
print-linter-name: true
colors: true
formatters:
enable:
- gofmt
- goimports
5 changes: 3 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright (c) HashiCorp, Inc.
# Copyright IBM Corp. 2013, 2026
# SPDX-License-Identifier: MPL-2.0

# This is an example goreleaser.yaml file with some defaults.
# Make sure to check the documentation at http://goreleaser.com
version: 2
env:
- CGO_ENABLED=0
before:
Expand Down Expand Up @@ -86,7 +87,7 @@ builds:
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
archives:
- format: zip
- formats: [zip]
files:
- "LICENSE.txt"

Expand Down
4 changes: 3 additions & 1 deletion .web-docs/components/builder/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ builder.
shared.

- `image_auto_accept_members` (bool) - When true, perform the image accept so the members can see the image in their
project. This requires a user with priveleges both in the build project and
project. This requires a user with privileges both in the build project and
in the members provided. Defaults to false.

- `image_disk_format` (string) - Disk format of the resulting image. This option works if
Expand Down Expand Up @@ -332,6 +332,8 @@ builder.

- `use_floating_ip` (bool) - *Deprecated* use `floating_ip` or `floating_ip_pool` instead.

- `image_creation_wait` (int) - Additional wait time in seconds after the image reaches `active` status (default: 0).

<!-- End of code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; -->


Expand Down
2 changes: 1 addition & 1 deletion .web-docs/metadata.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# Copyright IBM Corp. 2013, 2026
# SPDX-License-Identifier: MPL-2.0

# For full specification on the configuration of this file visit:
Expand Down
2 changes: 1 addition & 1 deletion .web-docs/scripts/compile-to-webdocs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# Copyright IBM Corp. 2013, 2026
# SPDX-License-Identifier: MPL-2.0


Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.1.4 (June 23, 2026)

* fix: add an optional wait before creating the image to improve reliability in image creation workflows.
* fix: use `openstack` as the HCP metadata provider name (instead of the default prefixed provider value).
* chore: add the HCP Ready flag to web metadata.
* chore: update copyright and license headers across the codebase for compliance.
* chore: bump `github.com/hashicorp/packer-plugin-sdk` from `0.6.4` to `0.6.7`.

## 1.0.0 (June 14, 2021)

* Update packer-plugin-sdk to version 0.2.3. [GH-29]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright IBM Corp. 2013, 2025
Copyright IBM Corp. 2013, 2026

Mozilla Public License Version 2.0
==================================
Expand Down
13 changes: 6 additions & 7 deletions builder/openstack/access_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

//go:generate packer-sdc struct-markdown
Expand All @@ -11,7 +11,6 @@ import (
"crypto/x509"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"

Expand Down Expand Up @@ -219,7 +218,7 @@ func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
tls_config := &tls.Config{}

if c.CACertFile != "" {
caCert, err := ioutil.ReadFile(c.CACertFile)
caCert, err := os.ReadFile(c.CACertFile)
if err != nil {
return []error{err}
}
Expand Down Expand Up @@ -369,7 +368,7 @@ type DebugRoundTripper struct {
func (drt *DebugRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) {
defer func() {
if request.Body != nil {
request.Body.Close()
_ = request.Body.Close()
}
}()

Expand All @@ -392,15 +391,15 @@ func (drt *DebugRoundTripper) RoundTrip(request *http.Request) (*http.Response,

if response.StatusCode >= 400 {
buf := bytes.NewBuffer([]byte{})
body, _ := ioutil.ReadAll(io.TeeReader(response.Body, buf))
body, _ := io.ReadAll(io.TeeReader(response.Body, buf))
drt.DebugMessage(fmt.Sprintf("Response Error: %+v\n", string(body)))
bufWithClose := ioutil.NopCloser(buf)
bufWithClose := io.NopCloser(buf)
response.Body = bufWithClose
}

return response, err
}

func (drt *DebugRoundTripper) DebugMessage(message string) {
drt.ui.Message(fmt.Sprintf("[DEBUG] %s", message))
drt.ui.Say(fmt.Sprintf("[DEBUG] %s", message))
}
2 changes: 1 addition & 1 deletion builder/openstack/artifact.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/artifact_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/builder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

//go:generate packer-sdc mapstructure-to-hcl2 -type Config,ImageFilter,ImageFilterOptions
Expand Down
2 changes: 2 additions & 0 deletions builder/openstack/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions builder/openstack/builder_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand All @@ -10,8 +10,7 @@ import (
)

func TestBuilder_ImplementsBuilder(t *testing.T) {
var raw interface{}
raw = &Builder{}
raw := interface{}(&Builder{})
if _, ok := raw.(packersdk.Builder); !ok {
t.Fatalf("Builder should be a builder")
}
Expand Down
4 changes: 2 additions & 2 deletions builder/openstack/image_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

//go:generate packer-sdc struct-markdown
Expand Down Expand Up @@ -32,7 +32,7 @@ type ImageConfig struct {
// shared.
ImageMembers []string `mapstructure:"image_members" required:"false"`
// When true, perform the image accept so the members can see the image in their
// project. This requires a user with priveleges both in the build project and
// project. This requires a user with privileges both in the build project and
// in the members provided. Defaults to false.
ImageAutoAcceptMembers bool `mapstructure:"image_auto_accept_members" required:"false"`
// Disk format of the resulting image. This option works if
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/image_config_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/networks.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/networks_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
4 changes: 3 additions & 1 deletion builder/openstack/run_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

//go:generate packer-sdc struct-markdown
Expand Down Expand Up @@ -177,6 +177,8 @@ type RunConfig struct {
OpenstackProvider string `mapstructure:"openstack_provider"`
// *Deprecated* use `floating_ip` or `floating_ip_pool` instead.
UseFloatingIp bool `mapstructure:"use_floating_ip" required:"false"`
// Additional wait time in seconds after the image reaches `active` status (default: 0).
ImageCreationWait int `mapstructure:"image_creation_wait" required:"false"`

sourceImageOpts images.ListOpts
}
Expand Down
8 changes: 4 additions & 4 deletions builder/openstack/run_config_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand All @@ -16,9 +16,9 @@ import (
func init() {
// Clear out the openstack env vars so they don't
// affect our tests.
os.Setenv("SDK_USERNAME", "")
os.Setenv("SDK_PASSWORD", "")
os.Setenv("SDK_PROVIDER", "")
_ = os.Setenv("SDK_USERNAME", "")
_ = os.Setenv("SDK_PASSWORD", "")
_ = os.Setenv("SDK_PROVIDER", "")
}

func testRunConfig() *RunConfig {
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/ssh.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/step_add_image_members.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2013, 2025
// Copyright IBM Corp. 2013, 2026
// SPDX-License-Identifier: MPL-2.0

package openstack
Expand Down
Loading
Loading