This project is mirrored from https://gitee.com/NQL886/packer.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
  1. 23 Mar, 2022 1 commit
  2. 22 Mar, 2022 3 commits
  3. 02 Mar, 2022 7 commits
  4. 01 Mar, 2022 4 commits
  5. 28 Feb, 2022 3 commits
  6. 26 Feb, 2022 3 commits
  7. 25 Feb, 2022 5 commits
    • Michele Degges's avatar
      Onboard to CRT (#11564) · b63a9c98
      Michele Degges authored
      
      Onboard Packer to CRT
      Co-authored-by: default avatarWilken Rivera <wilken@hashicorp.com>
      Co-authored-by: default avatarClaire Labry <claire@hashicorp.com>
      b63a9c98
    • Wilken Rivera's avatar
      Update HCP Packer build labels when re-running Packer on an incomplete build (#11584) · dd525fb8
      Wilken Rivera authored
      
      * Update HCP Packer build labels argument
      
      Previously when running a partial build on multi-cloud build template it
      was found that build labels were only being applied at the creation for
      the partially executed build. Leaving all other completed builds with
      no HCP Packer build labels. This updates how incomplete builds are
      loaded from the registry and ensure that any defined
      hcp_packer_registry.build_labels are assigned to the build before
      starting an actual Packer build.
      
      Related to: #11573
      
      * Add test case for overwriting build labels
      
      * Update tests to call CreateInitialBuild for non-existing builds
      
      * Rename test case to TestBucket_PopulateIteration
      
      * Fix data race in PopulateIteration against mock service
      
      Before Change
      ```
      WARNING: DATA RACE
      Write at 0x00c0005421b0 by goroutine 47:
        github.com/hashicorp/packer/internal/registry.(*MockPackerClientService).PackerServiceCreateBuild()
            /Users/scrubbed/Development/packer/internal/registry/mock_service.go:173 +0x2b6
        github.com/hashicorp/packer/internal/registry.(*Client).CreateBuild()
            /Users/scrubbed/Development/packer/internal/registry/service.go:169 +0x592
        github.com/hashicorp/packer/internal/registry.(*Bucket).CreateInitialBuildForIteration()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:107 +0x204
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration.func1()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:368 +0x14e
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration·dwrap·1()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:376 +0x58
      
      Previous write at 0x00c0005421b0 by goroutine 46:
        github.com/hashicorp/packer/internal/registry.(*MockPackerClientService).PackerServiceCreateBuild()
            /Users/scrubbed/Development/packer/internal/registry/mock_service.go:173 +0x2b6
        github.com/hashicorp/packer/internal/registry.(*Client).CreateBuild()
            /Users/scrubbed/Development/packer/internal/registry/service.go:169 +0x592
        github.com/hashicorp/packer/internal/registry.(*Bucket).CreateInitialBuildForIteration()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:107 +0x204
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration.func1()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:368 +0x14e
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration·dwrap·1()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:376 +0x58
      
      Goroutine 47 (running) created at:
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:362 +0x5c7
        github.com/hashicorp/packer/internal/registry.TestBucket_UpdateLabelsForBuild_withMultipleBuilds()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket_test.go:179 +0xf7
        testing.tRunner()
            /usr/local/go/src/testing/testing.go:1259 +0x22f
        testing.(*T).Run·dwrap·21()
            /usr/local/go/src/testing/testing.go:1306 +0x47
      
      Goroutine 46 (finished) created at:
        github.com/hashicorp/packer/internal/registry.(*Bucket).PopulateIteration()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket.go:362 +0x5c7
        github.com/hashicorp/packer/internal/registry.TestBucket_UpdateLabelsForBuild_withMultipleBuilds()
            /Users/scrubbed/Development/packer/internal/registry/types.bucket_test.go:179 +0xf7
        testing.tRunner()
            /usr/local/go/src/testing/testing.go:1259 +0x22f
        testing.(*T).Run·dwrap·21()
            /usr/local/go/src/testing/testing.go:1306 +0x47
      ==================
      ```
      
      * Add methods for managing builds on an Iteration
      
      * Update Mock Service to be a bit more concurrent
      
      It is a simple set of changes to make it work for the current testing
      use cases. If we need to we can move the Called fields to counters or
      re-architect the mock.
      
      This change also fixes a race condition when appending to the Slice of
      errs when calling PopulateIteration.
      
      * Update test case descriptions
      
      * Apply suggestions from code review
      
      Only append to errs if err is not nil
      Co-authored-by: default avatarSylvia Moss <moss@hashicorp.com>
      
      * Fix linting issues
      Co-authored-by: default avatarSylvia Moss <moss@hashicorp.com>
      dd525fb8
    • Wilken Rivera's avatar
      Update CODEOWNERS · 0a7dbb65
      Wilken Rivera authored
      Codeowners for external plugins are tracked within the respective
      plugin repo.
      0a7dbb65
    • Pekka Nurmi's avatar
      Add UpCloud plugin documentation (#11587) · a4450adc
      Pekka Nurmi authored
      
      * Add UpCloud plugin documentation
      
      * Update UpCloud plugin repository path
      
      * Add sourceBranch to UpCloud plugin description
      
      * Alphabetically sort plugin
      Co-authored-by: default avatarWilken Rivera <wilken@hashicorp.com>
      a4450adc
    • Johanan Liebermann's avatar
  8. 24 Feb, 2022 3 commits
  9. 22 Feb, 2022 1 commit
    • Wilken Rivera's avatar
      Update CreateIntialBuildForIteration to initialize each build its own map (#11574) · 119a8252
      Wilken Rivera authored
      * Rename mock bucket test file
      
      * Add failing tests for reproducing #11573
      
      ```
      === RUN   TestBucket_CreateInitialBuildForIteration
      2022/02/16 16:22:21 [TRACE] creating initial build for component happycloud.image
      --- PASS: TestBucket_CreateInitialBuildForIteration (0.00s)
      === RUN   TestBucket_UpdateLabelsForBuild
      2022/02/16 16:22:21 [TRACE] creating initial build for component happycloud.image
          types.bucket_test.go:87: expected the initial build to have an additional build label but thee is no diff: ""
      --- FAIL: TestBucket_UpdateLabelsForBuild (0.00s)
      === RUN   TestBucket_UpdateLabelsForBuild_withMultipleBuilds
      2022/02/16 16:22:21 [TRACE] creating initial build for component happycloud.image
      2022/02/16 16:22:21 [TRACE] creating initial build for component happycloud.image2
          types.bucket_test.go:125: Comparing component build labels: map[based_off:alpine source_image:another-happycloud-image version:1.7.0]
               against global build labels: map[based_off:alpine source_image:another-happycloud-image version:1.7.0]
          types.bucket_test.go:128: expected the initial build to have an additional build label but they are equal
          types.bucket_test.go:125: Comparing component build labels: map[based_off:alpine source_image:another-happycloud-image version:1.7.0]
               against global build labels: map[based_off:alpine source_image:another-happycloud-image version:1.7.0]
          types.bucket_test.go:128: expected the initial build to have an additional build label but they are equal
      --- FAIL: TestBucket_UpdateLabelsForBuild_withMultipleBuilds (0.00s)
      FAIL
      FAIL    github.com/hashicorp/packer/internal/registry   0.646s
      
      ```
      
      * Update CreateIntialBuildForIteration to initialize each build with a new map
      
      Previously upon creating the initial build the same map, which was
      initialized for the build_labels argument was being shared across all
      build images. This was causing an issue with labels being backed by the
      same map for all builds. This change ensures that all builds get their
      own map with any global build labels copied over during the initial creation.
      
      Closes #11573
      
      Passing tests with changes on branch
      ```
      RUN   TestBucket_CreateInitialBuildForIteration
      2022/02/16 16:37:40 [TRACE] creating initial build for component happycloud.image
      --- PASS: TestBucket_CreateInitialBuildForIteration (0.00s)
      === RUN   TestBucket_UpdateLabelsForBuild
      2022/02/16 16:37:40 [TRACE] creating initial build for component happycloud.image
      --- PASS: TestBucket_UpdateLabelsForBuild (0.00s)
      === RUN   TestBucket_UpdateLabelsForBuild_withMultipleBuilds
      2022/02/16 16:37:40 [TRACE] creating initial build for component happycloud.image
      2022/02/16 16:37:40 [TRACE] creating initial build for component happycloud.image2
          types.bucket_test.go:125: Comparing component build labels: map[based_off:alpine source_image:another-happycloud-image version:1.7.0]
               against global build labels: map[based_off:alpine version:1.7.0]
          types.bucket_test.go:125: Comparing component build labels: map[based_off:alpine source_image:the-original-happycloud-image version:1.7.0]
               against global build labels: map[based_off:alpine version:1.7.0]
      --- PASS: TestBucket_UpdateLabelsForBuild_withMultipleBuilds (0.00s)
      
      ```
      
      * Handle errors from bucket methods
      
      * Update test cases
      
      Initialize maps for bucket when calling NewBucketWithIteration
      119a8252
  10. 18 Feb, 2022 1 commit
  11. 16 Feb, 2022 2 commits
    • Adrien Delorme's avatar
      all shells: Pass env vars through a key value store (#11569) · 0362a3ec
      Adrien Delorme authored
      * allowing to set shell env vars from a key/value map.
      * tests
      
      This new map will work alongside the `environment_vars` but it allows using a
      datasource value seamlessly. At validation, and because `environment_vars` was
      an array of strings containing `KEY=value`, using datsources would not work,
      because these values are not known yet and would evaluate to `<unknown>`. With
      this, the value and the key can be unknown and will validate correctly for
      datasources.
      0362a3ec
    • Michael Weibel's avatar
      docs: add link to builder list (#11571) · f718dbdc
      Michael Weibel authored
      browsing through the documentation I was searching for the list of builders available. The obvious choice (builders page) didn't link to the list of builders and it took me a few minutes to find that. Adding a link to the plugins might speed up that bit and would avoid having to rescue to the search engine.
      f718dbdc
  12. 14 Feb, 2022 1 commit
    • Adrien Delorme's avatar
      Sanitize var code (#11566) · e03ad29c
      Adrien Delorme authored
      
      * evaluateLocalVariables: modify code for readability and some (not benchmarked) perfs
      
      * Make default input variable type the DynamicPseudoType
      
      This should be the default, and avoids a panic. This type can represent situations where a type is not yet known. Its meaning is undefined in cty.
      
      * do not take Empty types from default value
      
      * Update types.variables.go
      Co-authored-by: default avatarWilken Rivera <wilken@hashicorp.com>
      e03ad29c
  13. 11 Feb, 2022 1 commit
  14. 10 Feb, 2022 1 commit
    • Adrien Delorme's avatar
      Add `packer plugins` command and subcommands to interact with plugins (#11553) · 9f4a1281
      Adrien Delorme authored
      
      * add basic docs for plugins command
      
      * refactor docs
      Co-Authored-By: default avatarWilken Rivera <1749304+nywilken@users.noreply.github.com>
      
      * add plugins command
      
      * add plugins subcommands
      
      they do nothing for now
      
      * add plugins installed command + tests
      
      * add plugins install command
      
      * add remove plugin command
      
      * better docs for the plugins install command
      
      * remove duplicate content
      
      * better output for installed plugins
      
      * add plugins required command
      
      * Update plugins_install.go
      
      * add newline after `Usage:`
      
      * Update plugins_remove.go
      
      * Update plugins_required.go
      
      * Update plugins_remove.go
      
      * Update plugins_installed.go
      
      * Update plugins_install.go
      
      * add docs
      
      * Update plugins_install.go
      
      * fix typos
      
      * Update plugins_test.go
      
      * fix typos
      Co-Authored-By: default avatarWilken Rivera <1749304+nywilken@users.noreply.github.com>
      
      * Update core_wrapper.go
      
      Co-Authored-By: Wilken Rivera <17493...
      9f4a1281
  15. 09 Feb, 2022 1 commit
  16. 03 Feb, 2022 2 commits
    • Kevin Wang's avatar
      833bd514
    • Wilken Rivera's avatar
      core/hcl2: Fix issue preventing builds from pausing between provisioners when... · 2ad15617
      Wilken Rivera authored
      core/hcl2: Fix issue preventing builds from pausing between provisioners when the `--debug` argument has been passed (#11537)
      
      * Update HCL2 PackerConfig to call SetDebug mode for CoreBuild when --debug flag is passed
      
      ```
      ~>  packer build --debug /tmp/source.pkr.hcl
      Debug mode enabled. Builds will not be parallelized.
      null.example: output will be in this color.
      
      ==> null.example: Pausing after run of step 'StepConnect'. Press enter to continue.
      ==> null.example: Pausing before the next provisioner . Press enter to continue.
      ==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell4149319610
          null.example: hi
      ==> null.example: Pausing before the next provisioner . Press enter to continue.
      ==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell3210691290
          null.example: hi 2
      ==> null.example: Pausing after run of step 'StepProvision'. Press enter to continue.
      ==> null.example: Pausing before cleanup of step 'StepProvision'. Press enter to continue.
      ==> null.example: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
      Build 'null.example' finished after 8 seconds 284 milliseconds.
      
      ==> Wait completed after 8 seconds 284 milliseconds
      
      ==> Builds finished. The artifacts of successful builds are:
      --> null.example: Did not export anything. This is the null builder
      ```
      
      * Add call to SetOnError, and SetForce
      2ad15617
  17. 02 Feb, 2022 1 commit