Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scaleway/packer-plugin-scaleway
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.1
Choose a base ref
...
head repository: scaleway/packer-plugin-scaleway
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 20 commits
  • 65 files changed
  • 3 contributors

Commits on Oct 28, 2024

  1. chore: Bump golang.org/x/crypto from 0.27.0 to 0.28.0 (#197)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.27.0 to 0.28.0.
    - [Commits](golang/crypto@v0.27.0...v0.28.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    084f508 View commit details

Commits on Nov 8, 2024

  1. chore: Bump golang.org/x/crypto from 0.28.0 to 0.29.0 (#198)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.28.0 to 0.29.0.
    - [Commits](golang/crypto@v0.28.0...v0.29.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 8, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dcf1345 View commit details

Commits on Dec 9, 2024

  1. chore: Bump golang.org/x/crypto from 0.29.0 to 0.30.0 (#199)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.29.0 to 0.30.0.
    - [Commits](golang/crypto@v0.29.0...v0.30.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 9, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    643b746 View commit details

Commits on Dec 12, 2024

  1. chore: Bump golang.org/x/crypto from 0.30.0 to 0.31.0 (#200)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
    - [Commits](golang/crypto@v0.30.0...v0.31.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0753293 View commit details

Commits on Dec 31, 2024

  1. chore: bump golang.org/x/net (#204)

    remyleone authored Dec 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4c68541 View commit details

Commits on Jan 8, 2025

  1. chore: Bump golang.org/x/crypto from 0.31.0 to 0.32.0 (#205)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.31.0 to 0.32.0.
    - [Commits](golang/crypto@v0.31.0...v0.32.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jan 8, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    967635f View commit details

Commits on Jan 14, 2025

  1. test: add end to end tests (#203)

    * test: add end to end tests
    
    * add test script
    
    * add complete test
    delete resources across all zones
    add new asserts
    
    * add more asserts
    
    * Use go tests instead of a main
    
    * run packer from go tests and merge *_test.go with packer files
    
    * add cassettes to test checks
    
    * add cassettes to packer
    
    * fix execution with cassettes
    
    * improve doc
    
    * add cassettes
    
    * run e2e tests in CI
    
    * fix tests in CI
    
    * lint
    
    * split test and e2e_test in makefile
    
    * add e2e test to ci
    
    * skip broken test
    Codelax authored Jan 14, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    cbd8dc8 View commit details
  2. chore: Bump github.com/stretchr/testify from 1.8.4 to 1.10.0 (#206)

    Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.10.0.
    - [Release notes](https://github.com/stretchr/testify/releases)
    - [Commits](stretchr/testify@v1.8.4...v1.10.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/stretchr/testify
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jan 14, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0f600b2 View commit details

Commits on Jan 29, 2025

  1. feat: add block_volumes (#105)

    * feat: add block_volumes
    
    * update doc
    
    * make generate
    
    * create sbs volumes for each block_volume
    
    * add iops configuration and importing from snapshot
    
    * fix(tester): prepare fake env only when using cassettes
    
    * refactor block volume size to size_in_gb
    
    * test: add check for image extra volumes types
    
    * test: add TestBlock
    
    * lint
    Codelax authored Jan 29, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aff4e88 View commit details

Commits on Feb 4, 2025

  1. chore: Bump github.com/hashicorp/packer-plugin-sdk from 0.5.4 to 0.6.0 (

    #208)
    
    Bumps [github.com/hashicorp/packer-plugin-sdk](https://github.com/hashicorp/packer-plugin-sdk) from 0.5.4 to 0.6.0.
    - [Release notes](https://github.com/hashicorp/packer-plugin-sdk/releases)
    - [Changelog](https://github.com/hashicorp/packer-plugin-sdk/blob/main/CHANGELOG.md)
    - [Commits](hashicorp/packer-plugin-sdk@v0.5.4...v0.6.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/hashicorp/packer-plugin-sdk
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    582fa0d View commit details

Commits on Feb 10, 2025

  1. chore: Bump golang.org/x/crypto from 0.32.0 to 0.33.0 (#213)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.32.0 to 0.33.0.
    - [Commits](golang/crypto@v0.32.0...v0.33.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 10, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    23b2a4b View commit details

Commits on Feb 11, 2025

  1. feat: add root_volume config and default to sbs volume type (#212)

    * feat: add root_volume config and default to sbs volume type
    
    * update block cassettes
    
    * lint
    
    * wait for volumes before deletion
    
    * update simple_test
    
    * add root_volume test
    
    * update cassettes
    
    * add root_volume test
    
    * update cassettes
    
    * lint
    Codelax authored Feb 11, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    22b6fc8 View commit details

Commits on Feb 18, 2025

  1. ci(goreleaser): rely on makefile for tests in prehook (#214)

    Codelax authored Feb 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bebabf6 View commit details
  2. chore: add support for CODEOWNERS (#216)

    remyleone authored Feb 18, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    fd639e0 View commit details

Commits on Feb 19, 2025

  1. chore: remove cgo need in makefile test rule (#215)

    Codelax authored Feb 19, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2e15191 View commit details
  2. chore: update golangci-lint config (#217)

    Codelax authored Feb 19, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    887db31 View commit details

Commits on Feb 20, 2025

  1. chore: reconfigure golangci linters (#218)

    * chore: reconfigure golangci linters
    
    * fix lint
    Codelax authored Feb 20, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ddd54ef View commit details
  2. feat: format invalid precondition failed error (#219)

    Codelax authored Feb 20, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    830e655 View commit details

Commits on Feb 21, 2025

  1. docs: add root volume documentation (#220)

    Codelax authored Feb 21, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    86a55c8 View commit details

Commits on Feb 25, 2025

  1. chore: Bump github.com/go-jose/go-jose/v4 from 4.0.1 to 4.0.5 (#221)

    Bumps [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) from 4.0.1 to 4.0.5.
    - [Release notes](https://github.com/go-jose/go-jose/releases)
    - [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
    - [Commits](go-jose/go-jose@v4.0.1...v4.0.5)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/go-jose/go-jose/v4
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 25, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    634259b View commit details
Showing with 8,583 additions and 228 deletions.
  1. +3 −0 .github/CODEOWNERS
  2. +2 −0 .github/workflows/unit-tests.yml
  3. +49 −41 .golangci.yml
  4. +1 −1 .goreleaser.yml
  5. +35 −1 .web-docs/components/builder/scaleway/README.md
  6. +6 −2 GNUmakefile
  7. +31 −0 builder/scaleway/api.go
  8. +5 −0 builder/scaleway/artifact.go
  9. +2 −0 builder/scaleway/artifact_test.go
  10. +19 −1 builder/scaleway/builder.go
  11. +5 −0 builder/scaleway/builder_acc_test.go
  12. +35 −0 builder/scaleway/builder_test.go
  13. +35 −1 builder/scaleway/config.go
  14. +115 −82 builder/scaleway/config.hcl2spec.go
  15. +40 −0 builder/scaleway/config_block.go
  16. +64 −0 builder/scaleway/config_root_volume.go
  17. +35 −0 builder/scaleway/config_root_volume.hcl2spec.go
  18. +8 −3 builder/scaleway/step_backup.go
  19. +3 −1 builder/scaleway/step_cleanup_machine_data.go
  20. +44 −5 builder/scaleway/step_create_server.go
  21. +14 −5 builder/scaleway/step_create_ssh_key.go
  22. +161 −0 builder/scaleway/step_create_volume.go
  23. +8 −2 builder/scaleway/step_pre_validate.go
  24. +5 −0 builder/scaleway/step_pre_validate_test.go
  25. +0 −47 builder/scaleway/step_remove_volume.go
  26. +11 −2 builder/scaleway/step_server_info.go
  27. +5 −2 builder/scaleway/step_shutdown.go
  28. +2 −2 builder/scaleway/step_sweep.go
  29. +7 −1 docs-partials/builder/scaleway/Config-not-required.mdx
  30. +11 −0 docs-partials/builder/scaleway/ConfigBlockVolume-not-required.mdx
  31. +9 −0 docs-partials/builder/scaleway/ConfigRootVolume-not-required.mdx
  32. +5 −0 docs-partials/builder/scaleway/ConfigRootVolume.mdx
  33. +8 −0 docs/builders/scaleway.mdx
  34. +8 −0 e2e_tests/GNUmakefile
  35. +24 −0 e2e_tests/README.md
  36. +22 −0 e2e_tests/clean.sh
  37. +29 −0 e2e_tests/test.sh
  38. +11 −0 e2e_tests/tmp.sh
  39. +16 −9 go.mod
  40. +29 −20 go.sum
  41. +52 −0 internal/checks/block_snapshot.go
  42. +115 −0 internal/checks/image.go
  43. +64 −0 internal/checks/snapshot.go
  44. +110 −0 internal/checks/volume.go
  45. +29 −0 internal/httperrors/httperrors.go
  46. +10 −0 internal/tester/checks.go
  47. +91 −0 internal/tester/packer_exec.go
  48. +99 −0 internal/tester/tester.go
  49. +43 −0 internal/tests/block_test.go
  50. +45 −0 internal/tests/complete_test.go
  51. +42 −0 internal/tests/root_volume_sbs_test.go
  52. +42 −0 internal/tests/root_volume_test.go
  53. +36 −0 internal/tests/simple_test.go
  54. +158 −0 internal/tests/testdata/block.cassette.yaml
  55. +162 −0 internal/tests/testdata/complete.cassette.yaml
  56. +1,395 −0 internal/tests/testdata/packer-e2e-block.cassette.yaml
  57. +1,103 −0 internal/tests/testdata/packer-e2e-complete.cassette.yaml
  58. +1,201 −0 internal/tests/testdata/packer-e2e-root-volume-sbs.cassette.yaml
  59. +1,101 −0 internal/tests/testdata/packer-e2e-root-volume.cassette.yaml
  60. +1,150 −0 internal/tests/testdata/packer-e2e-simple.cassette.yaml
  61. +158 −0 internal/tests/testdata/root-volume-sbs.cassette.yaml
  62. +158 −0 internal/tests/testdata/root-volume.cassette.yaml
  63. +158 −0 internal/tests/testdata/simple.cassette.yaml
  64. +138 −0 internal/vcr/vcr.go
  65. +1 −0 main.go
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Codeowners for scaleway/packer-plugin-scaleway

* @remyleone
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -30,6 +30,8 @@ jobs:
run: make build
- name: Run unit tests
run: make test
- name: Run e2e tests
run: make e2e_test

generate:
strategy:
90 changes: 49 additions & 41 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@ issues:
- linters:
- lll
source: "^//go:generate "
- linters:
- gomoddirectives
text: "replacement are not allowed"

exclude-files:
- ".*\\.hcl2spec\\.go$"
@@ -27,8 +30,15 @@ issues:
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

# Enables exclude of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
exclude-dirs-use-default: true

# make issues output unique by line, default is true
uniq-by-line: true

linters:
disable-all: true
enable:
- asasalint # check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false]
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
@@ -45,6 +55,9 @@ linters:
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted. [fast: false, auto-fix: false]
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]
- exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions. [auto-fix]
- fatcontext # Detects nested contexts in loops and function literals. [auto-fix]
- forbidigo # Forbids identifiers [fast: true, auto-fix: false]
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false]
@@ -56,12 +69,15 @@ linters:
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- goheader # Checks is file header matches to pattern [fast: true, auto-fix: false]
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. [fast: true, auto-fix: true]
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
- gosimple #(megacheck): Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
- gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase [fast: false, auto-fix: false]
- govet #(vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
- iface # Detect the incorrect use of interfaces, helping developers avoid interface pollution. [auto-fix]
- importas # Enforces consistent import aliases [fast: false, auto-fix: false]
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- intrange # intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false]
@@ -73,6 +89,7 @@ linters:
- musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: true]
- noctx # noctx finds sending http request without context.Context [fast: false, auto-fix: false]
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
@@ -88,8 +105,8 @@ linters:
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. [fast: false, auto-fix: false]
- staticcheck #(megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
@@ -98,10 +115,31 @@ linters:
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]
- usetesting # Reports uses of functions with replacement inside the testing package. [auto-fix]
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
- wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]
fast: true

disable:
- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
- err113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- gochecknoglobals # check that no global variables exist [fast: true, auto-fix: false]
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
- godot # Check if comments end in a period [fast: true, auto-fix: true]
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
- lll # Reports long lines [fast: true, auto-fix: false]
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
- mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]

# options for analysis running
run:
@@ -121,50 +159,18 @@ run:
#build-tags:
# - mytag

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
#skip-dirs:
# - src/external_libs
# - autogenerated_by_my_lib

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# 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:

# - lib/bad.go

# 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: vendor

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
formats: colored-line-number
formats:
- format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# make issues output unique by line, default is true
uniq-by-line: true

# all available settings of specific linters
linters-settings:
errcheck:
@@ -176,10 +182,12 @@ linters-settings:
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
exclude-functions: fmt:.*,io/ioutil:^Read.*,io:Close
# List of functions to exclude from checking, where each entry is a single function to exclude.
# See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*
- io:Close

gosec:
excludes:
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ before:
hooks:
# We strongly recommend running tests to catch any regression before release.
# Even though, this an optional step.
- go test ./...
- make test
# Check plugin compatibility with required version of the Packer SDK
- make plugin-check
builds:
36 changes: 35 additions & 1 deletion .web-docs/components/builder/scaleway/README.md
Original file line number Diff line number Diff line change
@@ -88,7 +88,13 @@ can also be supplied to override the typical auto-generated key:
- `boottype` (string) - The type of boot, can be either local or
bootscript, Default bootscript

- `remove_volume` (bool) - Remove Volume
- `remove_volume` (bool) - RemoveVolume remove the temporary volumes created before running the server

- `root_volume` (ConfigRootVolume) - RootVolumeType lets you configure the root volume
See the [RootVolume](#root-volume-configuration) documentation for fields.

- `block_volume` ([]ConfigBlockVolume) - BlockVolumes define block volumes attached to the server alongside the default volume
See the [BlockVolumes](#block-volumes-configuration) documentation for fields.

- `cleanup_machine_related_data` (string) - This value allows the user to remove information
that is particular to the instance used to build the image
@@ -129,6 +135,34 @@ can also be supplied to override the typical auto-generated key:
<!-- End of code generated from the comments of the Config struct in builder/scaleway/config.go; -->


### Block volumes configuration

<!-- Code generated from the comments of the ConfigBlockVolume struct in builder/scaleway/config.go; DO NOT EDIT MANUALLY -->

- `name` (string) - The name of the created volume

- `snapshot_id` (string) - ID of the snapshot to create the volume from

- `size_in_gb` (uint64) - Size of the newly created volume

- `iops` (\*uint32) - IOPS is the number of requested iops for the server's volume. This will not impact created snapshot.

<!-- End of code generated from the comments of the ConfigBlockVolume struct in builder/scaleway/config.go; -->


### Root volume configuration

<!-- Code generated from the comments of the ConfigRootVolume struct in builder/scaleway/config_root_volume.go; DO NOT EDIT MANUALLY -->

- `type` (string) - The type of the root volume

- `iops` (\*uint32) - IOPS of the root volume if using SBS, will only affect runtime. Image's volumes cannot have a configured IOPS.

- `size_in_gb` (uint64) - Size of the root volume

<!-- End of code generated from the comments of the ConfigRootVolume struct in builder/scaleway/config_root_volume.go; -->


## Basic Example

Here is a basic example. It is completely valid as soon as you enter your own
8 changes: 6 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@ BINARY=packer-plugin-${NAME}
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"

COUNT?=1
TEST?=$(shell go list ./...)
E2E_TEST?=$(shell go list ./internal/tests)
TEST?=$(filter-out $(E2E_TEST),$(shell go list ./...))
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)

.PHONY: dev
@@ -16,7 +17,10 @@ dev:
packer plugins install --path ${BINARY} "$(shell echo "${PLUGIN_FQN}" | sed 's/packer-plugin-//')"

test:
@go test -race -count $(COUNT) $(TEST) -timeout=3m
@go test -count $(COUNT) $(TEST) -timeout=3m

e2e_test:
make -C e2e_tests test

install-packer-sdc: ## Install packer sofware development command
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
31 changes: 31 additions & 0 deletions builder/scaleway/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package scaleway

import (
"encoding/json"
"errors"
_ "unsafe" // Import required for link

"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
"github.com/scaleway/scaleway-sdk-go/scw"
)

//go:linkname createServer github.com/scaleway/scaleway-sdk-go/api/instance/v1.(*API).createServer
func createServer(*instance.API, *instance.CreateServerRequest, ...scw.RequestOption) (*instance.CreateServerResponse, error)

func newResponseErrorFromBody(rawBody []byte) error {
responseError := scw.ResponseError{}
_ = json.Unmarshal(rawBody, &responseError)

return &responseError
}

// formatNonStandardError provides a way to format non-standard errors returned by instance's API.
// If error is not detected as non-standard, format will be no-op.
func formatInstanceError(err error) error {
preconditionFailedError := &scw.PreconditionFailedError{}
if errors.As(err, &preconditionFailedError) && preconditionFailedError.Precondition == "" {
return newResponseErrorFromBody(preconditionFailedError.RawBody)
}

return err
}
5 changes: 5 additions & 0 deletions builder/scaleway/artifact.go
Original file line number Diff line number Diff line change
@@ -68,17 +68,21 @@ func (a *Artifact) State(name string) interface{} {
)
if err != nil {
log.Printf("error when creating hcp registry image %v", err)

return nil
}

return img
}

return a.StateData[name]
}

func (a *Artifact) Destroy() error {
instanceAPI := instance.NewAPI(a.Client)

log.Printf("Destroying image: %s (%s)", a.ImageID, a.ImageName)

err := instanceAPI.DeleteImage(&instance.DeleteImageRequest{
ImageID: a.ImageID,
})
@@ -87,6 +91,7 @@ func (a *Artifact) Destroy() error {
}

log.Printf("Destroying snapshots: %v", a.Snapshots)

for _, snapshot := range a.Snapshots {
err = instanceAPI.DeleteSnapshot(&instance.DeleteSnapshotRequest{
SnapshotID: snapshot.ID,
2 changes: 2 additions & 0 deletions builder/scaleway/artifact_test.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (

func TestArtifact_Impl(t *testing.T) {
var raw interface{}

raw = &scaleway.Artifact{}
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
@@ -81,6 +82,7 @@ func TestArtifactState_StateData(t *testing.T) {

// Nil StateData should not fail and should return nil
artifact = &scaleway.Artifact{}

result = artifact.State("key")
if result != nil {
t.Fatalf("Bad: State should be nil for nil StateData")
Loading